Xiaomi Aqara Door/Window Sensor no longer working

I am not sure what caused it, but the past 3 days I have had issues with a single aqara door/window magnet sensor not working. The binary shows as closed always even when moving a magnet around it, and battery is always unavailable. I replaced the battery to no avail. I tried resetting the device and repairing it… same thing. These logs seem to be related:

2020-08-08 13:43:03 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2871222960] Error handling message: Unknown error
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 21, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/zha/api.py", line 613, in websocket_read_zigbee_cluster_attributes
    success, failure = await cluster.read_attributes(
  File "/usr/local/lib/python3.8/site-packages/zigpy/zcl/__init__.py", line 269, in read_attributes
    result = await self.read_attributes_raw(to_read, manufacturer=manufacturer)
  File "/usr/local/lib/python3.8/site-packages/zigpy/device.py", line 203, in request
    raise zigpy.exceptions.DeliveryError(
zigpy.exceptions.DeliveryError: [0x3864:1:0x0003]: Message send failure

Anyone else having issues with ziaomi stuff recently? Is there something I possibly did to break it, or something I should do to try fixing it? The only related thing I can think of is I recently had to replace a battery on a nearby samsung multisensor… other than that haven’t really touched anything zha related in months. FWIW, I’m on the latest hassos+ha releases.

I dug up what looks like related info here:

Same “battery unavailable” symptom, but my binary is also always showing ‘closed’, and doesn’t seem to respond when moving the magnet around it. Also interesting, is my zigbee device signature has the same info as @Itsiq posted in the last post of the above thread. Looks like there may be some new aqara devices with different signatures that need to be sorted?

Glad I found this. I just tried setting up my sensor after having to step away from HA for a while and can’t for the life of me get my door/window sensor connected.

Everything else joined up fine.

I can’t find any sure causes for this. The current quirk for this device doesn’t look like it has been changed in 6 months:

The HA integration shows this is the quirk being used currently (magnet_aq2.py ). I’m not familiar with how the quirks work, but my sensor was working fine until recently… definitely was working with that code when that was merged 6 months ago. Only other bit of info I can provide is that I did have to change the battery on a nearby samsung multi sensor (nearby the door/window sensor, so not sure if that could have buggered meshing). I would think if that caused this problem, then removing and repairing the door window sensor would have worked… of course it didn’t work, even when I moved it near my zigbee controller stick.

So for now I can’t find any info on how to fix this. On the up side, ever since the papers on zigbee wardriving/remote hacking were released to the public, I’ve been looking to replace the last few zigbee devices I have with zwave anyways. This issue provides me with a great excuse to upgrade… however I am still interested in seeing this fixed eventually… vs just tossing the zb sensors in the bin.

Update… now the darn trouble child randomly decides to work. :crazy_face:

…but only after first pairing it (which fails), then hitting “Reconfigure Device” in the zha integration, then tapping the button the the aqara mag device right away. It took a few tries for this to work, then the battery went back to unavailable after renaming the device. I had to reconfigure again to get the battery available… now the binary is working and battery is showing 100% like before.

So this problem may be user error, or it may be some edge case bug in the code. Either way, if your xiaomi door/window magnet sensors go dark on you, doing this ‘reconfigure’ dance might get them working again.

I got mine working this morning by trying a pattern suggested on a GitHub page:
Search for device,
Press and hold the button on the device for 3 seconds,
Release,
Single press it every 5 seconds to keep it awake/in pairing mode.

Takes around 30/40seconds to get picked up while doing this and I managed to do 5 of them back to back successfully!

1 Like

Hi, any news regarding the door/windows sensor?
I tried the latest suggestion multiple times but nothing works…
Please help me, the Aqara sensor shows up as closed all the time.

// Fredrik