-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Z2M does not send device statuses on HA restart #22839
Comments
@francisp2 Thanks - they didn't match, but DO match now - I verified it in HA and Z2M. However, while I see this in the Z2M log: I still don't see the status of zigbee devices in HA after restarting HA. I am assuming I don't need legacy attributes or triggers turned on. So this issue is still valid, at least for me. |
Correct. When MQTT is receiving the message on startup, Z2M will listen to it, and it triggers a republishing of all the devices states.
The publishing state is supposed to start 30s after receiving the message. |
A fixed time might not work. First because autoconf can take longer than that (even with recent improvements it takes 50 seconds on the Z2M side). Also, that's just the time for Z2M to do it's autoconf publishing. Who knows how long it will take HA to do it's side of auto configuration and subscribe to the topics. That's what I think is happening, even if statuses are send 30s after the birth, HA has not yet had time to process autoconf and subscribe to device topics. On one hand, future HA is introducing device autoconf (instead of entity) which will help as I have 180 devices whis is more than 12000 entities. They are also adding a bunch of other performance improvements. On the other hand, we should ask HA to add an afterbirth message sent when HA has finished autoconf and subscribed to all relevant topics. Z2M could then trigger off that for sending statuses without guessing the required delay. |
You could create an automation after start
|
I am not familiar with how and when HA is sending the birth message : i would assume that the message is sent when HA has completed all necessary setup. Maybe to check in the HA code when this is triggered. Also this to follow : #21500 (comment) |
@francisp2 Hrm, looks like you're right https://github.com/home-assistant/core/blob/ca89d22a34884b789a4154a3e426f93243041042/homeassistant/components/mqtt/client.py#L997 - the birth should be sent after discovery is done and subscriptions to device topics are done. So I'm not 100% sure what's going on in my case. |
I just double checked, ant yeah, I get the
And 30s later, I see all my devices publish to their topics. So I guess I'll have to investigate this on HA's side, as Z2M does appear to do what it's supposed to. |
Nevermind :) you answered my question :) |
Closing this. After upgrading Z2M to 1.38.0 (which reduced the auto detection cycle on startup to 5 seconds now instead of 50), and upgrading HA to 2024.6.0 (which includes a bunch of efficiency improvements to the MQTT interface), this seems to be working again properly. |
What happened?
If Home Assistant restarts (running Z2M), all device states are "unknown" and not intractable. If Z2M restarts (running HA), all states are updated.
What did you expect to happen?
On EITHER Z2M or HA restart, the state of all devices should be sent to Home Assistant (via. MQTT). Home Assistant sends a birth message to aid in this (though they may need an 'afterbirth' message, for when they have completed doing their device detection / auto-configure). This used to happen a long time ago, not sure if a Z2M or HA change broke it.
Alternatively, it would be nice to have a separate button to send all device states to MQTT, without having to restart Z2M or go through re-discovery/autoconfiguration.
How to reproduce it (minimal and precise)
Restart Home Assistant without restarting Z2M.
Zigbee2MQTT version
1.37.1
Adapter firmware version
7.4.1.0
Adapter
ember
Setup
HA, Z2M and MQTT are in individual docker contasiners.
Debug log
No response
The text was updated successfully, but these errors were encountered: