MQTT Topics
| BADGER |
MQTT topics have grown somewhat organically, with an inspiration from the Homie IoT Convetion - albeit v1. However, things have expanded from there and there are various attempts to extend the approach, some of which worked, and others which didn’t. This page will try to enumerate the entire known SMC mqtt universe…
Structure
There is no single mental model that captures all of our topics neatly. Very roughly though, there is a sort-of structure, in that topics typically:
-
start with sets of key-value pairs
-
revolve around an 'anchoring' topic, which has a raw message on it
-
and may have optional 'suffix' topics to add some metadata about the topic
There are exceptions, including notably in cases where we actually have a 'collection' of messages against some id, where our rough structure would ideally have had an 'anchor' topic.
This will hopefully all make more sense when you read the actual topic structure below…
Devices
The concept of a 'device' is a little hazy (see the Glossary).
| Services also report themselves as Devices |
Devices Topic Tree
| Topic | Purpose | Message | Notes |
|---|---|---|---|
|
|
None |
As this term never varies it could be considered redundant. Its purpose at this time is really therefore just to indicate that the topics underneath it follow the SMC conventions. We can create new namespaces alongside if we want. There is no agreement on whether and what these additional namespaces might actually be yet. |
|
|
None |
There is no convention around Device IDs |
|
'dollar-topic' declare (ideally static) properties for the Device |
See the following section for details of the specific properties available |
Static Device Properties
| Topic | Purpose | Message | Notes | ||
|---|---|---|---|---|---|
|
The display name for this device |
String. e.g. |
A static property of the device |
||
|
A firmware name |
String.
|
A static property of the device |
||
|
The firmware version |
Semver. e.g. |
A static property of the device |
||
|
The service name |
String. e.g. |
A static property of the device |
||
|
The service version |
Semver. e.g. 1.2.3 |
A static property of the device |
||
|
The hostname of the OS on which the agent reporting this device data is running |
String. e.g. |
A static property of the device |
||
|
The ip address of the OS on which the agent reporting this device data is running |
IPv4. e.g. |
A static property of the device |
||
|
|
Dynamic Device Properties
| These should probably be signals, rather than properties |
| Topic | Purpose | Message | Notes | ||
|---|---|---|---|---|---|
|
The status of the device |
|
This can be set either explicitly by the device, or via an MQTT last-will-and-testament |
||
|
How long the device has been 'up'. |
Integer |
|
||
|
The strength of the wifi signal |
Integer. |
Signals
Signals are 'owned' by Devices, and all the following topics live underneath devices/<device_id>/, which is represented by the shorthand prefix '…'.
Signals Topic Tree
| Topic | Purpose | Message | Notes | ||
|---|---|---|---|---|---|
|
|
None |
|||
|
|
The raw signal message.
|
There is no convention around Signal IDs. |
||
|
This declares the existence of a signal, along with its properties |
||||
|
An alert generated against this signal |
See Signal Alerts |
This alert may be generated by the device itself, or on behalf of the device by another service |
||
|
|
||||
|
Used when a Signal is actually comprised of a number of signals, each with their own sub-id |
Same as a signal:
|
|