Entity_id not determined by way of variable

Hi all

I don’t get the entity_id to work in automations other than to “hard-code” it. The service part works 100%.
value will be "on or “off”
item will be “home” or “away”

  - alias: Receive Message
    trigger:
    - platform: webhook
      webhook_id: alarm_pw
    action:
      service: >
        input_boolean.turn_{{ trigger.json.value }}
      entity_id: >
        input_boolean.alarm_{{ trigger.json.item }}

Any help will be appreciated
Thank you

Can you show an example of the JSON you receive?

1 Like

entity_id employs a template so you should use data like this:

  - alias: Receive Message
    trigger:
    - platform: webhook
      webhook_id: alarm_pw
    action:
      service: >
        input_boolean.turn_{{ trigger.json.value }}
      data:
        entity_id: >
          input_boolean.alarm_{{ trigger.json.item }}
3 Likes

Thank you 123 Taras - it worked!

1 Like