I have added a simple action with if/then logic: - turn the light on if off, and vice versa.
Running the script, with the lamp off, results in a turnOff action - should be turnOn. - i.e., the if test is not working.
- Code: Select all
lamp = indigo.devices[1580115691] # where the number is the ID of "office desk lamp"
if hasattr(lamp, 'onState'):
isOn = lamp.onState
indigo.device.turnOff(1580115691) #nOff lamp
else:
indigo.device.turnOn(1580115691) #nOff lamp
# lamp = indigo.devices[1234567890] # where the number is the ID of "office desk lamp"
# if hasattr(lamp, 'onState'):
# isOn = lamp.onState