Hello,
I have added several Sonoff Zigbee door sensors for alarms when absent. For this I added a helper “AlarmArmed” that can be on or off. When it is on and a door is opened it fires several alerts, e.g. Telegram messages. This works so far.
What I would like to add now is, that if AlarmArmed is turned on, the state of every door sensor is checked and a Telegram message is sent that tells me of this, including the friendly name of every door sensor that is open. I managed to do this by creating a separate automation for each door.
My question is: can I do this in a more elegant way in yaml, by doing a “for each” loop and in case the current sensor is open it writes the friendly name along with a newline char in a buffer and then after iterating over every sensor it sends a message with the buffer as message body? I tried to find necessary functions in the documentation, but no luck. I don’t need someone to write it for me, I’d be very happy if someone could drop the necessary function names.
Thanks a lot!
1 post - 1 participant