MQTT Device Template¶
- class
festivalgrid.device_templates.mqtt_device.
MQTTDevice
(device)[source]¶ The base class for MQTT based devices.
Note
Tasmota
is a good reference for implementing new MQTT based device templates.
-
festivalgrid.device_templates.mqtt_device.
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.
- 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.
- Returns
paho.Client – the paho Client object instance