The Timers are driving me crazy :-)

Posted on
Wed Sep 18, 2013 6:23 pm
BobRoss offline
Posts: 101
Joined: Jan 15, 2006
Location: Arizona

The Timers are driving me crazy :-)

How do I load a timer, and start the timer all in the same trigger?

Are there examples of timers and pesters usage anywhere??

thanks
Bob

Posted on
Wed Sep 18, 2013 8:48 pm
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: The Timers are driving me crazy :-)

I've just updated the Timers and Pesters documentation. I had overlooked that doc when finalizing the Indigo 6 documentation. It should be much clearer now how to use them. Let me know if something doesn't make sense.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Sep 19, 2013 10:02 am
otto-mate offline
User avatar
Posts: 30
Joined: Aug 10, 2013
Location: UK

Re: The Timers are driving me crazy :-)

Jay - can you give an example Python script to check if a timer is still running for the 'if script returns true' part of the conditions tab.

If timer TimeName seconds remaining > 0

Thanks

M.

Posted on
Thu Sep 19, 2013 10:30 am
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: The Timers are driving me crazy :-)

First, you can't execute Python scripts as conditions - only AppleScripts, and AppleScripts don't have access to custom plugin devices like the timer. Second, you don't need a script - just do it in the condition editor:

condition.png
condition.png (25.93 KiB) Viewed 2701 times


[EDIT] Does that answer the question? If you have other things you want to do in the script before executing actions, then you'll want to skip the conditions tab entirely and make your action a single script. The script could check all your conditions (including the timer) then either directly execute the actions you want or it could just execute an Action Group that contains the actions you want to run.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Sep 19, 2013 10:37 am
otto-mate offline
User avatar
Posts: 30
Joined: Aug 10, 2013
Location: UK

Re: The Timers are driving me crazy :-)

Perfect, thanks Jay.

M.

Posted on
Thu Sep 19, 2013 10:44 am
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: The Timers are driving me crazy :-)

Check my edit - wasn't sure in retrospect I'd answered your question... ;)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Sep 19, 2013 11:30 am
BobRoss offline
Posts: 101
Joined: Jan 15, 2006
Location: Arizona

Re: The Timers are driving me crazy :-)

Just to add my two cents. The extra docs that you provided in the timers and pesters wiki was a big help

Posted on
Sat Sep 21, 2013 10:00 am
otto-mate offline
User avatar
Posts: 30
Joined: Aug 10, 2013
Location: UK

Re: The Timers are driving me crazy :-)

jay (support) wrote:
Check my edit - wasn't sure in retrospect I'd answered your question... ;)


Thanks Jay - It would be good to see some sample script if you don't mind. I'm firing off an email each time a Garage Door relay is toggled. I don't want multiple emails each time the door goes up and down in a single operation so I want to start a timer each time the relay operates (and re-start it if it's already running). Then only fire off the email if the timer is not running.

Thanks

M.

Posted on
Sat Sep 21, 2013 11:05 am
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: The Timers are driving me crazy :-)

I'm still not following you exactly, but here's a snippet of Python to look at a timer's status:

Code: Select all
timer = indigo.devices[365380652] # "1 hour timer"
if timer.states["timerStatus"] == "active":
    # do whatever you need to do when it's active
elif timer.states["timerStatus"] == "paused":
    # do whatever you need to do if it's paused
else:
    # do whatever you need to do if it's inactive

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Sep 21, 2013 11:17 am
otto-mate offline
User avatar
Posts: 30
Joined: Aug 10, 2013
Location: UK

Re: The Timers are driving me crazy :-)

Thanks Jay, that's great.

M.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 16 guests