Skip to main content

A set of helpers for implementing Homie IoT Convention

Project description

homie-helpers

Yet another python implementation of Homie Convection

In fact, it's a wrapper around another library Homie4 - just with changed API

Quick start

There are two possible approaches - choose one that suits you more!

Approach 1: setting properties using device object

# Let's create settings first...
SETTINGS = HomieSettings('mqtt.eclipseprojects.io', port=1883, username='...' password='...')

# Callback for 'ison' property
def set_enabled(value):
    print('Turning %s' % ('on' if value else 'off'))

# Create Homie object
# At this moment the MQTT messages will be sent!
homie = Homie(SETTINGS, "my-thermometer", nodes=[
    Node("status", properties=[
        FloatProperty("temperature", unit="C"),             # client cannot modify this property
        BooleanProperty('ison', set_handler=set_enabled)    # client CAN modify this property - will call callback
    ])
])

homie['temperature'] = 20.0

Approach 2: setting properties using property objects

# Let's create settings first...
SETTINGS = HomieSettings('mqtt.eclipseprojects.io', port=1883, username='...' password='...')

# Callback for 'ison' property
def set_enabled(value):
    print('Turning %s' % ('on' if value else 'off'))

property_temperature = FloatProperty("temperature", unit="C"),      # client cannot modify this property
property_ison = BooleanProperty('ison', set_handler=set_enabled)    # client CAN modify this property - will call callback 
    
# Create Homie object
# At this moment the MQTT messages will be sent!
homie = Homie(SETTINGS, "my-thermometer", nodes=[
    Node("status", properties=[property_temperature, property_ison])

property_temperature.value = 20.0

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

homie-helpers-0.0.7.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

homie_helpers-0.0.7-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file homie-helpers-0.0.7.tar.gz.

File metadata

  • Download URL: homie-helpers-0.0.7.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for homie-helpers-0.0.7.tar.gz
Algorithm Hash digest
SHA256 d1b0512cc68d7810c7ec55d71b8dc32f0cc12cf1f71cd8df6f672e1fcc325686
MD5 72dcbcbc84bd1da28153ea0bbcaea628
BLAKE2b-256 b25175ddcdb1dc7934fcef15394c685de7625b8ad5a8728c36e6ffdf2d474c91

See more details on using hashes here.

File details

Details for the file homie_helpers-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for homie_helpers-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 2d30de2ea05d92299abedeed156764639bdd13d277bda2323256fa722e51408c
MD5 720d7c2ce076b9a21371a416f8827305
BLAKE2b-256 26f361285f39aabc61c5eaeb931d379e5755244e08c6a0313b2e676c472bc1bb

See more details on using hashes here.

Supported by

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