How to use trigger tag_id friendly_name?

Hi everyone,
I’d like to ask you if there’s a way to retrieve the ‘friendly_name’ after scanning the tag.

I’ll explain what I did…
I registered a tag on HA with the name Stefano.
I created an automation of the type

trigger: event
event_type: tag_scanned

in actions: that should display the tag name, and I tried this:

"{{ state_attr(trigger.event.data.tag_id, 'friendly_name') }}"

But it doesn’t work.

Do you have any suggestions?
Thanks

I’ll answer myself, I had to write

"{{ trigger.event.data.name }}"
1 Like

or you use a state trigger like

trigger: state
entity_id: tag.stefano
not_from: unavailable

and then you can use {{ trigger.to_state.name }}

1 Like