I am attempting to right a script that tests several loads: if all the devices are off, turn off a device(123); else, turn on the device(123). I think the logic is correct, as I am able to make it work if the IF statement is on one line, but there are too many devices for it all to fit on one line. My problem is that I am unable to find the right syntax for multiple lines for the IF statement.
I hope someone can tell me how to edit the following piece of code that always fails the if condition, regardless of one or more devices returning true.
- Code: Select all
if not (devA.onState and \
not devB.onState and \
not devC.onState and \
not devD.onstate):
indigo.device.turnOff(123)
else:
indigo.device.turnn(123)