I've created a action which executes this python:
- Code: Select all
import time
for dev in indigo.devices.iter():
if 'Light' in dev.name and dev.onState and dev.name != 'House Lighting':
indigo.device.turnOff(dev)
time.sleep(1)
indigo.variable.updateValue(260947379, 'off')
(That variable is named HouseLightingStatus.)
This is used triggered by a Virtual Device named House Lighting. Now the harder part:
I would like the HouseLightingStatus variable to be set to 'on', if any device with 'Light' in the name is turned on (minus House Lighting). Finally, if the last device with 'Light' in the name is turned off, I'd like the variable to be set to 'off.'.
Is this possible? Thinking about it more, do I have to maybe brute force this, and just run some python every minute that maintains this variable state? Suggestions appreciated, thanks!