Zigbee2MQTT detect disconnection of sensors

Hello

I am using some zigbee sensors from Xioami (Door/Window and Smoke Detector). The pairing was very easy. And everything works very well with Home Assistant.
To get a zigbee signal in all rooms, i have a router (works as a repeater for the signal).
Setup:
CC2531 as a cordinator plugged in the Raspberry Pi.
CC2531 as a router

There is only on thing:
Sometimes my wife plugs out the router. Then some sensors have no connection anymore. In Home Assistant I see nothing from the change/disconnection. The connectivity is still on the same good value like before with no change. The contact values do not display “unknown” just the last value.

Question:
This there a way to detect if the sensors are not connected anymore?

Thanks
Gilbert

As far as i know, device avaiabilty detection with zigbee2mqtt only works for AC powered devices like bulbs. There is the mqtt topic zigbee2mqtt/[FRIENLDY_NAME]/availability where you can read the status of devices.
I haven’t tested this though, but it makes sense because sending heartbeat or keepalive packets would drain the battery a lot more than just sending changes.

You could make a monitoring of the stick if someone unplugs it…
Or have also AC Devices in range of that router and make an automation that checks their avaiability and just assumes that everything else must also be offline.

Or tell your wife to stop touching your stick. I’m pretty sure she’ll just do exactly that. :wink:

You should see the router go to unavailable, then you can do something like this:

alias: 'Zigbee router offline'
trigger:
  - platform: state
    entity_id: binary_sensor.zigbee2mqtt_router_1
    to: 'off'
    for: '00:10:00'
  - platform: state
    entity_id: binary_sensor.zigbee2mqtt_router_1
    to: 'unavailable'
    for: '00:10:00'
...

Let me continue this thread…

I have zigbee2mqtt setup using zzh! as my adapter.
Because a particular sensor was located in another room - I also put IKEA repeater there.
To see a map of my devices I am using that nice zigbee networking component.

Now my issue was that I just found that zigbee map showed me one sensor being disconnected from the rest of the network BUT HA showed me that sensor as “connected”.

When I tried to open/close that window - HA did not react (which makes sense if the sensor is isolated).
Is there a way of how to track such situations?

Thank you.