Using trigger.id for concatenation in automation

I want to use a trigger ID in a larger automation than the one below but is not successful at getting this small sample to work:

- id: '1234567890'
  alias: some_test_automation
  description: Using Trigger ID for text and entity_id concatenation
  mode: single
  trigger:
  - platform: state
    entity_id: input_boolean.test_helper
    id: test
  condition:
  - condition: state
    entity_id: input_boolean.{{trigger.id}}_helper
    state: 'on'
  action:
  - service: notify.notify
    data:
      title: "Trigger ID: {{ trigger.id }}"
      message: "This is a {{ trigger.id }} message"

Getting error:
Conditions: Entity input_boolean.{{trigger.id}}_helper is neither a valid entity ID nor a valid UUID for dictionary value @ data[0][‘entity_id’]

I’ve been looking at a couple of other posts and this one is pretty spot on.
But I cannot see what is wrong in my example :frowning:

There’s an important difference; a State Condition’s entity_id option doesn’t support a template.

Replace the State Condition with a Template Condition.

  condition:
  - condition: template 
    value_template: "{{ is_state('input_boolean.' ~ trigger.id ~ '_helper', 'on') }}"
1 Like