Configure Xiaomi/Aqara button and switch

I’m attempting to make an Aqara button toggle a wall switch on single press. I am using Zigbee2MQTT, and both the button and switch seem to be sending signals, because actions show up in the logs.

Here is the config I have:

- alias: Toggle bedroom light on single press
    platform: event
      entity_id: binary_sensor.0x00158d0002ade595_click
      click_type: single
    service: switch.toggle
    entity_id: switch.0x00158d0003050a29_switch

If I activate the automation from the Hassio overview page, it will toggle the switch, however pressing the Aqara button does not activate the automation.

I’ve attached an image of how the two devices show in the MQTT intergrations page

Anyone know why it’s not working?

I am using ZHA, not Zigbee2MQTT, so I can’t get you 100% there. But I believe the issue is that you are triggering on the event That event is only transmitted if you’re using the Xiaomi Gateway integration. Since you’re using Zigbee2MQTT, you would need to see what event is being sent to Home Assistant when the button is pressed and trigger off of that.

It looks like this page lays out some options on how to respond to button click events using Zigbee2MQTT: