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?
Can you please provide some more context? How can this solve his issue?
I am asking because I have a similar issue (see this post)
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
Thanks for your assistance
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
Not an expert on retained MQTT messages, but from what I have understood, they are not always the way to go either?
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)
I see, thanks for a clear explanation!
Maybe it’s good to also hear @HarriedeGroot opinion as developer of the MQTT hub app?
Just merged a pull request:
Hi, my configuration.yaml looks like this, but I still have to restart the HUB-app on Homey everytime I restart HA.
And these are my HUB-settings
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.
This is a very annoying error on this forum, single and double quotes are mis-formed:
Uless you use this: Preformatted text (ctr+shift+c )