hamw wrote:I don't think you can turn off all days. It's not just Wednesday, it's the last one you try to turn off.
That's a different error...
- Code: Select all
EPS - Alarm Clock Error Control page attempted to turn off every day of the week, this isn't possible. It's easier to just turn off the alarm!
I'm trying to toggle "Wednesday" to "on" (true). ....
Some more testing... I created another alarm clock, identical in design and this one has a working "Wednesday". It looks like when the first device was created, the device state didn't save right giving it a "key not found" error.... but I can't re-create it and I don't know if there is a way to fix it (outside of just recreating the alarm clock device).
forgive the ugliness of the testing control page... in the below examples.... "Temp Change" is the nightly drop of the AC set point." I will create another alarm device for the morning version that raises the AC set point. The 2nd one is for a light in the fishtank. The on time can fluctuate, but it should stay on for about 8 hours. So Alarm On action will turn the light on. 8 hours later (480 minutes) Alarm Off action will turn the light off.
For my use, I still have some tinkering to do... like add another set of up/down arrows to manipulate the AC set point that it's going to change to (basically modifying the "On" action from the same page).
Python ?: I'm also trying to figure out a way to change duration by endTime. Use a HH:MM saved as a variable or something, untested and can guarantee won't work because my python time math sucks....
- Code: Select all
from datetime import datetime
alarmClock = indigo.devices[402185762]
newTime = "05:30" # replace later with a variable or something
oldDelta = alarmClock.durationMinutes
newDelta = newTime - alarmClock.startTime # will need to convert newTime to a datetime object
diference = newDelta - oldDelta
if diference > 0: # add time to duration
pluginId = "com.eps.indigoplugin.alarm-clock"
alarmClockPlugin = indigo.server.getPlugin(pluginId)
if alarmClockPlugin.isEnabled():
alarmClockPlugin.executeAction("increaseDuration", deviceId=402185762, props={'stepIncrement':diference})
else: # difference is a negative number, so subtract from current duration
pluginId = "com.eps.indigoplugin.alarm-clock"
alarmClockPlugin = indigo.server.getPlugin(pluginId)
if alarmClockPlugin.isEnabled():
alarmClockPlugin.executeAction("decreaseDuration", deviceId=402185762, props={'stepIncrement':diference})