One of the crucial aspects of MQTT is the broker. Among other things, the broker manages connected clients, ensuring messages are received from and sent to the correct devices. The broker doesn’t simply forward messages, however. It can also respond to devices being connected and disconnected - an immensely useful feature. I recently updated lightt to leverage two MQTT features:

  • Last Will and Testament (LWT) for availability updates
  • Retained messages for persistent state

Here’s an explanation of what I did to get these features working for me, with some examples from Home Assistant and mosquitto. If you...•••