Aqara door/window sensor stops responding after a few seconds

I recently moved my raspbee II from the deConz integration to the ZHA integration and cannot get it to work properly. I did not have any issues like this in deConz.

Running Home Assistant Core 2021.12.5 on RPi 4b
Have updated all packages in venv to the latest release.
Have bluetooth disabled and raspbee II on ttyAMA0

When I add the raspbee II via ZHA it sets up the device however it gives the raspbee II an entity named “switch.dresden_elektronik_raspbee_ii_024e06ff_on_off” that I can toggle.
When I first add my aqara contact sensors they respond fine and quickly until I try to trigger them after they sit idle for around 30 seconds. After they sit the state changes do not register unless I toggle the random switch entity in the raspbee II device. Then the aqara sensor state changes register until they sit idle again.

This is the error logs I get upon first boot of Home Assistant. There are no errors that populate when the sensors stop responding or start responding again.

2021-12-24 03:51:59 DEBUG (MainThread) [zigpy_deconz.api] Command Command.aps_data_indication (1, 1)
2021-12-24 03:51:59 DEBUG (MainThread) [zigpy_deconz.api] APS data indication response: [28, <DeviceState.APSDE_DATA_REQUEST_SLOTS_AVAILABLE|2: 34>, <DeconzAddress address_mode=ADDRESS_MODE.NWK address=0x0000>, 1, <DeconzAddress address_mode=ADDRESS_MODE.NWK address=0x0000>, 1, 260, 6, b'\x18\x07\x0b\x00\x00', 0, 175, 221, 28, 182, 16, 0, 30]
2021-12-24 03:51:59 DEBUG (MainThread) [zigpy.zcl] [0x0000:1:0x0006] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=7 command_id=Command.Default_Response>
2021-12-24 03:51:59 DEBUG (MainThread) [zigpy.zcl] [0x0000:1:0x0006] ZCL request 0x000b: [0, <Status.SUCCESS: 0>]
2021-12-24 03:51:59 DEBUG (MainThread) [zigpy_deconz.api] 'aps_data_indication' response from <DeconzAddress address_mode=ADDRESS_MODE.NWK address=0x0000>, ep: 1, profile: 0x0104, cluster_id: 0x0006, data: b'18070b0000'
2021-12-24 03:51:59 DEBUG (MainThread) [zigpy_deconz.api] Command Command.aps_data_indication (1, 1)
2021-12-24 03:52:04 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x0000:1:0x0006]: failed to get attributes '['on_off']' on 'on_off' cluster:
2021-12-24 03:52:04 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0x0000:1:0x0006]: async_initialize: all attempts have failed: [TimeoutError(), TimeoutError(), TimeoutError(), TimeoutError()]

This is the logs when I enable and toggle the raspbee II switch entity.

