Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Multiple Trigger/Macro Execution Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Viper
Groupie
Groupie


Joined: January 14 2007
Location: United States
Online Status: Offline
Posts: 88
Posted: July 06 2007 at 14:08 | IP Logged Quote Viper

I have an X10 motion sensor that I use to detect motion at a doorway to turn on the shop lights when I enter the shop if it is dark, or turn on a warning light (strobe) if the dust collector is on, to alert me to the presence of someone else in the room when I'm working.

I also have a light switch at the doorway.

There are times, when coming out of the shop, the motion sensor, sees me and starts the "SHOP MOTION" macro. But before it completes, I turn off the switch at the doorway which fires the "SHOP LIGHTS OFF" macro and turns off the lights.

Here is the order of things (in time order) from the log:

- Incoming X10 A14 On
- Trigger Check of SHOP MOTION performed.
- Macro SHOP MOTION executed.
- Insteon In SHOP LIGHTS Group 1, Off
- Trigger Check of SHOP LIGHTS OFF performed.
- Insteon Out SHOP LIGHTS, On
- Macro SHOP LIGHTS OFF performed.

So, what that says to me is that while the SHOP MOTION macro is executing, I get the lights turned off. The SHOP MOTION macro thinks the lights need to be turned on.

So Dave, I'm guessing I need the super secret code to allow a trigger (SHOP LIGHTS OFF) to run immediately. I want the trigger to call a macro that immediately disables the "SHOP MOTION" trigger (in case it hasn't yet fired) and sets the "SHOP MOTION ENABLED" global to 0, the calls another macro in "POST" mode to complete the other processing I need done when the lights go out. In the "SHOP MOTION" macro, I will check the "SHOP MOTION ENABLED" global, just before before turning the SHOP LIGHTS on to determine if the operation should really proceed or not.

I know that I could do a wait to force the "SHOP LIGHTS OFF" onto the queue, but that would defeat one of my other goals which is to have the lights come on as quickly as possible when I enter the shop.

Of course the best fix would be to have a motion sensor that is detected immediately, unlike the X10 one I have now. Then I'd have instant on lights when I enter the room, and the trigger would detect the lights are still on when I leave the room....

Tom
Back to Top View Viper's Profile Search for other posts by Viper
 
Viper
Groupie
Groupie


Joined: January 14 2007
Location: United States
Online Status: Offline
Posts: 88
Posted: July 09 2007 at 10:13 | IP Logged Quote Viper

Dave,

I slept on the problem the last few days and the solution finally came to me (I solve most of my problems by sleeping on them).

In the boolean field of the SHOP LIGHTS OFF trigger, I set the SHOP MOTION ENABLED global to 0 (disabled), then force the boolean value to 1 to allow the trigger to post the SHOP LIGHTS OFF macro for later execution.

The SHOP MOTION macro tests the SHOP MOTION ENABLED global just before it actually turns on the SHOP LIGHTS, thus reducing the window for a false on to as small as possible.

Thanks for providing a way to do this.

Tom
Back to Top View Viper's Profile Search for other posts by Viper
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: July 10 2007 at 11:23 | IP Logged Quote dhoward

Tom,

Yep, thats probably the best way. As you've discovered, the super secret (I like that) is that the Boolean field is executed immediately, ahead of the execution queue. You just have to be very careful of what you execute here (you wouldnt want to execute and Insteon Out command on an Insteon Incoming trigger...thats a sure way to lock your system). Setting globals and other variables however are just fine.

Another thing you could probably do is just as you've guessed, use a Wait command to allow the rest of the Execution queue to process (you seem to have a good idea of the inner workings ). You could make this Wait command value extremely small such as 0.001 so that the Wait is effectively just allowing the rest of the queue to process. Either way should work though.

Glad to hear that you did come up with a solution. I also do alot of problem solving in my sleep. My biggest problem is trying to remember all of the problems Ive solved and write the answers down before I forget them (and have to wait for the next night to solve them again ).

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
Viper
Groupie
Groupie


Joined: January 14 2007
Location: United States
Online Status: Offline
Posts: 88
Posted: July 11 2007 at 06:47 | IP Logged Quote Viper

Thanks Dave
Back to Top View Viper's Profile Search for other posts by Viper
 

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