dyrkdevice-0.1.0
توضیحات
Library for implementing a dyrk device
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | dyrkdevice-0.1.0 |
| نام | dyrkdevice |
| نسخه کتابخانه | 0.1.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Dyrk |
| ایمیل نویسنده | bok.will@gmail.com |
| آدرس صفحه اصلی | https://dyrk.io |
| آدرس اینترنتی | https://pypi.org/project/dyrkdevice/ |
| مجوز | - |
# 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()
```
نیازمندی
| مقدار | نام |
|---|---|
| >=5.4.1 | pyyaml |
| >=1.5.1 | paho-mqtt |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.9 | Python |
نحوه نصب
نصب پکیج whl dyrkdevice-0.1.0:
pip install dyrkdevice-0.1.0.whl
نصب پکیج tar.gz dyrkdevice-0.1.0:
pip install dyrkdevice-0.1.0.tar.gz