Xiaomi Gateway 3. Sensors are always online

I have Xiaomi Gateway 3 and several sensors like “Xiaomi Aqara Body Sensor” or “Xiaomi Mi Smart Home Door / Window Sensors” which connected by it.

The trouble is that the sensors are always online, no matter what happend. For exampe, If I remove a battery from a sensor, ‘Home Asiistant’ and ‘MI Home’ don’t detect that the sensor has any troubles. Its available. The same is if I put the sensor in my pocket and go out from the ZigBee coverage area. It’s available.

How can I detect that device is offline? or make device offline? May be there is some heartbeat or some kind of ping I can use?
I need(have) to make that type of sensor offline in reasonable time (5 minutes maybe).

I use HA version 1.24.5 and HACS Integration: Xiaomi Gateway 3 version 2.1.0

The sensor became unavailable in Mi Home after 2 hours since I had replaced the battery. This’s improbably long.
HA still presumes that the sensor is availabe.

It became unavailable in HA 30 minutes later.

Is there any way to check device availability every 5 minutes (not 2 or more hours)?

When the device is considered unreachable is decided by the controller, in this case the Xiaomi Gateway. The reason you cannot do any better is the same reason the Xiaomi Gateway is not fast to consider it gone: the devices are battery operated and go to sleep when there is nothing to report. They do this in order to save battery.

So you cannot “ask” the sensor for its state either, it only responds when it is awake. Only if it hasn’t woken up for a long time to send a keepalive, the controller wil get suspicious.

Is there I can do to change this? May be install some firmware.

I’m still in search of a method of quickly detecting offline device.