Hi,
I tried to set up an automation routine triggered by a button click but it didn’t succeed using the event platform.
I was able to make it work with a mqtt paltform trigger.
Bellow is my YAML for both automations:
- id: lighttoggleexample
alias: Lamp toggle on and off - MQTT payload
trigger:
- platform: mqtt
topic: zigbee2mqtt/0x00158d0001a66a8f
condition:
- condition: template
value_template: '{{ "single" == trigger.payload_json.click }}'
action:
- data:
entity_id: switch.0x7cb03eaa0a01a62f_switch
service: switch.toggle
- id: alex_switch
alias: "Ryan's Office External Light Switch"
trigger:
platform: event
event_type: click
event_data:
entity_id: sensor.0x00158d0001a66a8f_click
click_type: single
action:
- data:
entity_id: switch.0x7cb03eaa0a01a62f_switch
service: switch.toggle
If I fire an event of type click with the json data {"entity_id": "sensor.0x00158d0001a66a8f_click", "click_type": "single"}
the automation “Ryan’s Office External Light Switch” is fired.
Why isn’t the trigger platform event working?