ZHA events showing in logbook but not triggering automation

I’m looking for a bit of help understanding ZHA.

I’m running on a Raspberry Pi3 with a Sonoff Zigbee 3.0 USB Dongle Plus plugged in.

I have two generations of Phillips Hue wall switches - 2016 and 2021.

If I create an automation the 2021 switch works exactly as expected, but the 2016 one doesn’t.

However, both switches fire events I can see in the logbook.

The 2021 switch shows this when I press the “on” button:

Philips 2021 Remote Button Short Press - Turn On event was fired

The 2016 shows this:

Philips 2016 On event was fired

I understand these events are labelled differently, which I presume is why the automation isn’t working with the older switch - it’s looking for different labels.

Within ZHA I see there’s an attribute called “quirk” which I presume is something that HomeAssistant somewhere along the line can use to determine the expected labels.

The 2021 switch has a quirk of “zhaquirks.philips.rwl022.PhilipsRWL022” whereas the 2016 one has a quirk of “zhaquirks.philips.rwlfirstgen.PhilipsRWLFirstGen”.

My question is:

How do I modify this device accordingly so that the 2016 switch triggers automations? The “device” being seen by HomeAssistant is evidently unaware of the difference between the switches…

… is the issue with HomeAssistant itself, the ZHA Integration, or my understanding of how to target it?

I’m pretty technically capable; just not sure where I’m meant to be looking…

Please post the automation in a code block and what logs you see. It’s very difficult to determine what’s wrong with automations in some cases in best circumstances. It’s impossible without logs and the code. :sunglasses: (seeing the automation and its trigger will help id what’s different)

Great - thanks! Sorry, first post :see_no_evil:

Here’s the automation example:

alias: Zigbee on
description: ""
trigger:
  - device_id: 24d408b1b330890b9ff9423869faea6c
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: turn_on
  - device_id: 680df717b56eabc55985b83c72246f42
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: turn_on
condition: []
action:
  - type: turn_on
    device_id: 5f7c66467e3132d1ccab4b54ddd44c0b
    entity_id: switch.sonoff_10011ab5fb
    domain: switch
mode: single

Device 24d408b1b330890b9ff9423869faea6c is working as a trigger, device 680df717b56eabc55985b83c72246f42 isn’t…

In the logbook I’m seeing this:

Philips PhilipsRWLFirstGen Bedroom On event was fired
12:44:28 - Now
Zigbee on  triggered by event 'zha_event'
12:44:28 - Now
Philips RWL022 Hallway Remote Button Short Press - Turn On event was fired
12:44:28 - Now

So, one of the remotes is triggering the automation, the other isn’t…

Very happy to share other logs if you can guide me to what I need to post?

Thanks!!!

Within ZHA this is the zigbee info for the device that is working:

IEEE: 00:17:88:01:09:a5:be:40
Nwk: 0x1b13
Device Type: EndDevice
LQI: 111
RSSI: Unknown
Last Seen: 2022-09-07T12:44:28
Power Source: Battery or Unknown
Quirk: zhaquirks.philips.rwl022.PhilipsRWL022

And this is the Zigbee Info for the device that isn’t:

IEEE: 00:17:88:01:08:f0:a5:9d
Nwk: 0x469a
Device Type: EndDevice
LQI: 105
RSSI: Unknown
Last Seen: 2022-09-07T12:44:28
Power Source: Battery or Unknown
Quirk: zhaquirks.philips.rwlfirstgen.PhilipsRWLFirstGen

Both are appearing in the logbook when I press the on button. The working one shows:

Philips RWL022 Hallway Remote Button Short Press - Turn On event was fired

The one not working shows:

Philips PhilipsRWLFirstGen Bedroom On event was fired

Ooo - this probably helps. I’ve listened to the zha_events and they are:

The one that DOESN’T fire the automation I expect it to:

event_type: zha_event
data:
  device_ieee: 00:17:88:01:08:f0:a5:9d
  unique_id: 00:17:88:01:08:f0:a5:9d:1:0x0006
  device_id: 680df717b56eabc55985b83c72246f42
  endpoint_id: 1
  cluster_id: 6
  command: "on"
  args: []
  params: {}
origin: LOCAL
time_fired: "2022-09-07T11:55:34.080522+00:00"
context:
  id: 01GCBWWDT092BQVB8Z6RBCZNA9
  parent_id: null
  user_id: null

And the remote that DOES fire the automation as expected looks very different:

event_type: zha_event
data:
  device_ieee: 00:17:88:01:09:a5:be:40
  unique_id: 00:17:88:01:09:a5:be:40:1:0xfc00
  device_id: 24d408b1b330890b9ff9423869faea6c
  endpoint_id: 1
  cluster_id: 64512
  command: on_press
  args:
    button: "on"
    press_type: press
    command_id: 0
    args:
      - 1
      - 3145728
      - 0
      - 33
      - 0
      - 0
  params: {}
origin: LOCAL
time_fired: "2022-09-07T11:54:49.073595+00:00"
context:
  id: 01GCBWV1VHHF48AYR2RBNRMMHD
  parent_id: null
  user_id: null

Answered my own question, I see now I can trigger it with the event_data by specifying the device_ieee, endpoint_id and command :+1: Don’t really understand why the previous device based trigger doesn’t work, but glad I now see how to go from the device listening data to a trigger :slight_smile:

alias: Zigbee on
description: ""
trigger:
  - platform: event
    event_data:
      device_ieee: 00:17:88:01:08:f0:a5:9d
      endpoint_id: 1
      command: "on"
    event_type: zha_event
condition: []
action:
  - type: turn_on
    device_id: 5f7c66467e3132d1ccab4b54ddd44c0b
    entity_id: switch.sonoff_10011ab5fb
    domain: switch
mode: single
2 Likes