#Variables for Smoke Alarm names for use in notifications

6 messages · Page 1 of 1 (latest)

teal robin
#

Heya,

first time playing around with variables in HA Automations.

My plan is to create an automation for smoke alarms which later sends a notification to phones and all Alexa devices. So far I've realized this in Node-RED but want to move this over to automations now.

I want to assign variables for each of the smoke alarm names to later use in just 1 notification action and just have it replace the name of whatever smoke alarm was triggered, however I'm not quite sure how to do this. I found a few examples online but I think as a "almost-first-time-template-user" this is a bit overwhelming ^^"

So, tl;dr how can I check via variables/trigger IDs which one was triggered and then set a variable with a proper name and then later on use this variable?

Thanks a lot already!

late badger
#

I would add all smoke alarms to a label called "Smoke Alarms" (original I know) - you can then use something like the following to loop through them all:

{{ state_attr(alarm, "friendly_name") }}
{% endfor %}```
teal robin
late badger
#

You could do some string parsing to strip it down tjust to the local or whatever location you want

teal robin
#

But I thought about a "dumber" approach of just checking which ones are active, then setting a name for them as a variable and then using that in the noficiation action