kardia-as / zigpy-zboss

GNU General Public License v3.0
36 stars 4 forks source link

Aqara Smart Vibration Sensor leaves network immediately on pairing #39

Open codyc1515 opened 5 months ago

codyc1515 commented 5 months ago

The Aqara Smart Vibration Sensor leaves the network immediately after pairing (showing as Unavailable in HA). Does not come back when pressing the identify button on the device and requires re-pairing.

2024-02-17 20:43:22.054 DEBUG (MainThread) [zigpy.application] Feeding watchdog
2024-02-17 20:43:25.523 INFO (MainThread) [zigpy.application] Device 0x5d9a (00:15:8d:00:01:0f:cb:b9) joined the network
2024-02-17 20:43:25.525 DEBUG (MainThread) [zigpy.application] Device 00:15:8d:00:01:0f:cb:b9 changed id (0xb2fe => 0x5d9a)
2024-02-17 20:43:25.527 DEBUG (MainThread) [zigpy.device] [0x5d9a] Skipping initialization, device is fully initialized
2024-02-17 20:43:25.528 DEBUG (MainThread) [zigpy.application] Device is initialized <VibrationAQ1 model='lumi.vibration.aq1' manuf='LUMI' nwk=0x5D9A ieee=00:15:8d:00:01:0f:cb:b9 is_initialized=True>
2024-02-17 20:43:25.576 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(timestamp=datetime.datetime(2024, 2, 17, 7, 43, 25, 576547, tzinfo=datetime.timezone.utc), src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x5D9A), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=0, profile_id=260, cluster_id=0, data=Serialized[b'\x18\x00\n\x05\x00B\x12lumi.vibration.aq1\x01\x00 \x08'], tx_options=<TransmitOptions.NONE: 0>, radius=0, non_member_radius=0, lqi=192, rssi=-44)
2024-02-17 20:43:25.581 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0000] Received ZCL frame: b'\x18\x00\n\x05\x00B\x12lumi.vibration.aq1\x01\x00 \x08'
2024-02-17 20:43:25.583 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0000] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl<0x18>(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, direction=<Direction.Server_to_Client: 1>, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=0, command_id=10, *direction=<Direction.Server_to_Client: 1>)
2024-02-17 20:43:25.588 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0000] Decoded ZCL frame: VibrationBasicCluster:Report_Attributes(attribute_reports=[Attribute(attrid=0x0005, value=TypeValue(type=CharacterString, value='lumi.vibration.aq1')), Attribute(attrid=0x0001, value=TypeValue(type=uint8_t, value=8))])
2024-02-17 20:43:25.591 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0000] Received command 0x0A (TSN 0): Report_Attributes(attribute_reports=[Attribute(attrid=0x0005, value=TypeValue(type=CharacterString, value='lumi.vibration.aq1')), Attribute(attrid=0x0001, value=TypeValue(type=uint8_t, value=8))])
2024-02-17 20:43:25.593 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0000] Attribute report received: model='lumi.vibration.aq1', app_version=8
2024-02-17 20:43:26.791 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(timestamp=datetime.datetime(2024, 2, 17, 7, 43, 26, 790875, tzinfo=datetime.timezone.utc), src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x5D9A), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=95, profile_id=260, cluster_id=0, data=Serialized[b'\x1c_\x11\x01\n\x01\xffB.\x01!O\x0b\x03(\x1f\x04!\xa8\x01\x05!Z\x00\x06$\x01\x00\x00\x00\x00\x08!\x08\x03\n!\x00\x00\x98!(\x00\x99!\x00\x00\x9a%\x12\x00=\xfc\xb1\x01'], tx_options=<TransmitOptions.NONE: 0>, radius=0, non_member_radius=0, lqi=156, rssi=-55)
2024-02-17 20:43:26.796 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0000] Received ZCL frame: b'\x1c_\x11\x01\n\x01\xffA.\x01!O\x0b\x03(\x1f\x04!\xa8\x01\x05!Z\x00\x06$\x01\x00\x00\x00\x00\x08!\x08\x03\n!\x00\x00\x98!(\x00\x99!\x00\x00\x9a%\x12\x00=\xfc\xb1\x01'
2024-02-17 20:43:26.799 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0000] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl<0x1C>(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=True, direction=<Direction.Server_to_Client: 1>, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), manufacturer=4447, tsn=1, command_id=10, *direction=<Direction.Server_to_Client: 1>)
2024-02-17 20:43:26.803 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0000] Decoded ZCL frame: VibrationBasicCluster:Report_Attributes(attribute_reports=[Attribute(attrid=0xFF01, value=TypeValue(type=LVBytes, value=b'\x01!O\x0b\x03(\x1f\x04!\xa8\x01\x05!Z\x00\x06$\x01\x00\x00\x00\x00\x08!\x08\x03\n!\x00\x00\x98!(\x00\x99!\x00\x00\x9a%\x12\x00=\xfc\xb1\x01'))])
2024-02-17 20:43:26.805 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0000] Received command 0x0A (TSN 1): Report_Attributes(attribute_reports=[Attribute(attrid=0xFF01, value=TypeValue(type=LVBytes, value=b'\x01!O\x0b\x03(\x1f\x04!\xa8\x01\x05!Z\x00\x06$\x01\x00\x00\x00\x00\x08!\x08\x03\n!\x00\x00\x98!(\x00\x99!\x00\x00\x9a%\x12\x00=\xfc\xb1\x01'))])
2024-02-17 20:43:26.807 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0000] Attribute report received: 0xFF01=b'\x01!O\x0b\x03(\x1f\x04!\xa8\x01\x05!Z\x00\x06$\x01\x00\x00\x00\x00\x08!\x08\x03\n!\x00\x00\x98!(\x00\x99!\x00\x00\x9a%\x12\x00=\xfc\xb1\x01'
2024-02-17 20:43:28.950 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(timestamp=datetime.datetime(2024, 2, 17, 7, 43, 28, 950729, tzinfo=datetime.timezone.utc), src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x5D9A), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=2, profile_id=260, cluster_id=257, data=Serialized[b'\x18\x02\nU\x00!\x01\x00'], tx_options=<TransmitOptions.NONE: 0>, radius=0, non_member_radius=0, lqi=136, rssi=-59)
2024-02-17 20:43:28.954 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0101] Received ZCL frame: b'\x18\x02\nU\x00!\x01\x00'
2024-02-17 20:43:28.956 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0101] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl<0x18>(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, direction=<Direction.Server_to_Client: 1>, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=2, command_id=10, *direction=<Direction.Server_to_Client: 1>)
2024-02-17 20:43:28.962 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0101] Decoded ZCL frame: MultistateInputCluster:Report_Attributes(attribute_reports=[Attribute(attrid=0x0055, value=TypeValue(type=uint16_t, value=1))])
2024-02-17 20:43:28.964 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0101] Received command 0x0A (TSN 2): Report_Attributes(attribute_reports=[Attribute(attrid=0x0055, value=TypeValue(type=uint16_t, value=1))])
2024-02-17 20:43:28.966 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0101] Attribute report received: present_value=1
2024-02-17 20:43:28.968 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0500] 00:15:8d:00:01:0f:cb:b9 - Received motion event message
2024-02-17 20:43:30.032 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(timestamp=datetime.datetime(2024, 2, 17, 7, 43, 30, 31991, tzinfo=datetime.timezone.utc), src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x5D9A), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=3, profile_id=260, cluster_id=257, data=Serialized[b'\x18\x03\nU\x00!\x02\x00\x03\x05!A\x00'], tx_options=<TransmitOptions.NONE: 0>, radius=0, non_member_radius=0, lqi=184, rssi=-47)
2024-02-17 20:43:30.035 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0101] Received ZCL frame: b'\x18\x03\nU\x00!\x02\x00\x03\x05!A\x00'
2024-02-17 20:43:30.037 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0101] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl<0x18>(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, direction=<Direction.Server_to_Client: 1>, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=3, command_id=10, *direction=<Direction.Server_to_Client: 1>)
2024-02-17 20:43:30.043 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0101] Decoded ZCL frame: MultistateInputCluster:Report_Attributes(attribute_reports=[Attribute(attrid=0x0055, value=TypeValue(type=uint16_t, value=2)), Attribute(attrid=0x0503, value=TypeValue(type=uint16_t, value=65))])
2024-02-17 20:43:30.046 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0101] Received command 0x0A (TSN 3): Report_Attributes(attribute_reports=[Attribute(attrid=0x0055, value=TypeValue(type=uint16_t, value=2)), Attribute(attrid=0x0503, value=TypeValue(type=uint16_t, value=65))])
2024-02-17 20:43:30.049 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0101] Attribute report received: present_value=2, 0x0503=65
2024-02-17 20:43:30.072 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(timestamp=datetime.datetime(2024, 2, 17, 7, 43, 30, 72880, tzinfo=datetime.timezone.utc), src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x5D9A), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=4, profile_id=260, cluster_id=257, data=Serialized[b'\x18\x04\n\x08\x05%\t\x00\xeb\xff\xb2\x04'], tx_options=<TransmitOptions.NONE: 0>, radius=0, non_member_radius=0, lqi=184, rssi=-47)
2024-02-17 20:43:30.076 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0101] Received ZCL frame: b'\x18\x04\n\x08\x05%\t\x00\xeb\xff\xb2\x04'
2024-02-17 20:43:30.078 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0101] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl<0x18>(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, direction=<Direction.Server_to_Client: 1>, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=4, command_id=10, *direction=<Direction.Server_to_Client: 1>)
2024-02-17 20:43:30.088 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0101] Decoded ZCL frame: MultistateInputCluster:Report_Attributes(attribute_reports=[Attribute(attrid=0x0508, value=TypeValue(type=uint48_t, value=5166844280841))])
2024-02-17 20:43:30.090 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0101] Received command 0x0A (TSN 4): Report_Attributes(attribute_reports=[Attribute(attrid=0x0508, value=TypeValue(type=uint48_t, value=5166844280841))])
2024-02-17 20:43:30.092 DEBUG (MainThread) [zigpy.zcl] [0x5D9A:1:0x0101] Attribute report received: 0x0508=5166844280841
2024-02-17 20:43:47.971 INFO (MainThread) [zigpy.application] Device 0x5d9a (00:15:8d:00:01:0f:cb:b9) left the network
2024-02-17 20:43:52.056 DEBUG (MainThread) [zigpy.application] Feeding watchdog
codyc1515 commented 5 months ago

