As I was converting, I used the if statement to only turn on when the lights were off. This reduced a lot (LOTS) of insteon traffic. However, the lights always turn off after the duration, making my wife not a happy camper. So I removed the if's and are are back to more traffic, although using python.
I was wondering if there is a better way to update the delayed actions if the lights are on when a new motion is detected, in python. Basically to reset the delayed turn off actions to the delay variable. The delayed actions are 2 lights, on/off and dimmer, and a keypadlinc button (which is on/off via a trigger based on on/off state of the lights).
I've tried this, but the off command is immediate with the delay to turn them back on instead of my desire to adjust the auto off delayed action. The names in the script are linked to the python instance number...
- Code: Select all
if kitchenLight.onState:
indigo.device.turnOff(kitchenLight, duration = kitchenDelay)
indigo.device.turnOff(kitchenTable, duration = kitchenDelay)
indigo.server.log("Turning off kitchen lights in " +Delay + " minutes");
else:
indigo.device.turnOn(kitchenLight, duration = kitchenDelay)
indigo.device.turnOn(kitchenTable, duration = kitchenDelay)
indigo.server.log("Turning on kitchen lights for " +Delay + " minutes");