Page 1 of 1

[ANSWERED]How to get a Timer Start Value

PostPosted: Mon Jan 09, 2017 1:36 pm
by lalisingh
My search has not resulted in an answer as to how to get a timer's start value.

Here is the code snippet I have tried.
Code: Select all
id_timer    = 207309385     # Your timer ID
timerPlugin = indigo.server.getPlugin(u"com.perceptiveautomation.indigoplugin.timersandpesters")

if timerPlugin.isEnabled():
    tmr = indigo.devices[id_timer]
    TimerDelay = int(tmr.states['TimerStartValue'])
    indigo.server.log("timer start value is " + ": " + str(TimerDelay))


Any suggestion are much appreciated.

Re: How to get a Timer Start Value

PostPosted: Mon Jan 09, 2017 3:16 pm
by jay (support)
TimerStartValue isn't a valid state. To see the state list, select the timer in the device list and look at the control area below in the Custom States list. timerStartValueSeconds is what you're looking for.

Re: [ANSWERED]How to get a Timer Start Value

PostPosted: Mon Jan 09, 2017 9:25 pm
by lalisingh
Thanks Jay.

For anyone that stumbles on this thread below is the action group code to increase or decrease a timer's countdown start value. The action is called from a control page.

To Increase by 1 minute
Code: Select all
id_timer    = 207309385     # Your timer ID
timerPlugin = indigo.server.getPlugin(u"com.perceptiveautomation.indigoplugin.timersandpesters")

if timerPlugin.isEnabled():
    tmr = indigo.devices[id_timer]
    intVar = int(tmr.states['timerStartValueSeconds'])/60

if intVar < 240:
   intVar += 1
    timerPlugin.executeAction("setTimerStartValue", deviceId=id_timer, props={'amount':intVar, 'amountType':'minutes'})


To Decrease by one minute
Code: Select all
id_timer    = 207309385     # Your timer ID
timerPlugin = indigo.server.getPlugin(u"com.perceptiveautomation.indigoplugin.timersandpesters")

if timerPlugin.isEnabled():
    tmr = indigo.devices[id_timer]
    intVar = int(tmr.states['timerStartValueSeconds'])/60

if intVar > 5:
    intVar -= 1
    timerPlugin.executeAction("setTimerStartValue", deviceId=id_timer, props={'amount':intVar, 'amountType':'minutes'})