I am running the 65.3 version of HA on HASS.IO and also v646 on another intall with all-in-one.
In both instances, I have some devices that I have built which are configured to use MQTT Discovery to allow some lighting control.
In both instances, they are discovered and work fine controlling the lighting as expected.
However, also in both cases, if I restart HA, those devices then disappear, unless I reboot the device and have it repost its configuration data to the config topic, and then it re-appears.
Can someone tell me how to make the devices not disappear when HA restarts? I’m guessing that there must be some message that has to persist or something. I have retain=true in the config message but maybe it is something else.
I haven’t used discovery, but I would imagine that the configuration topic has to be sent with the retain flag set. The broker will then send this to HA whenever HA restarts.
I have retain=true, and I have also tried all three QOS levels, same result…
I know that I could resend the config message either on a timer or in reaction to the restart HA event, but I’m thinking there is a more elegant way, but, maybe not…
The elegant method is to set the retain flag when the config message is sent, and have HA pick up the message when it restarts.
Have you checked that the broker is actually recognizing that the retain flag has been set by using another client to subscribe to the config messages?
You know, I was gonna simply reply that I had checked it with another client (because it was working at one point, and I had checked it with another client), but then I thought I better check again, and voila, it wasn’t set.
I dug through my code and found my error (it was set to false, but I don’t remember when I did that).
Anyhow, that was the issue. Thanks for pushing me to take another look!