2021-12-24 13:57:15 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=switch, service=turn_on, service_data=entity_id=switch.dresden_elektronik_raspbee_ii_024e06ff_on_off>
2021-12-24 13:57:15 DEBUG (MainThread) [zigpy_deconz.zigbee.application] Sending Zigbee request with tsn 17 under 18 request id, data: b'011101'
2021-12-24 13:57:15 DEBUG (MainThread) [zigpy_deconz.api] Command Command.aps_data_request (18, 18, 0, <DeconzAddressEndpoint address_mode=2 address=0x0000 endpoint=1>, 260, 6, 1, b'\x01\x11\x01', 2, 0)
2021-12-24 13:57:15 DEBUG (MainThread) [zigpy_deconz.api] APS data request response: [2, <DeviceState.APSDE_DATA_REQUEST_SLOTS_AVAILABLE|2: 34>, 18]
2021-12-24 13:57:15 DEBUG (MainThread) [zigpy_deconz.api] Device state changed response: [<DeviceState.128|APSDE_DATA_REQUEST_SLOTS_AVAILABLE|APSDE_DATA_INDICATION|APSDE_DATA_CONFIRM|2: 174>, 0]
2021-12-24 13:57:15 DEBUG (MainThread) [zigpy_deconz.api] Command Command.aps_data_indication (1, 1)
2021-12-24 13:57:15 DEBUG (MainThread) [zigpy_deconz.api] APS data indication response: [26, <DeviceState.APSDE_DATA_REQUEST_SLOTS_AVAILABLE|APSDE_DATA_CONFIRM|2: 38>, <DeconzAddress address_mode=ADDRESS_MODE.NWK address=0x0000>, 1, <DeconzAddress address_mode=ADDRESS_MODE.NWK address=0x0000>, 1, 260, 6, b'\x01\x11\x01', 0, 175, 221, 233, 0, 17, 0, 30]
2021-12-24 13:57:15 DEBUG (MainThread) [zigpy.zcl] [0x0000:1:0x0006] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=17 command_id=1>
2021-12-24 13:57:15 DEBUG (MainThread) [zigpy.zcl] [0x0000:1:0x0006] ZCL request 0x0001: []
2021-12-24 13:57:15 DEBUG (MainThread) [zigpy.zcl] [0x0000:1:0x0006] No handler for cluster command 1
2021-12-24 13:57:15 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x0000:1:0x0006]: received 'on' command with [] args on cluster_id '6' tsn '17'
2021-12-24 13:57:15 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=switch.dresden_elektronik_raspbee_ii_024e06ff_on_off, old_state=<state switch.dresden_elektronik_raspbee_ii_024e06ff_on_off=off; friendly_name=dresden elektronik RaspBee II 024e06ff on_off @ 2021-12-24T13:57:10.356884-07:00>, new_state=<state switch.dresden_elektronik_raspbee_ii_024e06ff_on_off=on; friendly_name=dresden elektronik RaspBee II 024e06ff on_off @ 2021-12-24T13:57:15.353993-07:00>>
2021-12-24 13:57:15 DEBUG (MainThread) [zigpy_deconz.api] 'aps_data_indication' response from <DeconzAddress address_mode=ADDRESS_MODE.NWK address=0x0000>, ep: 1, profile: 0x0104, cluster_id: 0x0006, data: b'011101'
2021-12-24 13:57:15 DEBUG (MainThread) [zigpy_deconz.api] Command Command.aps_data_confirm (0,)
2021-12-24 13:57:15 DEBUG (MainThread) [zigpy_deconz.api] APS data confirm response for request with id 18: 00
2021-12-24 13:57:15 DEBUG (MainThread) [zigpy_deconz.api] Request id: 0x12 'aps_data_confirm' for <DeconzAddressEndpoint address_mode=ADDRESS_MODE.NWK address=0x0000 endpoint=1>, status: 0x00
2021-12-24 13:57:15 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x0000:1:0x0006]: command failed: 'off' args: '()' kwargs '{}' exception: ''
2021-12-24 13:57:20 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x0000:1:0x0006]: command failed: 'on' args: '()' kwargs '{}' exception: ''
1 Like

Hi, not a lot of responses… as you mention, it should not show up as a switch.

I do not know why, can only say i have a similar setup, and it works fine.

Have you tried to move the conbee to another USB port? And reboots between all changes. And made sure all deconz is deleted, both integration and supervisor part

Hey, thanks for the response!
I started this with a completely fresh install of Raspbian bullseye, fresh install of HA core and a reset Raspbee II.
I did install the RTC for the Raspbee I don’t know if that is the issue, however I did not have the deCONZ supervisor or integration installed. Also lots of full restarts of the raspberry pi.
Since it is a Raspbee it is installed on the GPIO pins so I can’t try a USB port.
I have since moved back to the deCONZ supervisor and integration and as expected it is working perfectly with no dropouts.
If you have any ideas let me know because I’m at a loss.

Looking more into this ZHA is unable to read the “0000” attribute in the “0006” cluster or the “On/Off” attribute in the “On/Off” cluster as stated in the logs. I’m wondering if this is causing ZHA to lock up and stop communications.
I am also unable to read the same attribute from the RaspBee in deCONZ however I’m thinking deCONZ might be able to handle the errors better.
I don’t know how to fix that issue as I’ve tried multiple different firmware versions on the RaspBee from the oldest available to the newest and everything in between.
Could it be an issue with Raspbian Bullseye?