MQTT
The MQTT module wraps the Paho MQTT Client library and connects to a broker to allow communication with home automation solutions or other controllers.
Don’t forget to install the requirements
pip3 install -r requirements/mqtt.txt
Paths
MQTT topics are composed of the root topic
plus the path. Ex.
{root topic}/{node-id}/{property-id}
The MQTT module subscribes to {root topic}/+/+/+/#
and will pass any message matching
{root topic}/{node-id}/{property-id}/+/#
to the interface module that registered the
node, provided a callback was given.
Configuration
The following options are available in the configuration file. Optional settings are commented out with their default values shown.
mqtt:
host:
#port: 1883
#client id: '{hostname}'
#username: ''
#password: ''
#qos: 0
#retain: false
#root topic: '{client_id}'
#lwt topic: 'lwt'
#heartbeat interval: 300
Option |
Description |
---|---|
|
The IPv4 address or hostname of your MQTT broker. |
|
The port your MQTT broker is running on. Optional, default |
|
MQTT Client ID used when connecting to the broker.
Optional, default |
|
Username to use when authenticating with the MQTT broker. Optional. |
|
Password to use when authenticating with the MQTT broker. Optional. |
|
Quality of Service setting to use when publishing to MQTT. Modules can specify a QoS when publishing. Optional, default |
|
Default retain flag to use when publishing to MQTT. Modules can specify the retain flag when publishing. Optional, default |
|
The root topic to use for all other topics. Substitutions:
Optional, default |
|
Last Will topic to publish online/offline messages. Full
topic is Optional, default |
|
Interval in seconds to publish status messages. Optional, default |