Device seems to have remained on the network around 10 minutes now.

EDIT: Nope, the device is unresponsive (despite showing as Clear).

Hedda commented 5 months ago

What exact Zigbee Coordinator adapter and what firmware build / firmware version? Is the device connected via a other Zigbee Router or directly to the Zigbee Coordinator and if so which exact one? And are you following best practices to avoid EMF/EMI/RMI interference?

Is that an issue that can only be seen with zigpy-zboss radios or can it also be replicated with either the bellows or the zigpy-znp radio libraries using Silicon Labs EmberZNet NCP and Texas Instruments Z-Stack ZNP respective Zigbee Coordinator radio adapters? If it can also be replicated with other radio types then this should instead be reported as new issues to the GitHub repository for the main zigpy library -> https://github.com/zigpy/zigpy or to the ZHA Device Handlers (also known as zha-quirks) repository on GitHub -> https://github.com/zigpy/zha-device-handlers

Note! Aqara devices are a really bad use case for testing this early in development because you need to be aware that many Zigbee devices from Aqara (and Xiaomi) infamous for issues with both pairing/joining and having intermittent connection problems regardless if you which Zigbee gateway solution you use, and especially if those devices are connecting/connected via Zigbee Router devices that they too are known to have issues specifically with Aqara and Xiaomi devices, see -> https://community.hubitat.com/t/xiaomi-aqara-devices-pairing-keeping-them-connected/623 (which also applies here)

The fact is that Aqara and Xiaomi (plus also Tuya) are infamously known in the Zigbee community for not exactly following the official Zigbee specifications, and that makes them unpredictable to say the least. I therefore suggest simply staying away from them those devices this early in the development of this new radio library, or else the developers will end up having to focus on implementing special hacks around Aqara and Xiaomi instead of just focusing on getting this library fully compatible with the main zigpy library.

As such I recommend that you do not test Aqara, Xiaomi, or Tuya devices with this new radio library at this point. If you want to use those devices then better keep them on a separate Zigbee network that uses the bellows or zigpy-znp radio libraries.

PS: Anyway, best practices to avoid EMF/EMI/RMI interference always need to be followed, meaning using the radio dongle with a longer USB extension cable to a USB 2.0 port or via a powered USB 2.0 hub, see -> https://community.home-assistant.io/t/zigbee-networks-how-to-guide-for-avoiding-interference-and-optimize-for-getting-better-range-coverage/515752