Xiaomi Aqara Wall Switch automation triggered by events with "single" click_type

Hi,

Long time lurker, first time poster.
I have a weird issue after adding my Xiaomi Aqara wall switch (single switch) and using it to toggle two lights in my living room.
It seems that any event_type: click with click_type: single will trigger the automation with the above switch.
Here’s the code:

- alias: "Stue_veggbryter"
  trigger:
    - platform: event
      event_type: click
      event_data:
        event_id: binary_sensor.wall_switch_158d00017101a2
        click_type: single
  action:
    - service: homeassistant.toggle
      entity_id: group.stuelys

I have a couple of round xiaomi switches, and triggering “single” click with any of these also toggles my living room lights, even my xiaomi switch acting as a doorbell (which isn’t even touched in HASS).
Anyone seen similar issues, or see something weird with my above automation? I have tried re-writing the automation many times w/o any luck. The log looks correct, meaning that the xiaomi gateway sends the correct event to HASS.

HASS: 0.59 (w/ debug enabled on xiaomi components)
Xiaomi GW firmware: Latest (released last month)

edit: Yeah… I screwed up the config file…
This was embarrassing. I even injected extra debugging into the binary-switch .py files before noticing I’ve written the routine incorrectly.
Changed:

event_id: binary_sensor.wall_switch_158d00017101a2

To the correct formatting:

entity_id: binary_sensor.wall_switch_158d00017101a2

Now all is nice and dandy.
Thanks for this sweet piece of software, devs!

Cheers,
Håkon

2 Likes

Thanks for sharing your “failure”. It took me reading the code 10 times to find your error in the formatting. NASTY !
They look so similar, it’s easily overlooked.

1 Like

Thanks for sharing this! I had the exact same error. Copy pasted the code from somewhere, I guess that’s what I get when I don’t think for myself :smiley:

I’m glad this helped you out!
And to be honest; I am sort of glad I am not the only one that has made this mistake :rofl:

1 Like