Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Deleting "Waiting Macros" Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
edtude
Groupie
Groupie
Avatar

Joined: July 26 2006
Location: United States
Online Status: Offline
Posts: 64
Posted: October 09 2008 at 11:44 | IP Logged Quote edtude

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 View edtude's Profile Search for other posts by edtude
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: October 09 2008 at 15:10 | IP Logged Quote grif091

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 View grif091's Profile Search for other posts by grif091
 
edtude
Groupie
Groupie
Avatar

Joined: July 26 2006
Location: United States
Online Status: Offline
Posts: 64
Posted: October 09 2008 at 15:24 | IP Logged Quote edtude

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 View edtude's Profile Search for other posts by edtude
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: October 09 2008 at 15:38 | IP Logged Quote grif091

I'll work up a macro and post it back.

__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
edtude
Groupie
Groupie
Avatar

Joined: July 26 2006
Location: United States
Online Status: Offline
Posts: 64
Posted: October 09 2008 at 15:57 | IP Logged Quote edtude

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 View edtude's Profile Search for other posts by edtude
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: October 09 2008 at 16:56 | IP Logged Quote grif091

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 View grif091's Profile Search for other posts by grif091
 
edtude
Groupie
Groupie
Avatar

Joined: July 26 2006
Location: United States
Online Status: Offline
Posts: 64
Posted: October 09 2008 at 18:08 | IP Logged Quote edtude

Thank you very much, works great once you add the Quotation Marks!
Back to Top View edtude's Profile Search for other posts by edtude
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: October 09 2008 at 19:49 | IP Logged Quote grif091

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 View grif091's Profile Search for other posts by grif091
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum