|Stream based communication||✓||–||–|
|Message based communication||–||✓||✓|
|Defined topic structure||–||–||✓|
|Multiple Payload types||–||–||✓|
MQTT supports easy and unrestricted message-based communication.
However, MQTT doesn’t define the structure and content of these messages and their relation. An IoT device publishes data and provides interaction possibilities but a controlling entity will need to be specifically configured to be able to interface with the device.
The Homie convention defines a standardized way of how IoT devices and services announce themselves and their data on the MQTT broker.
It is thereby a crucial aspect on top of the MQTT protocol for automatic discovery, configuration and usage of devices and services.
Homies topic layout follows the pattern “homie/device/node/property”.
In this example our device has a thermostat functionality where the target temperature can be read from and written to. The thermostat function is modelled as node, the temperature is a property of that node.
The following topics are published as retained messages to the broker:
homie / device123 / $homie → 3.0 homie / device123 / $name → My device homie / device123 / $state → ready homie / device123 / $extensions → '' homie / device123 / $nodes → my_thermostat homie / device123 / my_thermostat / $name → My thermostat homie / device123 / my_thermostat / $properties → temperature homie / device123 / my_thermostat / temperature → 22 homie / device123 / my_thermostat / temperature / $name → Temperature homie / device123 / my_thermostat / temperature / $unit → °C homie / device123 / my_thermostat / temperature / $datatype → integer
Any Homie compliant controller can now find “My device” and will find out about “My thermostat” with “Temperature in °C” and that it needs to publish to “…/temperature/set” to change the temperature.
If we got your attention, head over to the specification and let all your questions being answered.