[SOLVED]Reset duration and restart

Posted on
Thu Jun 11, 2015 9:43 am
ELWOOD offline
Posts: 214
Joined: Feb 11, 2007
Location: Ramsey, NJ

[SOLVED]Reset duration and restart

Setting up some timers to control an exhaust fan. Have made 2 action groups that set the timer duration and
start the fan, one for 2 min. and the other for 5 min. Have two buttons on the control page to start the timers.
All works and I can restart a running timer by clicking the control page button. With the 2 min timer running
hitting the the 2 min button the duration resets to 2 mins. With the 2min running hitting the 5min resets
the duration to 5 min and shuts down the fan as expected.

However with the longer 5min timer running hitting the 2 min button the timer goes inactive the duration
goes to 5 min. Hitting the 2min button a second time the timer starts with the duration of 2 min.

Here is the script I use to set the timers, the only difference between the two actions is the duration
setting. Have tried the startTimer and resumeTimer and restartTimer but have not got it to work.

#STOP TIMER
tId = "com.perceptiveautomation.indigoplugin.timersandpesters"
timerPlugin = indigo.server.getPlugin(tId)
if timerPlugin.isEnabled():
timerPlugin.executeAction("stopTimer", deviceId= 1759204718)



#SET TIME
tId = "com.perceptiveautomation.indigoplugin.timersandpesters"
timerPlugin = indigo.server.getPlugin(tId)
if timerPlugin.isEnabled():
timerPlugin.executeAction("setTimerStartValue", deviceId= 1759204718, props={'amount':'2', 'amountType':'minutes'})

#START TIMER
tId = "com.perceptiveautomation.indigoplugin.timersandpesters"
timerPlugin = indigo.server.getPlugin(tId)
if timerPlugin.isEnabled():
timerPlugin.executeAction("startTimer", deviceId= 1759204718)

Thanks for you help
Elwood

Posted on
Thu Jun 11, 2015 10:47 am
howartp offline
Posts: 3341
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Reset duration and restart

Is this just one Timer device that you're changing the time value on, or two separate timers?

If it's one, I can't think what you can get 'wrong' that would give this result.

If it's two, there's more scope for error.

Posted on
Thu Jun 11, 2015 10:58 am
ELWOOD offline
Posts: 214
Joined: Feb 11, 2007
Location: Ramsey, NJ

Re: Reset duration and restart

howartp

Same timer device and two action groups.

Elwood

Posted on
Thu Jun 11, 2015 11:09 am
howartp offline
Posts: 3341
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Reset duration and restart

Are those action commands (Stop, Set, Start) all in one script block? (Per action)

If so, try getting rid of the duplication. Just call the plugin/tld bits once, then three executeAction() commands.

Shouldn't (!) have any effect on it but you never know. It is surplus code at the moment anyway.

Posted on
Thu Jun 11, 2015 11:26 am
howartp offline
Posts: 3341
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Reset duration and restart

I've just duplicated your code (twice) line-for-line on my Indigo, with a test Timer device (changed the ID) and it's working fine for me. (This is without shrinking the duplicate code)

2 minutes or 5 minutes - either one correctly restarts the timer back to the correct time regardless of how long it's going or which action I used last.

Peter

Posted on
Thu Jun 11, 2015 11:29 am
ELWOOD offline
Posts: 214
Joined: Feb 11, 2007
Location: Ramsey, NJ

Re: Reset duration and restart

First started this setup using the pull down menus in the action group setup. With the same trouble. So decided to try python code.
Just did a restart of the mac mini server running indigo, now all is working OK
Go Figure

Thanks
Elwood

Posted on
Thu Jun 11, 2015 11:29 am
howartp offline
Posts: 3341
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Reset duration and restart

Weird :)

Glad it's sorted.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest

cron