-
Notifications
You must be signed in to change notification settings - Fork 8
Plugins: Getting Started
Sean Shahkarami edited this page Oct 7, 2020
·
12 revisions
pywaggle provides an implementation of the Waggle plugin interface to make it easy to hook existing code into the Waggle data pipeline. This allows developers to publish and subscribe to various data streams throughout the pipeline.
We'll start with the basics of publishing. In this example, we make up a fake humidity value and publish it so it can be sent to beehive and other plugins.
import waggle.plugin as plugin
import time
plugin.init()
while True:
# publish made up htu21d humidity value
plugin.publish('env.humidity.htu21d', 12.34)
time.sleep(1)The plugin interface performs its work in a background thread and communicates through thread-safe queues. This allows it to be used safely and easily in a range of existing designs (multithreaded, callback based, asyncio based, etc) without interrupting the program flow.