Library for implementing a dyrk device
Project description
Dyrk Device
This library helps implement a dyrk device in the ecosystem of dyrk.io
The library takes care of connection and communication with the dyrk host, and leaves the implementation of the functions to the user
Getting started
Installing
$ pip install dyrkdevice
implementing a device
from dyrkdevice.basicDyrkDevice import BasicDyrkDevice
device = BasicDyrkDevice()
# reacts to the event with name "output_event"
@device.event(eventName="output_event")
def output(output_state: list):
print("output event invoked")
# Adds metadata fields to the returned dictionary and
# sends it via mqqt every 10 second
@device.measure(measureName="fakeMeasure", interval=10)
def fake():
return {
"temperature": 22,
"pressure": 1000,
"humidity": 55,
}
# In case of custom events or overwriting of behavior
@device.eventParser(eventName="customEvent")
def customEventParser(self, event: dict):
return event["customField"]
@device.event(eventName="customEvent")
def custom(customField: str):
print("custom event invoked")
device.run()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dyrkdevice-0.1.0.tar.gz
(17.1 kB
view hashes)
Built Distribution
dyrkdevice-0.1.0-py3-none-any.whl
(17.6 kB
view hashes)
Close
Hashes for dyrkdevice-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d61df0226fc1504cefedcb5d12ead0486c245ff404553a2ee8e98b30dd3b9705 |
|
MD5 | 4ae989658c9fac614eb9198c2cced3dc |
|
BLAKE2b-256 | 9d9e2d76c4c79e86d634f6116e5d614f75e03c5fcd24275bd70bcf99925cf7d3 |