Template for triggered automation

I’d like some help understanding how to use a template in the action section of an automation to use the trigger in the action.

So, in example…
Trigger: ‘bedroom light’ changes to ‘on’
Conditions: …
Action: ‘Notification, {{ triggering entity (bedroom light) }} turned on.’

I’d like to use this in several different automations but don’t fully understand how to accomplish it.

I’d really appreciate some help, thanks!

action:
  - service: notify.someone
    data:
      message: "The {{ trigger.to_state.name }} turned {{ trigger.to_state.state }}."

More options here:

1 Like