Notification Variable for Trigger

Hello All. I have seen some examples using templates and other things but I’m looking for just a Simple Automation that sends an SMTP notification that has the “trigger” of that automation.

I have SMTP configured properly and get alerts. The trigger, triggers the action, I just want to insert the trigger into the message. If you look at the “message” of the notification, I’m hoping to put whatever device or trigger from the automation into that location. My Yaml is below.

- id: '1600918545581'
  alias: Test
  description: ''
  trigger:
  - platform: state
    entity_id: light.living_room
    to: 'off'
    from: 'on'
  condition: []
  action:
  - service: notify.notify_aaron
    data:
      message: '{{ trigger.state }} has been opened.'
  mode: single

change that to if your in 0.115 or above:

      message: '{{ trigger.to_state.name }} has been opened.'

For 0.114 and below:

  action:
  - service: notify.notify_aaron
    data_template:
      message: '{{ trigger.to_state.name }} has been opened.'

Darnnit… stupid formatting but you are 100% spot on, thank you. Do you have to use state, or can you use device as well?

Final goal is to build out one Automation, but put a handful of “Devices” or “states” in the trigger so that if one of 5 doors opens, send message with that “Trigger Name”

Secondly is there a list of these somewhere, like trigger.to_state.name = Name of Trigger, trigger.to_state.value = the current value of the state

Docs for trigger object are here.

to_state and from_state are state objects, and they are described here.

Your awesome! Thank you.