Event from MQTT triggering script based on if statement

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?

did you try this?

trigger.event.data.args[0].click_type == 'single'

just tried that both with the ’ and without, no change. Thanks for that suggestion though, that was one I hadn’t tried.

Please ignore my previous post, that was non-sense. Try this:

trigger.event.data.args.click_type == 'single'

I tested it in the template editor and it works fine.

yep! That did it. Weird that the only documentation I could find mentioned referencing the array [0]. Oh well… it works. Thanks for your help.