Author |
|
edtude Groupie
Joined: July 26 2006 Location: United States
Online Status: Offline Posts: 64
|
Posted: October 09 2008 at 11:44 | IP Logged
|
|
|
Ok so here is the quick of it, I am automating the lights in a bathroom, but this could be applied to any room I guess. What I have now is my X10 Motion sensor sending in X10 C2 on which triggers a Macro I have that Basically turns on one light then Waits 15 minutes and turns off 2 lights. Now here is my delimma, if someone stays in the room past the 15 minutes the lights are turned off by the "waiting" macro, and of course they would be turned back on with the next detected movement. What I would like to do is add some script I guess it would be in the Macro that if it then again detects the C2 trigger, it would delete the previous "Waiting Macro" and add its own. This would of course continue until no further movement is detected and the Macro would run its course....thoughts?
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: October 09 2008 at 15:10 | IP Logged
|
|
|
How about a different approach. Set a Global variable to the current time at the beginning of the macro. After the 15 minute delay, check the time in the Global variable against the current time to see if there is actually a 15 minute differential, turning off the lights only if true. An intervening C2 On will update the Global variable with a later time. Only the last macro executed will process the Off because it will be the only one where 15 minutes have actually elapsed. I could have missed it but I did not find a means for flushing an active macro from another macro.
__________________ Lee G
|
Back to Top |
|
|
edtude Groupie
Joined: July 26 2006 Location: United States
Online Status: Offline Posts: 64
|
Posted: October 09 2008 at 15:24 | IP Logged
|
|
|
OK sounds good, but as my tag says I am a newbie so could you give me clue as to how to do this?
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: October 09 2008 at 15:38 | IP Logged
|
|
|
I'll work up a macro and post it back.
__________________ Lee G
|
Back to Top |
|
|
edtude Groupie
Joined: July 26 2006 Location: United States
Online Status: Offline Posts: 64
|
Posted: October 09 2008 at 15:57 | IP Logged
|
|
|
lol thanks I just tried playing around with it and low and behold I made a mistake so the whole thing is gone...ah experimentation!
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: October 09 2008 at 16:56 | IP Logged
|
|
|
As I was looking through the functions to implement the time comparison, I found what you were asking about...
ph_killmacrowait(ID)
This function kills the oldest waiting macro with a matching ID. Invoke Help and look at the functions under Flow Control.
__________________ Lee G
|
Back to Top |
|
|
edtude Groupie
Joined: July 26 2006 Location: United States
Online Status: Offline Posts: 64
|
Posted: October 09 2008 at 18:08 | IP Logged
|
|
|
Thank you very much, works great once you add the Quotation Marks!
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: October 09 2008 at 19:49 | IP Logged
|
|
|
You will get use to using the quot's. Rarely do any of the Help reference for individual formula mention the need unless is it something unique to that particular formula. IDs in general, Global variable names, macro names, macro Labels, device names, etc. generally require the ID be in quot's.
__________________ Lee G
|
Back to Top |
|
|