MQTT Device Template¶
The base class for MQTT based devices.
Tasmotais a good reference for implementing new MQTT based device templates.
Pings both the worker and mqtt_broker services that they should reload the setup.
init_mqtt(client_id=None, on_message=False, on_connect=False, on_disconnect=False)[source]¶
This will open a connection to the mqtt broker and register any callbacks you pass in as parameters.
client_id (str.) – The name this connection should register as with the broker.
on_message (function.) – Callback function that gets called when a new message is received.
on_connect (function.) – Callback function that gets called when the connection to the broker is successful.
on_disconnect (function.) – Callback function that gets called when the broker disconnects.
paho.Client – the paho Client object instance