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.

1 Like

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!

5 Likes

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

Sorry, but I have since given up on the Aquara sensors. I just couldn’t manage to get them to work as reliable as they did a year ago when I got them. The ecolink zwave sensors I’m using now have been ‘set it and forget it’ even with battery usage. Plus, zigbee is now vulnerable to wardriving attacks anyways.

Hi @truglodite,
Can you please expand on your wardriving comment, especially why “now”?

Thanks!

Hi, I have the same issue after switching to ZHA from Z2M after changing my coordinator. Three sensors work just fine, one stopped working. I tried to repair it, reset the sensor and repair if afterwards.

Now after repairing, it shows as available and always closed, even when lying on my desk. After a while, it stops to become responsive to ZHA. I didnt test if it works with Z2M until now, will have to get a test setup for that.

1 Like

The sugestion above worked for me too.
After enabling joining I started to stress the sensor clicking in the button repeatedly and it worked… It’s alive!!!

Info MQTT publish: topic 'zigbee2mqtt/bridge/response/device/configure', payload '{"data":{"id":"DoorSensorWaterMeter"},"error":"Device 'DoorSensorWaterMeter' cannot be configured","status":"error","transaction":"cwga2-3"}'
Info MQTT publish: topic 'zigbee2mqtt/bridge/response/device/configure', payload '{"data":{"id":"DoorSensorWaterMeter"},"error":"Device 'DoorSensorWaterMeter' cannot be configured","status":"error","transaction":"cwga2-4"}'
Info MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"DoorSensorWaterMeter","ieee_address":"0x00158d0008102cca"},"type":"device_announce"}'
Info MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"announce","meta":{"friendly_name":"DoorSensorWaterMeter"},"type":"device_announced"}'
Info MQTT publish: topic 'zigbee2mqtt/DoorSensorWaterMeter', payload '{"battery":100,"contact":true,"linkquality":51,"voltage":3025}'
Info MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"DoorSensorWaterMeter","ieee_address":"0x00158d0008102cca"},"type":"device_announce"}'
Info MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"announce","meta":{"friendly_name":"DoorSensorWaterMeter"},"type":"device_announced"}'
Info MQTT publish: topic 'zigbee2mqtt/DoorSensorWaterMeter', payload '{"battery":100,"contact":true,"linkquality":48,"voltage":3025}'
Info MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"DoorSensorWaterMeter","ieee_address":"0x00158d0008102cca"},"type":"device_announce"}'
Info MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"announce","meta":{"friendly_name":"DoorSensorWaterMeter"},"type":"device_announced"}'
Info MQTT publish: topic 'zigbee2mqtt/DoorSensorWaterMeter', payload '{"battery":100,"contact":true,"linkquality":54,"voltage":3025}'
Info MQTT publish: topic 'zigbee2mqtt/DoorSensorWaterMeter', payload '{"battery":100,"contact":false,"linkquality":54,"voltage":3025}'
Info MQTT publish: topic 'zigbee2mqtt/DoorSensorWaterMeter', payload '{"battery":100,"contact":true,"linkquality":54,"voltage":3025}'
Info MQTT publish: topic 'zigbee2mqtt/DoorSensorWaterMeter', payload '{"battery":100,"contact":false,"linkquality":54,"voltage":3025}'

Thanks! :slight_smile:

Thanks, it worked!

Confirm that Coedy’s suggestion worked for me as well. Thanks!