How to specify which device from a group changed state in a notification?

Hi guys!

I have a simple automated notification that triggers when a person state changes to ‘not_home’ and if the group of all devices is ‘on’. This helps me know that I left something ‘on’ after leaving home.

However, I was trying to customize that notification making it dynamic by saying which device was left ‘on’, but I’m struggling a bit on this.

Any ideas?

Thanks in advance

The trigger state object might hold the information you need,see https://www.home-assistant.io/docs/automation/templating/.

Maybe you want something like

{{ trigger.entity_id }}

or

{{ state_attr(trigger.entity_id, 'friendly_name') }}