- Code: Select all
hseOcc = indigo.variables[612296111].getValue(bool)
import time
time.sleep(5)
if hseOcc:
indigo.variable.updateValue(612296111,"false") # hse Vacant
indigo.iodevice.setBinaryOutput(1375390279, 0, False)
time.sleep(1)
indigo.variable.updateValue(612296111,"false") # hse Vacant
indigo.iodevice.setBinaryOutput(1375390279, 0, False)
time.sleep(1)
indigo.variable.updateValue(612296111,"false") # hse Vacant
indigo.iodevice.setBinaryOutput(1375390279, 0, False)
else:
indigo.variable.updateValue(612296111,"true") # hse Occupied
indigo.iodevice.setBinaryOutput(1375390279, 0, True)
time.sleep(1)
indigo.variable.updateValue(612296111,"true") # hse Occupied
indigo.iodevice.setBinaryOutput(1375390279, 0, True)
time.sleep(1)
indigo.variable.updateValue(612296111,"true") # hse Occupied
indigo.iodevice.setBinaryOutput(1375390279, 0, True)
time.sleep(1)
The problem is that the script doesn't always work. I am attempting to deal with this by repeating the commands after short delays. I think I can do better.
Would it make sense to create 2 loops - 1) to test for the desired variable value, and repeat, until the desired value is set, and then 2) do the same for the iodevice?
If so, is there a model I could use? - or more likely, a better way to achieve a reliable result?