1) I couldn't compare the device class using device.__class__ = "<class 'indigo.DimmerDevice'>". I managed to work around this by using the .iter filter but is there a way to compare the device class directly?
2) Among the list of devices that this script finds are some virtual devices which also have the indigo.relay class. How can I exclude them? Do virtual devices have anything in particular I can use to exclude them?
3) How can I get the device's folder? (i.e. in which folder my device is located)
Thanks!
- Code: Select all
## Convenience log function
def log(msg):
indigo.server.log(msg, type="Reset All Lights Timer Script")
## Loop through devices looking for light devices
for device in indigo.devices.iter("indigo.relay, indigo.dimmer"):
if device.enabled and "Lights " in device.name and hasattr(device, 'onState'):
if device.onState:
tId = "com.perceptiveautomation.indigoplugin.timersandpesters"
timerPlugin = indigo.server.getPlugin(tId)
if timerPlugin.isEnabled():
timerPlugin.executeAction("restartTimer", deviceId=1657820952) # "Timer All Lights"
log("Restarted Timer All Lights")
break