/blog
MQTT topic design for machine dataA topic tree is a contract with the future. Get it wrong and every unit needs reflashing to move one level in the hierarchy.
MQTT leaves topic naming to the project. That freedom is a trap: the tree outlives the hardware, the firmware and often the supplier. Three rules keep it usable.
Rule 1: identity first, then kind, then value
A tree that starts with the machine identity keeps permissions simple - a unit may only publish under its own branch. A tree that starts with the message kind forces every consumer to know the whole fleet before it can subscribe.
Rule 2: keep the payload, not the path, extensible
Adding a value should be a payload change, not a new topic. If every new sensor invents a topic, subscribers multiply and the tree becomes a schema that nobody documents.
Rule 3: write the tree down before the first unit ships
Changing the topic later means reconfiguring every installed unit. That is exactly the kind of change a buyer should insist is a parameter, not a firmware release - and exactly the kind of thing a project forgets to specify.
The mistake that makes migration expensive
Putting the platform's vendor name or a version number in the path. "v2" in a topic looks tidy and means the next platform change touches every device. Version the payload, not the path.
What to put in the contract
- The topic pattern, with an example.
- Which part is per-unit identity and which is shared.
- QoS expectation and the behaviour on a missed message.
- Whether the unit can publish to a second endpoint for a migration window.
Next
DTU hardware · ThingsBoard · AWS IoT Core · payload contract.
Data sheet, interface list and a payload example on request — contact us (ralph@gz-can.com · +86 130 7692 2278).