You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After restarting zigbee2mqtt, some of my devices occasionally show as unavailable on Home Assistant. However, they are still sending Zigbee reports which are then also sent via MQTT, and they can still be controlled via zigbee2mqtt by sending commands via MQTT. It is a different set of devices every restart.
What did you expect to happen
These devices seem to be online to zigbee2mqtt, but is not considered online by Home Assistant due to the zigbee2mqtt/DEVICE/availability MQTT message being lost. This has been confirmed by sniffing MQTT traffic with MQTT Explorer.
How to reproduce it (minimal and precise)
Analysis of the logs identified that the MQTT availability messages for the affected devices were attempted to be sent before MQTT was connected. (see lines in the abridged log below marked >>, in this instance the online MQTT message is dropped Kitchen Floor Right and not resent after MQTT is connected, but the online message is sent for Kitchen Floor Left and all other devices).
2020-05-28 00:11:46: Starting zigbee2mqtt versio
n 1.13.1 (commit #3046680)
...
2020-05-28 00:11:48: Setup reporting for '0x0017880100dbd6aa' - 11 - genOnOff
2020-05-28 00:11:48: Setup reporting for '0x0017880100dfff5a' - 11 - genOnOff
>>2020-05-28 00:11:56: Received Zigbee message from 'Kitchen Floor Right', type 'attributeReport', cluster 'genLevelCtrl', data '{"currentLevel":32}' from endpoint 1 with groupID 0
>>2020-05-28 00:11:56: Not connected to MQTT server!
>>2020-05-28 00:11:56: Cannot send message: topic: 'zigbee/Kitchen Floor Right/availability', payload: 'online
...
2020-05-28 00:12:11: Connecting to MQTT server at mqtts://mqtt.xxx:8883
2020-05-28 00:12:11: Connected to MQTT server
...
2020-05-28 00:12:12: MQTT publish: topic 'zigbee/Hallway Ground/availability', payload 'online'
2020-05-28 00:12:12: MQTT publish: topic 'zigbee/Kitchen Floor Left/availability', payload 'online'
The availability messages (as well as resulting reporting messages) appear to be triggered by a Zigbee message being received by the controller before MQTT is connected. The logs show that availability messages for all devices are normally sent after MQTT is connected. When that happens, any devices for which availability messages have already been sent (but dropped because MQTT is not connected) are skipped, so they remain offline.
Suggested possible solutions to this issue:
cache the MQTT messages that are sent prior to MQTT connection (and whilst MQTT is otherwise disconnected), and resend them after (re-)connection, and/or:
resend availability for the device along with all other devices after MQTT is connected. The code seems to me to try to do this already, but the logs don't show that they are being sent.
Bug Report
What happened
After restarting zigbee2mqtt, some of my devices occasionally show as unavailable on Home Assistant. However, they are still sending Zigbee reports which are then also sent via MQTT, and they can still be controlled via zigbee2mqtt by sending commands via MQTT. It is a different set of devices every restart.
What did you expect to happen
These devices seem to be online to zigbee2mqtt, but is not considered
online
by Home Assistant due to thezigbee2mqtt/DEVICE/availability
MQTT message being lost. This has been confirmed by sniffing MQTT traffic with MQTT Explorer.How to reproduce it (minimal and precise)
Analysis of the logs identified that the MQTT availability messages for the affected devices were attempted to be sent before MQTT was connected. (see lines in the abridged log below marked
>>
, in this instance theonline
MQTT message is droppedKitchen Floor Right
and not resent after MQTT is connected, but theonline
message is sent forKitchen Floor Left
and all other devices).The availability messages (as well as resulting reporting messages) appear to be triggered by a Zigbee message being received by the controller before MQTT is connected. The logs show that availability messages for all devices are normally sent after MQTT is connected. When that happens, any devices for which availability messages have already been sent (but dropped because MQTT is not connected) are skipped, so they remain
offline
.Suggested possible solutions to this issue:
Debug Info
Zigbee2mqtt version: 1.13.1
Adapter hardware: CC2531
Adapter firmware version: 20190619
The text was updated successfully, but these errors were encountered: