Since my IoT network slowly grows up, I have mode devices. And more devices means more data and also more errors in the network. Till now, every of my devices use following MQTT topics:
- <location>/<quantity> - For common data measurements, such as living-room/temperature.
- presence/<devname> - For presence topic with retain bit set.
Devices are connected to their local broker in designated area. Every local broker is bridged to central broker and outgoing messages are prefixed with the name of the area. For example living-room/temperature becomes my-house/living-room/temperature.
This works fine with few devices, but now I have many devices based on different kinds of processors, different versions of PCBs, different SW versions and much more. For that reason, I'm designing new topic scheme:
Data topics
- <location>/<quantity> - Main device sensor measurement.
- <location>/<quantity>/error - Error code indicating sensor read failure.
Where
- <location> - Location in designated area (example: `living-room`).
- <quantity> - Measurement physical quantity (example: `temperature`).
Service topics
All service topics should set retain flag.
- i/<devname>/hwversion - HW version.
- i/<devname>/fwversion - FW version.
- i/<devname>/presence - Presence message.
- online - Device is online.
- offline - Device is offline. This message is sent by the broker using last will message.
- i/<devname>/arch - Device architecture.
- avr - AVR based devices.
- esp - ESP based devices.
- i/<devname>/variant - Procesor model.
- atmega328p - ATMega 328p chip.
- esp8266 - ESP8266 chip.
- i/<devname>/link - Link information.
- ethernet - Ethernet LAN connection.
- wifi - Wi-Fi connection.
- nrf24 - NRF24 wireless connection.
- i/<devname>/voltage - Input voltage. For battery powered devices.
- i/<devname>/ip - Device IP address. Make network debugging easier.
Where
- <devname> - Device name.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.