Do action if certain number of switches are on

How can I make an action happen if 3 of 10 selected switches are on? Their all virtual switches. It's to make sure that more than 30% of moisture sensors detect low water condition before watering plants to prevent over watering.

You can do this in rule machine. Here's the very basics. there might be an easier way also

If any switch (sw1, sw2,......sw10) toggles

Variable = 0
if sw1 = On, variable +1
if sw2 = On, variable +1
.If sw10 = on variable +1

If variable >= 3 then do something.
else do something

In your case maybe its wet/dry instead of switch or some other sensor.

Just use my app.

Use the switch group option and set the threshold to 3. The app will create a virtual device that can be used in your rules. The app's child device will only show on if 3 or more switches in the group are on.


Noice. That's easier.

1 Like

Download the Hubitat app