zigbee2mqtt
zigbee2mqtt copied to clipboard
Device availability (advanced) unexpected behavior
What happened?
I tried to figured out the behavior of the availabity advanced feature in order to get my devices getting offline more quickly after a power off. I've read dozens of issues related to availability topics but they all seem differents and in a particular setup (z2m version, hardware, config, behavior...)
Here is my availability config:
availability:
active:
timeout: 1
passive:
timeout: 300
According to the documentation, with this configuration my active devices should go offline after 1 min and 5h for passive devices. So I did a check and powered off 1 Hue bulb at 21:16:15
Here is the debug (filtered) about 8min later:
warn 2023-11-10 21:24:28: Failed to ping 'Lampe salon' (attempt 1/2, Read 0x001788010b7fd3f7/11 genBasic(["zclVersion"], {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":true,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Timeout - 21815 - 11 - 219 - 0 - 1 after 10000ms)) warn 2023-11-10 21:24:51: Failed to ping 'Lampe salon' (attempt 2/2, Read 0x001788010b7fd3f7/11 genBasic(["zclVersion"], {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Timeout - 21815 - 11 - 225 - 0 - 1 after 10000ms)) info 2023-11-10 21:24:54: MQTT publish: topic 'zigbee2mqtt/Lampe salon/availability', payload '{"state":"offline"}' warn 2023-11-10 21:25:32: Failed to ping 'Lampe salon' (attempt 1/2, Read 0x001788010b7fd3f7/11 genBasic(["zclVersion"], {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":true,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Timeout - 21815 - 11 - 236 - 0 - 1 after 10000ms)) warn 2023-11-10 21:25:55: Failed to ping 'Lampe salon' (attempt 2/2, Read 0x001788010b7fd3f7/11 genBasic(["zclVersion"], {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Timeout - 21815 - 11 - 239 - 0 - 1 after 10000ms)) info 2023-11-10 21:25:58: MQTT publish: topic 'zigbee2mqtt/Lampe salon/availability', payload '{"state":"offline"}' warn 2023-11-10 21:32:48: Failed to ping 'Lampe salon' (attempt 1/1, Read 0x001788010b7fd3f7/11 genBasic(["zclVersion"], {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":true,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Timeout - 21815 - 11 - 63 - 0 - 1 after 10000ms))
So it took more than 8min to get the first ping attempt. Furthermore, the first MQTT publish with payload "state:offline" at 21:24:54 did not update the mqtt broker. The bulb stayed online (from the topic point of view) till the second MQTT publish at 21:25:58. So basically it took about 10min to see my bulb offline in HA. I could observe that behavior with availability topic updated only after the second publish each time I checked. So I'm not sure it's a feature or not. I thought about a network congestion, I don't know how many "ping" my setup can handle but it doesn't look very busy (few ping per min). Anyway I changed the active timeout to a less stressful value but did not see any improvement.
What did you expect to happen?
As per the documentation, I was expecting my bulb to get offline about 1 min after the power off
How to reproduce it (minimal and precise)
I can reproduce it with any active device or group of devices. Delay could vary before going offline but never observed under 7-8 min
Zigbee2MQTT version
1.33.2 commit: 9996c93
Adapter firmware version
6.10.3.0 build 297
Adapter
Sonoff ZBDongle-E (EFR32MG21)
Debug log
No response
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days