Plugin MQTT¶
Purpose¶
The MQTT plugin is used to received subcribed Topic for Domogik sensors from a Mosquitto server or Publish Topic Domogik command value to a Mosquitto server.
This is a “No xPL” version.
Plugin Information Page¶
Dependencies¶
- A mosquittto MQTT server on local or remote host
On Debian jessie:
# apt-get install mosquitto (MQTT version 3.1/3.1.1 compatible message broker)
- Python module: paho-mqtt (>=1.1)
On Debian jessie:
# pip install paho-mqtt
Warning
On Debian Wheezy, mosquitto version is to old, don’t support MQTT version 3.1.1 protocol. Choose MQTTv31 protocol in plugin configuration
Plugin configuration¶
Here is the global configuration:¶
Key | Type | Description |
---|---|---|
MQTT Host | string | The hostname/@Ip of Mosquitto server |
MQTT port | integer | The TCP port of Mosquitto server |
MQTT protocol | Choice | Select MQTTv31 protocol for old Mosquitto version |
Create the domogik devices¶
Create device by device type¶
There is different devices type for sensors (Temperature, Humidity, OpneCLose, OnOff, String ...) and for commands (Switch, String)
Two parameters are needed for a domogik device creation:
Key | Type | Description |
---|---|---|
MQTT Topic | string | The ‘Topic’ to subscribe (sensor) or to publish (command) |
MQTT Qos | Integer | Quality of service level to use => 0..2, (0 by default) |
Topic:
Messages in MQTT are published on topics. Topics are treated as a hierarchy, using a slash (/) as a separator. This provides a logical structure of common themes to be created, much like any file system you have used. So, for example, multiple computers could publish their hard drive temperature information on the following single topic, by inserting their unique computer and hard drive name: sensors/COMPUTER_NAME/temperature/HARDDRIVE_NAME
Example of Topic:
To subscribe (the plugin listen to this topic to update device sensor):
domogik/house/livingtemp (To received the temperature of the living-room)
domogik/meteo/garden/temp (To received the inside temperature)
To publish (the plugin send this topic message for other MQTT client):
arduino/relay1 (to set on/off a relay on Arduino with MQTT lib)
kody/command/notify (To send a notification to kodi)
Quality of Service:
- 0: The broker/client will deliver the message once, with no confirmation (fire and forget).
- 1: The broker/client will deliver the message at least once, with confirmation required (no tested in the plugin).
- 2: The broker/client will deliver the message exactly once by using a four-step handshake (no tested in the plugin).
See Dev page to test subscribing or publishing message in Command line.
Start the plugin¶
You can now start the plugin (start button) and use the created domogik devices.
Set up your widgets on the user interface¶
You can now place the widgets of your devices features on the user interface.
Troubleshooting¶
You can see ERROR or WARNING messages in the Advanced Panel of the Admin interface.