I want to switch off all devices starting with text light, only if they are on.
What would be the easiest way to do this?
for dev in indigo.devices.iter():
if dev.name.startswith("Light"):
indigo.device.turnOff(dev)
import time
for dev in indigo.devices.iter():
if dev.name.startswith("Light") and indigo.devices[dev].onState and dev.name != "Light Exception":
indigo.device.turnOff(dev)
time.sleep(1)
import time
for dev in indigo.devices.iter():
if dev.name.startswith("Light") and dev.onState and dev.name != "Light Exception":
indigo.device.turnOff(dev)
time.sleep(1)
Users browsing this forum: No registered users and 4 guests