First create group of all the sensors in question. call “group.all_sensors” . Assuming all your sensors states are either on or off. Set friendly name for each sensors, then it will output friendly names.
message: >
Intrusion detected, The following sensor was triggered:
{{ states | selectattr('entity_id', 'in', state_attr('group.all_sensors,'entity_id')) | selectattr('state','in',['on']) | list | map(attribute='name') | join(', ') }}
For future reference, if you already have a group of entities, there’s no reason to begin the template by selecting all entities (that’s what happens when you use states). Simply begin by expanding the group.
I’m trying to do a similar automation, however it appears the template above only shows the sensor whilst it is on. If there is a delay before the alarm moves to the triggered state and the sensor turns off in that time, then the template will return an empty value I guess ?
yes, this is is also my problem. An automation triggers the alarm, but there’s the delay time where the alarm is in “pending” - the time to enter a code after opening the front door.
so in the case of:
open front door → triggers automation to trigger the alarm
alarm state changes to pending
close front door
alarm state changes to triggered
this template will not show the frontdoor as open…
is there any way to call “alarm_trigger” and send along generic data / attributes?
then I could also set something like a “triggering entity” attribute to the alarm that I could reference in the triggered state.