Add ZHA sensor support for Three Axis

When using Samsung Multipurpose Sensors (CentraLite 3321-S) with the Smartthings integration, the devices appear with entities for X, Y, and Z coordinates, but when I pair these sensors directly with ZHA, those coordinate entities don’t show up.

If I click “Manage Clusters” on the device, there’s a cluster called CentraLiteAccelCluster with these attributes:

acceleration (id: 0x0010)
motion_threshold (id: 0x0002)
motion_threshold_multiplier (id: 0x0000)
x_axis (id: 0x0012)
y_axis (id: 0x0013)
z_axis (id: 0x0014)

When I listen to ‘zha_event’ on the Developer Tools page, I see axis events firing when I tilt and move the sensor around.

Event 38 fired 9:39 AM:
{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "00:0d:6f:00:0e:35:89:f9",
        "unique_id": "00:0d:6f:00:0e:35:89:f9:1:0xfc02",
        "device_id": "8fcebf983eb17a9688d137ddc896fa97",
        "endpoint_id": 1,
        "cluster_id": 64514,
        "command": "attribute_updated",
        "args": {
            "attribute_id": 20,
            "attribute_name": "z_axis",
            "value": -1013
        }
    },
    "origin": "LOCAL",
    "time_fired": "2021-01-22T15:39:37.964365+00:00",
    "context": {
        "id": "4159bd838d262ad76c17b5377c2a0b4a",
        "parent_id": null,
        "user_id": null
    }
}
Event 37 fired 9:39 AM:
{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "00:0d:6f:00:0e:35:89:f9",
        "unique_id": "00:0d:6f:00:0e:35:89:f9:1:0xfc02",
        "device_id": "8fcebf983eb17a9688d137ddc896fa97",
        "endpoint_id": 1,
        "cluster_id": 64514,
        "command": "attribute_updated",
        "args": {
            "attribute_id": 19,
            "attribute_name": "y_axis",
            "value": -2
        }
    },
    "origin": "LOCAL",
    "time_fired": "2021-01-22T15:39:37.963979+00:00",
    "context": {
        "id": "f5bec08670147a6beac0d35c27270d76",
        "parent_id": null,
        "user_id": null
    }
}
Event 36 fired 9:39 AM:
{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "00:0d:6f:00:0e:35:89:f9",
        "unique_id": "00:0d:6f:00:0e:35:89:f9:1:0xfc02",
        "device_id": "8fcebf983eb17a9688d137ddc896fa97",
        "endpoint_id": 1,
        "cluster_id": 64514,
        "command": "attribute_updated",
        "args": {
            "attribute_id": 18,
            "attribute_name": "x_axis",
            "value": -24
        }
    },
    "origin": "LOCAL",
    "time_fired": "2021-01-22T15:39:37.963514+00:00",
    "context": {
        "id": "291d38c888d11b1e9d80cf46a59a1358",
        "parent_id": null,
        "user_id": null
    }
}

I found a related issue on github where this functionality was added to the Smartthings Integration:
Add SmartThings sensor support for Three Axis #21841

I also found a related issue where acceleration was added to the ZHA integration for this device, but only as a binary sensor for movement. The three-axis attributes were not included.
Add SmartThingsAccelCluster to ZHA binary_sensor #21609

I found several other discussions about this in other subforums and on reddit. (The forum won’t let me post more than two links).

  • SmartThings Multipurpose Sensor (2018) with HUSBZB-1
  • ZIGBEE (ZHA): Get a Cluster Attribute that isn’t normally tracked
  • Centralite 3321S - SmartThings Multipurpose Sensor

I’d love to help build this, but I’m still really new to Home Assistant and don’t have the skills yet.

I would so love to see this feature added. I’m just switching everything over from Smartthings to Home Assistant. I had one of these multipurpose sensors tucked into my doorbell box and it triggered beautifully whenever the doorbell rang. Unfortunately, without the xyz entries, acceleration doesn’t show up in Home Assistant and I can’t use it like that anymore.

Can we make this happen?

1 Like

Another bump for this. I’ve seen it mentioned in multiple places over the past 2+ years. Has it been abandoned?

1 Like

Giving this a bump. Seems odd that HA would not expose this information. I would think it’s relatively common to use 3 axis sensors as garage door sensors. Even SmartThings allows configuring a contact sensor to act this way.

For future readers, I managed to make one work using this trigger based template sensor…I literally just got it working a few minutes ago so it hasn’t really been tested, but it does appear to be working.

template:
  - trigger:
    - platform: event
      event_type: zha_event
      event_data:
        device_ieee: 00:11:22:33:44:55:66:77 # Garage door sensor
        command: attribute_updated
        args:
          attribute_name: y_axis
    binary_sensor:
      - name: garage_door
        device_class: garage_door
        state: >
          {{
            trigger.event.data.args.value | int > -950
          }}

I’ll likely need to fine tune that -950 value to avoid false positives. For my particular sensor, it seems to have a value of around -1020 to -980 when it is completely vertical, and around -820 when leaning about 45 degrees forward.

I’m going to place the sensor on the highest panel on the garage door so that it is most sensitive to the garage door being open.

The only downside I’m noticing while testing it manually is that because the axis attributes are not triggering the ZHA integration to update (I assume) the attribute values, that if the sensor moves too smoothly, it does not cause the acceleration to trigger and therefore does not trigger an event.

I assume that won’t be an issue on a garage door, but we’ll find out.

2 Likes

Since my original post, I ended up switching from ZHA to Zigbee2MQTT. My Centralite 3321 sensor exposed the 3-axis motion sensors out of the box without any fiddling around.


I really really wanted to stick with ZHA because it’s native to HA, but after experimenting, I’ve noticed:

  1. Many of my devices are better supported in Z2M and showing new functionality that was missing in ZHA.
  2. Documentation is much better for individual devices.
  3. It’s MUCH easier to add support for new devices without being a developer, which I’ve done a few times now.

I realize this probably isn’t helpful to people using ZHA, but I wanted to share my experience.

1 Like