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
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file homie_helpers-0.0.7.dev1677104458-py3-none-any.whl.
File metadata
- Download URL: homie_helpers-0.0.7.dev1677104458-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ff06ac342d1c611e18f0aad778853402569a122b0d2da5593d402009aefc798
|
|
| MD5 |
a430ddafd54e3aafb3a9a5d23a762285
|
|
| BLAKE2b-256 |
a5ac226254baf47be14685f694e0f3ae932e33196238a38351cc71a261ab6716
|