Virtual switch to monitor all switches


#1

1) Give a description of the problem
Can’t figure out how to turn a switch off only if all switches are closed

2) What is the expected behaviour?
When all of a list of switches have closed, turn off a virtual switch

3) What is happening/not happening?
Switch is just turning off after 5 seconds even if other swithces are open.

**4) Post a Green Snapshot of the piston![image|45x37]

I’d think this would be a pretty simple piston, but I can’t figure out how to make it work. I have a list of devices in a variable. I have one if statement so that if any switch is opened, a virtual switch is turned on. That part is no problem. But I want the piston to turn off the virtual switches when all switches are off. It seems that the OFF condition looks for any device to be closed for 5 seconds, I want it to be if ALL are closed for 5 seconds.

Thank you.


#2

My suggestion would be to drop the 5 second element. You do not want (potentially) twelve timers running concurrently in the same piston.

I’d use something like this:

define
    device winDoors = Sensor2, Sensor4, Sensor5, etc
end define

execute
    IF ALL OF {winDoors} contact IS open    (Condition, not a trigger)
    Then
        Turn on Switch 20
    Else
        Turn off Switch 20
END IF

#3

When selecting your devices, make sure you change ‘What to compare’ to ‘ALL of the selected devices’
and I would update your trigger to change to closed. I used switches as an example below but same process.


#4

Thank you both. I was missing the “any of” “all of”. I’m working.

Have a good day!


#5

You too!