Skip to main content

Homie 3.0.1 Implementation

Project description

Homie

Python implementation of Homie 3.0.1

Class based system to easily add Homie 3.0.1 support to devices.

Install

pip install Homie3

EG. 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.")      


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Homie3, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size Homie3-0.3.0-py3-none-any.whl (32.8 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size Homie3-0.3.0.tar.gz (12.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page