Turn on switches if one on and turn off

Hi,

I'm trying to make a rule whereby any 3 switches can be turned on and it turns the others that are off on. Then when one of those 3 switches turn off it turns the others that are on off. I've got this so far however it doesn't work could anyone point me in the right direction please

I would suggest two rules instead of one.

Each rule should be triggered by the change to either on or off and then it should make the rest go to the same state.

Use last event device as the first condition. If the device that triggered was turned on then you want others turned on, Your current rule will turn on all three if any one is on. So if all three are on and you turn off one, your first condition will still see two others still on, so it turns on all.

@terminal3 thats exactly what is happening at the moment all three turn on. I don't understand how to structure the last event rule you've shown would you mind explaining/showing further? Thank you

When you add your conditional action select Last event device. The screenshot above shows an example.

When you select Last event device, it will ask you for an exemplar device. In your case you want to select a switch. Your trigger is a switch changing state. The last event device can capture whether that device was turned on or turned off. You could also look at %value%. See example below it will be equal to on or off depending on if your trigger device was turned on or off. The log screenshot shows what happens when the switch is turned on.

Thanks, i'll give this ago over the next few days and report back.

Honestly, an app would probably be easier. [RELEASE] Switch Bindings would be able to manage this with no problems. Just put all three switches in the binding and it will work fine.

2 Likes

Yep, switch bindings would be much easier and it was made specifically for this situation.

Awesome will give that a go! Thanks

Nice APP thanks guys for the heads up :slight_smile:

binder app worked a treat and solved the problem thanks for mentioning it! I'd still like to see the code in rule machine to see how it would work, sadly i don't have the skill set to do that so the app will do. Thanks again

If you really wanted to use rule machine, I would use two rules and keep it simple:

Rule 1 ON
Triggers: Switch 1; Switch 2; Switch 3 turn on
Actions: Turn on Switches 1, 2, and 3

Rule 2 OFF
Triggers: Switch 1; Switch 2; Switch 3 turn off
Actions: Turn off Switches 1, 2, and 3

The worst about this is that you hit the trigger switch with a duplicate command. If you wanted to use a conditional action, you could, but I still would have used two rules to separate on and off. Finally, if you really wanted one rule, use the 6 possible triggers rather than “change” and define the actions using ifs and else-ifs.

1 Like