Person Entity... cant get Last Updated time stamp with Template

I have tried multiple templates and nothing works.

When the template runs in Dev Tool Template, the auto-fill even pulls in the person. then it gives me an error…

‘person’ is undefined

makes no sense.

tried Last_Changed and Last_Updated

{{ state_attr(person.NAME, 'friendly_name') }} was last updated at {{
  as_timestamp(states[trigger.entity_id].last_updated, default=0)
  | timestamp_local
  | timestamp_custom('%I:%M:%S %p')
}}

thx for the help

You need quotes around the entity ID state_attr('person.NAME', 'friendly_name'), otherwise it’s expecting a variable named person which you haven’t defined.

Just FYI, timestamp_custom already localizes, so there’s no need for timestamp_local.

If the person entity is the triggering entity you can just use:

{{ trigger.to_state.attributes.friendly_name }} was last updated at 
{{ trigger.to_state.last_changed | as_timestamp | timestamp_custom('%I:%M:%S %p') }}

works perfectly, thank you!