Aqara Vibration Sensor and Cube - Angle Problem

Hi all, I’m running Home Assistant Supervised (latest).

I have been going in circles with the Aqara Vibration Sensors and Cube. When I configure the Aqara Vibration Sensor, I am unable to extract useful absolute angle data. I have tried two methods

  • If I use the HomeKit integration and the Aqara Hub, both the Aqara app and Home Assistant simply present a vibration binary sensor (detected / not detected) with no additional information.

  • If I use ZHA and an XBee S2C Pro as coordinator over USB with an XBee Explorer FTDI, then I am able to trap events for “vibration” and “tilt”, but the tilt event seems like it is unable to provide angle information (as in the number of degrees moved on the X,Y, and Z axes or the absolute angle), merely the total degrees in “args”. I was unable to find and decode the raw detailed payload in the logs at debug level to ascertain if the angle data was actually in the frame but not parsed. Sample of the parsed event below

{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "xxx",
        "unique_id": "xxx",
        "device_id": "xxx",
        "endpoint_id": 1,
        "cluster_id": 1280,
        "command": "Tilt",
        "args": [
            {
                "degrees": 6
            }
        ]
    },
    "origin": "LOCAL",
    "time_fired": "2021-08-28T22:43:49.661151+00:00",
    "context": {
        "id": "e6590ffa61a68d6d8a4033feb4ebc227",
        "parent_id": null,
        "user_id": null
    }
}
  • If I try to solve the same issue with the Aqara Cube, the adding of the cube to ZHA stalls on “Starting Interview”. I’ve tried the button press every couple of seconds to keep the device awake, but to no avail. The logs reveal “Device failed to initialize due to unexpected error. Received frame on uninitialized device”
2021-08-29 07:51:24 WARNING (MainThread) [zigpy.device] Device failed to initialize due to unexpected error
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/zigpy/device.py", line 149, in initialize
await self._initialize()
File "/usr/local/lib/python3.9/site-packages/zigpy/util.py", line 110, in retry
r = await func()
File "/usr/local/lib/python3.9/site-packages/zigpy/device.py", line 174, in _initialize
await self.get_node_descriptor()
File "/usr/local/lib/python3.9/site-packages/zigpy/device.py", line 133, in get_node_descriptor
status, _, node_desc = await self.zdo.Node_Desc_req(
File "/usr/local/lib/python3.9/site-packages/zigpy/util.py", line 110, in retry
r = await func()
File "/usr/local/lib/python3.9/site-packages/zigpy/device.py", line 265, in request
result, msg = await self._application.request(
File "/usr/local/lib/python3.9/site-packages/zigpy_xbee/zigbee/application.py", line 225, in request
if expect_reply and device.node_desc.is_end_device in (True, None):
AttributeError: 'NoneType' object has no attribute 'is_end_device'
2021-08-29 07:51:26 DEBUG (MainThread) [zigpy_xbee.uart] Frame received: b'\x91\x00\x15\x8d\x00\x06\xeb\x93\x8e\x92\xeb\x01\x01\x00\x00\x01\x04\x00\x18\x07\n\x05\x00B\x17lumi.sensor_cube.aqgl01'
2021-08-29 07:51:26 DEBUG (MainThread) [zigpy_xbee.api] Frame received: explicit_rx_indicator
2021-08-29 07:51:26 DEBUG (MainThread) [zigpy_xbee.api] _handle_explicit_rx: (xxxMACxxx, 0x92eb, 1, 0, 0, b'18070a050042176c756d692e73656e736f725f637562652e6171676c3031')
2021-08-29 07:51:26 DEBUG (MainThread) [zigpy.application] Received frame on uninitialized device <Device model=None manuf=None nwk=0x92EB ieee=xxxMACxxx is_initialized=False> from ep 1 to ep 1, cluster 0: b'\x18\x07\n\x05\x00B\x17lumi.sensor_cube.aqgl01'
2021-08-29 07:51:26 DEBUG (MainThread) [zigpy.device] [0x92eb] Received ZCL while uninitialized on endpoint id 1, cluster 0x0000 id, hdr: <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.Report_Attributes>, payload: b'\x05\x00B\x17lumi.sensor_cube.aqgl01'
2021-08-29 07:51:26 DEBUG (MainThread) [zigpy.device] [0x92eb] Uninitialized device command 'Command.Report_Attributes' args: [[Attribute(attrid=5, value=<TypeValue type=CharacterString, value=lumi.sensor_cube.aqgl01>)]]
2021-08-29 07:51:26 DEBUG (MainThread) [zigpy.device] [0x92eb] Scheduling initialization
2021-08-29 07:51:26 DEBUG (MainThread) [zigpy.util] Tries remaining: 3
2021-08-29 07:51:26 INFO (MainThread) [zigpy.device] [0x92eb] Requesting 'Node Descriptor'
2021-08-29 07:51:26 DEBUG (MainThread) [zigpy.util] Tries remaining: 2
2021-08-29 07:51:26 DEBUG (MainThread) [zigpy.device] [0x92eb] Extending timeout for 0x0c request
2021-08-29 07:51:26 DEBUG (MainThread) [zigpy_xbee.zigbee.application] Zigbee request tsn #12: b'0ceb92'

So does anyone have any idea what the cause might be or what I should do about it? Unfortunately the XBee S2C won’t run Xbee2MQTT from my own experiments and what I can see in the forums. The firmware on the sensors appears to be latest according to the Aqara app.

Before I run off trying to get Conbees and other devices shipped internationally, I was wondering if anyone had seen this before - in my mind it is fully possible that the sensors themselves are as different version than others have used and no new controller will extract more data from them, I just lack a way to validate that.

I think it’s missing in the quark used by zha. I had that angle thing working just fine when I used deConz for my interface. (this is using a Conbee II on both configurations)

Thanks @Dixey… Unfortunately fidgeting with the quirk a bit didn’t yield any outcome… the way the frame logs work its hard to use the XTCU decoder on them. I ordered a slaesh and am going to take a shot at Zigbee2MQTT. The mighty Xbee shall be downgraded to a router or spare parts thereafter.

What worked rather well was a Zigstar with Zigbee2MQTT. The other integrations don’t seem to expose the more granular and useful data - this is okay for many applications (like door open/close or temp), I’m sure. However, to measure the tilt of my louvre awning or chair with the Aqara vibration sensor and cube it appears the Zigstar + Z2MQTT is the most fine grained and reliable combination. That said, I ended up ordering that rather than the Slaesh for shipping convenience.