Trigger.entity_id does not pass to action

Hi guys, I got the Automation below. when its activated it say “NONE just came home”
I got the friendly name for the person(s) and in the developer tool template it is correctly parse

{{ state_attr(‘person.john’, ‘friendly_name’) }} just came home. = john just came home.

in the logbook the trigger correctly identify the person

“Announce person came home triggered by state of John was detected at home”

Would you look at my automation and see what I did wrong

- alias: Announce person came home
  mode: queued
  trigger:
    - platform: state
      entity_id:
        - person.john
        - person.amber    
      from: "not_home"  
      to: "home"
  action:
    - service: notify.alexa_media
      data:
        message: >
          {{ state_attr('trigger.entity_id', 'friendly_name') }} just came home.
        data:
          type: announce
        target: 
          - media_player.kitchen

Don’t quote the trigger variable. That turns it into the literal string " trigger.entity_id".

        message: >
          {{ state_attr(trigger.entity_id, 'friendly_name') }} just came home.
1 Like

Brilliant! Thanks tom

1 Like

You don’t need to run it through the state_attr() function…

{{trigger.to_state.name}}

2 Likes