Trying to create a variable notification usin g trigger_id but cant get friendly name to display

Master {{ trigger.entity_id, 'friendly_name' }} is {{ trigger.to_state.state }}

doesnt show friendly name, not sure how to get context right

It’s either

state_attr(trigger.entity_id, 'friendly_name')

or

trigger.to_state.attributes.friendly_name

thanks for the help, im new to this so learning, not sure how to put all that in a statement, can you provide the exact context you would put it into, this would be in the call notify service


Master {{ state_attr(trigger.entity_id, 'friendly_name') }} is {{ trigger.to_state.state }}

i played around with it and got it to work, thank you so much for your help

this seems to work as well

Master {{ trigger.to_state.attributes.friendly_name }} is {{ trigger.to_state.state }}

any ideas why it would be showing a garage door as on or off instead of open closed, I have selected them all as show as garage door

We don’t know your complete automation :wink:

this is just to get the state to report not as per the developer mode but rather as the device mode, my dashboard report them as open/close, but i know the default developer state is on/off even is its set to show as a garage door.

on / off is the real state of a binary sensor, open / closed the prettified state displayed in frontend.
The variable {{ trigger.to_state.state }} grabs the real state. If you want open/closed displayed in your message, do this:


Master {{ trigger.to_state.attributes.friendly_name }} is {{ 'open' if trigger.to_state.state == 'on' else 'closed' }}

Another way to do the same thing:

{{ iif(trigger.to_state.state|bool, 'open', 'closed') }}

works perfectly, thank you, any suggestions on where to learn about the yaml context of home assistant, i do have an IT background but havent written code in many many years, im trying to struggle along but really wanna learn, ive built lots of nice stuff but when really getting into the kinds of things above I’m struggling to understand how to do it.

You can start with the templating guide and the Jinja documentation.