Skip to main content

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


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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dyrkdevice-0.1.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file dyrkdevice-0.1.0.tar.gz.

File metadata

  • Download URL: dyrkdevice-0.1.0.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for dyrkdevice-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ab2730cc11b2c9ead90b4fbee114f1369672076d0a0f2107d690500d43ac602d
MD5 d0ff38d245384d65ae91d3de15012eba
BLAKE2b-256 2135d590af646b91525a8acc1e7ec0f98a57cfe9faa38d9e555ac632c130028c

See more details on using hashes here.

File details

Details for the file dyrkdevice-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dyrkdevice-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for dyrkdevice-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d61df0226fc1504cefedcb5d12ead0486c245ff404553a2ee8e98b30dd3b9705
MD5 4ae989658c9fac614eb9198c2cced3dc
BLAKE2b-256 9d9e2d76c4c79e86d634f6116e5d614f75e03c5fcd24275bd70bcf99925cf7d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page