I run a Mosquitto broker on a Raspberry Pi with about a dozen ESP8266 and ESP32 nodes: relays, temperature sensors and a garage door controller. My topics grew without a plan, and I have seen odd behaviour: a relay that switches by itself when its node reboots, and sensors that show stale values on the dashboard after the node has died.
What is a sound way to organise topics, and when should I use retained messages and the different QoS levels?




