Set toggle helper if any or all conditions are met

Hi everyone,

I have several door and window sensors. I want to consolidate all their statuses into a single one: If any door/window is opened, then variable “Doors/Windows open” is true. If all doors/windows closed then the variable to false. I want to use such a variable to warn me when I am leaving or going to bed that I left something open.

What I planned to do is create a toggle helper that is set to true once the state or any window or door goes to open. That is easily done in an automation with adding a trigger for each sensor. However setting the toggle to false is not as straightforward as triggers are always “OR” (as soon as one is true then it runs). However for “all closed” I would need an “AND” (i.e. when all are closed then run the automation).

Does anyone have an idea how to achieve this? Also is that really the most efficient way to do this or is there a better way overall?

Thanks!

I suggest you consider using the Binary Sensor Group integration.

2 Likes

What about a ‘normal’ group?

1 Like

Thank you so much, you just saved me so much headaches. Super easy and works perfectly.

1 Like

I was thinking of creating an automation that would check each sensor (it’s how I used to do it in SmartThings to control a virtual device) but thought to myself there has to be a better way…
This is exactly what I was after and is so easy to implement.
Every small discovery like this makes me wonder why I stuck with ST for so long. I love HA :slight_smile: