How to change a switch value based on state of multiple other switches

Hi, im trying to work out how to change the state of a "master" on/off switch when the state of 5 other "sub" on/off switches are either all on or all off. currently i just have it working so that the master switch can turn on and off all of the sub switches at once using linkid, master only on the master and slave only on the sub switches. I want to make it so that if just one of the sub switches is still on, the master switch will stay in the on position, but if ALL of the sub switches are turned off, the master will change to the off position.

Bonus points if you make it so that the master does not send an osc message if it's state is changed by a sub switch.. it should only send osc when switched directly.

I got it to work, but not sure if it's the best approach. I don't know if you're using a matrix for your slave switches, so I did it with individual ones.
Hope it helps :slightly_smiling_face:
switch_master.json (9.4 KB)

Thanks Clelson, your example works perfectly! unfortunately though im having trouble getting it to work properly in my project. Everything works except the master switch does not turn off and on the sub switches for some reason - it works fine in the other direction though. do you think you could take a look at my project and see if you can work out what ive done wrong? lightcontrol.json (58.0 KB)

lightcontrol.json (57.5 KB)

I removed the switchcheck script and used the extra options in set (Scripting - Open Stage Control) to prevent unwanted message / synchronization.

1 Like

Ah you're a weapon jean - works great. Thanks!

And clelson i worked out what i did wrong.. forgot the Capital L on <<switchLink - duhh :stuck_out_tongue: thanks again :slight_smile:

1 Like

Cool! I totally forgot about the set {options} object.