Count how many switches are turned on

Hello, I have 8 switches and when at least 4 of them (any) are opened i want my automation to do something.
What's the best way to count that, I was thinking to make a variable and everytime a switch is one it increments the variable and when variable x >3 then do something.
Is there a cleaner way ? thanks

1 Like

I wonder if switches can be used in a Motion Zone, then you could set it up so the Motion Zone sends Active event when 4 devices are active

Later: Sadly not, only motion sensors are included in the device picker.

This might give you what you need:

1 Like

In this case, I would just do brute force and not overthink it. While there would be many more elegant ways, Iā€™d use RM with a trigger of if any of the switches change.

Set a variable to 0
Have eight simple conditionals If SWx is on then variable+
If variable > 3 do something

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.