Get the variable of the triggering entity_id in an automation

Hello, how can i get the variable for the triggering entity_id in an automation like this?:

alias: "Test"
  - platform: state
      - sensor.testsensor1
      - sensor.testsensor2
      - sensor.testsensor3
      - sensor.testsensor4
  - service: notify.telegram
      message: >-
        Triggering entity_id <-- here i want to get notified which sensor triggered the automation..
mode: single

It’s {{ trigger.entity_id }}.

I cant get that to work, ive tried everything from The help page you linked to to no avail.
{{ }} works, but cant get The id… :expressionless:

Post the YAML of the automation that you can’t get to work, and explain its output.

Never mind, i got it to work. I rewrote the whole automation, identically(?), and it worked. I dont know what i had done wrong before, probably som stupid yaml space missing or something :wink:

Thanks, that was the variable i was looking for!

1 Like