I’m trying to build an automation that is triggered with:
event_data:
command: click
device_ieee: '00:15:8d:00:03:63:aa:c3'
unique_id: '00:15:8d:00:03:63:aa:c3:1:0x0006'
event_type: zha_event
platform: event
The action is then:
data_template:
entity_id: |-
{% if trigger.event.data.args[0] == 'single' %}
script.1594862412126
{% elif trigger.event.data.args['click_type'] == 'double' %}
script.1594862433674
{% elif trigger.event.data.args[0] == triple %}
script.1594862528360
{% else %}
script.1594862822782
{% endif %}
service: script.turn_on
Here’s the MQTT event:
{
"event_type": "zha_event",
"data": {
"device_ieee": "00:15:8d:00:03:63:aa:c3",
"unique_id": "00:15:8d:00:03:63:aa:c3:1:0x0006",
"endpoint_id": 1,
"cluster_id": 6,
"command": "click",
"args": {
"click_type": "double"
}
},
I’ve done substantial testing and although I’ve narrowed down the problem to:
{% if trigger.event.data.args[0] == 'single' %}
script.1594862412126
{% elif trigger.event.data.args['click_type'] == 'double' %}
script.1594862433674
neither option is working.
Is my if statement correct or is there some other syntax I need to be using?