Passing an automation trigger to the action

Ive been trying to figure this one out and keep getting errors

I have an automation with a trigger being a motion sensor.
Id like to be able to send a notification via pushbullet which will tell me which one of 2 sensors has triggered, im failing:

- alias: Intruder
  trigger:
    - platform: state
      entity_id: sensor.lounge_sensor_node_pir, sensor.bedroom_sensor_node_pir
      to: 'motion detected'
      from: 'standby'
   condition:
    - condition: state
      entity_id: input_select.home_mode
      state: 'Away'

  action:
    - service: notify.pushbullet
      data:
        message: {{ trigger.from_state.attributes.friendly_name }} has been triggered
        title: Intruder at Home!!

It gives me an error in the log along the lines of ‘trigger is not defined’?
Ive also tried the above but altering the trigger to

- alias: Intruder
  trigger:
    - platform: state
      entity_id:
        - light.first_light
        - light.second_light
      to: 'motion detected'
      from: 'standby'

This also does not work.

Last three lines of the first one:

Change data to data_template.

Put double quotes around the message body.

Thaks, ive tried this and still get an error

Invalid service data for notify.pushbullet: required key not provided @ data['message']. Got none

This is the way I do it…

   action:
     service: notify.myzanzito
     data_template:
       message: >-
         'Bitcoin Miner {{ trigger.from_state.attributes.friendly_name }} Lost Power.'
2 Likes

brilliant thanks, this did the trick

Bumping instead of starting anew. This post helped me get trigger data passed, thank you!

Is the only way to get trigger data from an automation to a script by passing it via a data_template? I’m just learning scripts and the like and will have about a dozen or so automations which I’d like to call a script which will format a Discord message of trigger data (think info level logs).

Is there an inherent way, when a script is called, to pull the information about what called it (if the above way is pushing the information)? Should I be listening for an event or something else to get this?

Thanks!