MQTT Disconnect

Hi All,

I have some MQTT based devices running on ESP8266’s. I’m having problems when I update Home-assistant and restart the service. As the ESP connects to the broker it’s unable to detect that Home-assistant has restarted which means I’m not able to re-publish the state of the GPIOs.
I’m thinking that if Home-Assistant we’re able to publish a LWT this would resolve my issue as my clients would be able to subscribe to this topic and therefore detect the state of Home-assistant (note it’s the service and not the device that I’m tracking so an external script publishing state would not work).

Does anybody have any suggestions on how this could be done or does anybody have the ability to integrate publishing a LWT within home-assistant?

Thanks in advanced for your assistance.

Can’t you publish the values with retain flag set to true? Home assistant would get the last value upon subscribing to the topics.

Thanks for the quick response. I didn’t know you could set a value to retain, I’ll look into it.

Looks like that’s spot on thanks, I’ll give it a test over the weekend.

1 Like

Hi martinhjelmare,

that worked like a dream thanks.

1 Like