Homie
Python 3 implementation of Homie 4.0.0
Class based system to easily add Homie 4.0.0 support to devices.
Supports the Meta, Statistics, and Firmware extensions
Includes ready to use common devices such as switch, dimmer, contact, thermostat, boolean, etc.
Install
pip install Homie4
Note: On Raspbian use
pip3 install Homie4
Temperature Probe Example
Creates a temperature device using a AM2302 sensor.
import Adafruit_DHT
import time
from homie.device_temperature import Device_Temperature
mqtt_settings = {
'MQTT_BROKER' : 'OpenHAB',
'MQTT_PORT' : 1883,
}
try:
temperature_device = Device_Temperature(device_id="temperature-sensor-1",name = "Temperature_Sensor 1",mqtt_settings=mqtt_settings)
sensor = Adafruit_DHT.AM2302
pin = 4
while True:
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
print(temperature)
temperature_device.update_temperature(temperature)
time.sleep(5)
except (KeyboardInterrupt, SystemExit):
print("Quitting.")
Dimmer Example
To create a dimmer device requires that a set_dimmer method be provided. When creating a device, all that is required is to provide the MQTT settings. All other requirements of the Homie specification are automatically handled.
import time
from homie.device_dimmer import Device_Dimmer
mqtt_settings = {
'MQTT_BROKER' : 'QueenMQTT',
'MQTT_PORT' : 1883,
}
class My_Dimmer(Device_Dimmer):
def set_dimmer(self,percent):
print('Received MQTT message to set the dimmer to {}. Must replace this method'.format(percent))
super().set_dimmer(percent)
try:
dimmer = My_Dimmer(name = 'Test Dimmer',mqtt_settings=mqtt_settings)
while True:
dimmer.update_dimmer(0)
time.sleep(5)
dimmer.update_dimmer(50)
time.sleep(5)
dimmer.update_dimmer(100)
time.sleep(5)
except (KeyboardInterrupt, SystemExit):
print("Quitting.")
If creating multiple homie devices, you can specify Homie to only use one MQTT connection. This can be an issue on devices with limited resources. For MQTT_SETTINGS add MQTT_SHARE_CLIENT: True.
Metadata
Release files for Homie4 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Homie4-0.4.0.tar.gz | 18.1 kB | Without provenance | Details for Homie4-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| Homie4-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for Homie4-0.4.0-py3-none-any.whl |
Total release size: 54.9 kB
Release files / Homie4-0.4.0.tar.gz
| Download URL | Homie4-0.4.0.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b56da7669eff31d4600247dc8ce2c79f2690f13dc8ce80b81aa5b5b06b942bc
|
|
BLAKE2b-256 checksum How to use checksums |
d4eb382681ed89dc1832b2efaf34c46a40ba0fc04f3c26caa3ac9f1f88c2c657
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9
|
Release files / Homie4-0.4.0-py3-none-any.whl
| Download URL | Homie4-0.4.0-py3-none-any.whl |
|---|---|
| Size | 36.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a754f9a8fa1c61ce2ac10985d071e3e8af9bebee92039424b1dcfbf139d75a94
|
|
BLAKE2b-256 checksum How to use checksums |
081df8e509e201726261313c15ca22225aba3364d045b07b65882819e50c9b98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9
|
Security for Homie4 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.