Hi,
I have configured my Homey to communicate with MQTT to my Home Assistant. The problem is when I have restarted my Home Assistant for configuration changes. Home Assistant losing connection with the Homey. To get things working again, I need to restart my Homey MQTT Client app, and send -broadcast from MQTT Hub on Homey. After this everthing is working normally again.
My setup is like this.
MQTT Hub(v2.1.9) and MQTT Client(v2.2.3) installed on my Homey Pro.
Client is configured to connect Mosquitto Broker(v5.1) running on the Home Assistant.
How can I fix the problem, so I dont need to restart MQTT Client and broadcast every time Home Assistant has been restarted?
By setting birth and last will messages, upon restart Home Assistant advertises itās presence to the MQTT broker. This in turn triggers the MQTT hub app of Homey to broadcast all the devices and their state to the broker which Home Assistant uses to repopulate the devicesā¦ When set successfully, there should be no need to reboot the Homey hub or client app after a Home Assistant reboot, just wait and the devices will turn from unavailable to proper state. You can actually observe this while opening the settings of the MQTT hub app on Homey and restarting Home Assistant: you will see the green bar of broadcast start automatically!
I have now added the birth and last will setting in Home Assistant. Needed to restart both Hub/Client after I added them. Tried to restart the Home Assistant now. And it seems to work
Although I can see this works around the issue I wonder is this because the MQTT HA Auto Discovery messages are not being sent retained ? I assume the homie topics are retained , except the ā¦/set ones. It should just work without LWT
Retained messages on a broker provide the last reported payload value to any new connecting client, useful when clients frequently disconnect/reconnect. The last retained is usually the current value unless the providing source is no longer connected.
For homie configuration values, and indeed for HA Discovery information, as this is not āchangingā data this is ideal. For status values itās more a case of what youāre wanting but usually you want this and the homie spec defines it For command topics itās definitely not typical to retain such values.
As you are causing Homey to resend itās last (current) data with LWT it should be the same as Homey is constantly connected (and wouldnāt be able to respond to LWT unless it was anyway)
Compared your setup with mine, Its very similar. Only different I found was the command is turn āonā in my configuration. I need to restart the app sometime. But not often, i restart my HA all the time when Im doing configuration on it.
Iāve fixed itā¦ eventually it was quit stupid; the quotes Iāve used where copy/pasted from somewhere else, and werenāt the right ones. When I retyped them, the string-text from/payload (hass/status, online) āturned greenā instead of black, and now everything automatically updates when HA restarts.