Trouble with trigger.id in action

Hi,
seems I’m to stupid to understand how to work with trigger.id

An example stub:

  - id: 'someone_awake' ## awake
    mode: queued
    alias: 'People - someone - awake'
    initial_state: 'on'
    trigger:
      - platform: state
        entity_id: sensor.whatever_click
        to: 'double'
        id: 'person1'
      - platform: state
        entity_id: sensor.whatever_click2
        to: 'double'
        id: 'person2'
    condition:
      - condition: template
        value_template: "{{ is_state('input_boolean.'~trigger.id~'_home', 'on') }}"
      - condition: template
        value_template: "{{ is_state('input_boolean.'~trigger.id~'_in_bed', 'on') }}"
    action:
      - service: input_boolean.turn_on
        entity_id: input_boolean.{{ trigger.id }}_is_awake

But this gets an error:

Automation with alias 'People - someone - awake' could not be validated and has been disabled: not a valid value for dictionary value @ data['action'][0]['entity_id']. Got 'input_boolean.{{ trigger.id }}_is_awake'

Someone can put in the right direction how to fix this? Seems I’m using trigger.id in a wrong way in the action part.

Thanks a lot!

    action:
      - service: input_boolean.turn_on
        target: 
          entity_id: "input_boolean.{{ trigger.id }}_is_awake"
1 Like

Thanks a lot.

But what has been the major problem? The missing “” (which I never use for entity_ids) or the missing “target”?

Both.

You must quote single line templates.

You can only use templates for key values within service, data or target keys (unless otherwise specified for the integration option in the documentation).

2 Likes

Thanks a lot for clarification!