X10 Community Forum

🖥️ActiveHome Pro => Plug-ins => Smart Macros => Topic started by: thejfk on October 11, 2008, 02:07:09 PM

Title: Running two macros with one trigger
Post by: thejfk on October 11, 2008, 02:07:09 PM
I have a Driveway light  (macro1)  triggered by an eagle eye(A10)
I set up a living room light  (macro 2)  triggered by the same(A10)
When motion is detected ,only the driveway lights come on
If I press A10 on a palm pad, they both come on
If I delete one or the other macro, the remaining one works fine.

I set up another two macros (hallway/bedroom ) triggered by one eagle eye(D1) ...works great.

The only difference is the driveway sensor is near a TM 751 and the hallway sensor is near the CM15.
I I tried moving the CM15 near the driveway sensor,but still only one macro triggered.

Can someone explain why I CAN'T trigger two macros from one trigger and I CAN trigger two macros from one trigger
Title: Re: Running two macros with one trigger
Post by: Rocky on October 11, 2008, 04:09:33 PM
Just a thought..  Why not have all the modules you want to trigger in the same module?
I have done this, I will add short delays between commands to give each command a chance to complete. ( Don't know if the delay is neede, but it cannn't hurt.javascript:void(0);
Title: Re: Running two macros with one trigger
Post by: Boiler on October 11, 2008, 04:15:31 PM
thejfk,

When you set up two macros on the same trigger, the second macro is treated as an "else" condition.  If you don't have a condition on the first macro, the second will never be executed.

That being said, I understand why your first macro behaves the way it does - the second "A10" macro is the else and it's never being called.

What I do not understand is why your hallway/bedroom macros (D1) work properly.  Does the first macro include a condition?

Boiler
Title: Re: Running two macros with one trigger
Post by: steven r on October 11, 2008, 04:43:32 PM
Perhaps unrelated to this problem but likely to cause other problems is if your TM751 and your CM15A both use the same HC. It is advisable in 99.99% of the time to turn off in AHP any HC that another device like your TM751 is using. It is almost inevitable that you will experience a signal conflict at some point. If Murphy has his way, this will be when you least expect it.

While it would be better to put everything in one macro as Rocky suggested, you could live on the bleeding edge and exploit an AHP bug to cause both macros to operate. AHP has a know bug in which else macros will execute if they begin with a delay.
Note: I do not recommend this as the bug is likely to be fixed when you least expect it and it realizes on a poor programing approach to the problem.
Better to do put everything in one macro or create two different macros and have one call the other.
Title: Re: Running two macros with one trigger
Post by: thejfk on October 11, 2008, 06:43:29 PM
Thank You for the replies,
I can't put everything in one macro because I have different time ranges for the different lights.
First, Steven when you say "have one macro call another",is this what you mean?
I set up macro 1 to turn on the garage lights and a dummy module (B2).then I set up macro 2 to control the living room lights.using a B2 trigger.

Thanks for the advice on the TM715/CM15 HCs. I'll change those settings

Boiler, I spent a bit of time trying to find an answer.

What I found is: I can trigger 2 lights in the hallway with D1, I tried 3,but only 2 went on. Maybe the output of the eagle eye isn't enough for the CM15 to process multiple  commands?

I tried all kinds of conditions on the driveway/living room, No matter what I tried, I could only get one or the other to light(with the eagle eye A10 trigger),but not both...when I use the palm pad(A10_macro trigger) from the location of the eagle eye, both macros run as programmed
Title: Re: Running two macros with one trigger
Post by: steven r on October 11, 2008, 07:18:42 PM
...Does the first macro include a condition?
...I have different time ranges for the different lights....  [<---Macro Conditions]
So as Boiler suspected you've created an else macro with conditions. I'm also guessing that the conditions overlap.
Tell us what the time conditions are for each macro and maybe we can make a suggestion that will work. If conditions overlap, it may need to become a 3 or more part else macro setup.
BTW... My Welcome/Halloween macros use a similar approach so I have some ideas already. e.g. One macro and/or elses for each overlapping time period(s) plus a else macro for each unique time condition.

...Maybe the output of the eagle eye isn't enough for the CM15 to process multiple commands?...
You may also be dealing with a range issue. Best way to test that is to monitor activity to see if commands are getting to the CM15A.
Title: Re: Running two macros with one trigger
Post by: Boiler on October 11, 2008, 07:46:47 PM
Boiler, I spent a bit of time trying to find an answer.

What I found is: I can trigger 2 lights in the hallway with D1, I tried 3,but only 2 went on. Maybe the output of the eagle eye isn't enough for the CM15 to process multiple  commands?

I tried all kinds of conditions on the driveway/living room, No matter what I tried, I could only get one or the other to light(with the eagle eye A10 trigger),but not both...when I use the palm pad(A10_macro trigger) from the location of the eagle eye, both macros run as programmed

Well I was able to get 3 macros to execute from the same trigger using the "delay" hole in the macro execution -

Macro 1 (B5 ON)
Delay 1
Set A1 to 90%

Macro 2 (B5 ON)

Delay 1
Set A3 ON

Macro 3 (B5 ON)

Set A2 ON

Here's how it appears in Activity Monitor
Event    Date/Time                   Action          Data
0       10/11/2008 7:37:36 pm    Receive RF    A5 On
1       10/11/2008 7:37:37 pm    Macro          A2 (LM14a)
2       10/11/2008 7:37:37 pm    Macro          A On (LM14a)
3       10/11/2008 7:37:41 pm    Macro          A1 (LM465)
4       10/11/2008 7:37:41 pm    Macro          A Bright 100(LM465)
5       10/11/2008 7:37:41 pm    Macro          A Dim 10(LM465)
6       10/11/2008 7:37:42 pm    Macro          A3 (6383 B Stair)
7       10/11/2008 7:37:42 pm    Macro          A On (6383 B Stair)

The delays are the key here.  If I take the 1 second delay out of macro 1, macros 2 and 3 will not execute.  If I remove the delay from macro 2, macro 3 will not execute.

Things do appear rather stable in the above.  I've tried simple ON/Off commands, bright/dim, and extended codes.  Interesting, I've never exploited this before.

Thanks for the education,
Boiler
Title: Re: Running two macros with one trigger
Post by: steven r on October 11, 2008, 08:06:16 PM
Well I was able to get 3 macros to execute from the same trigger using the "delay" hole in the macro execution -

Macro 1 (B5 ON)
Delay 1
Set A1 to 90%

Macro 2 (B5 ON)

Delay 1
Set A3 ON

Macro 3 (B5 ON)

                                                        <---Boiler: Wouldn't you need a delay here also?
Set A2 ON
...
thejfk: As I noted above, this should work (thanks for the example above Boiler) but you're relying on a bug that could be fixed at anytime. Granted AHP bug fixes aren't currently an X10 priority and you're likely to be safe for sometime.
Title: Re: Running two macros with one trigger
Post by: thejfk on October 11, 2008, 08:28:09 PM
Thank You Boiler,
The one second delay fixed the issue and gave me the result I was looking for!

It wasn't so much that I needed that function,I just had to know the solution!...I guess I fit right in with the rest of you guys!  :)

Steven, Is my design of using A10 to trigger the driveway lights and a dummy module(B2)and a second macro triggered by B2,the better way to go!
Thanks again!
Title: Re: Running two macros with one trigger
Post by: Boiler on October 11, 2008, 08:31:18 PM
Steven,

To answer your question, a delay was not required in macro3 (I did find that curious).  Delays were required in macros 1 and 2.

Maybe something has been fixed already?
Title: Re: Running two macros with one trigger
Post by: steven r on October 11, 2008, 09:15:23 PM
...a delay was not required in macro3 (I did find that curious).  Delays were required in macros 1 and 2....
I wonder what, if anything, would happen if the last else had a delay.
So the the "Else Delay Macro Bug" appears to be an "execute this macro/else (regardless of conditions?) and then the next else". I'm assuming/hoping conditions on the next else are treated the same way. While a quirky form of "logic", at least it could turn out to be predictable. I'd hate to rely on a bug for my macro programing, however.  ;)

I'm still not sure using the bug would work for thejfk as I think he has time conditions for each macro. Are conditions of each macro/else branch tested for execution of that branch when the branch starts with a delay?  Also I suspect some of his times overlap and he'd need at least a 3 level macro else.
Title: Re: Running two macros with one trigger
Post by: Boiler on October 11, 2008, 09:46:57 PM
I wonder what, if anything, would happen if the last else had a delay.
So the the "Else Delay Macro Bug" appears to be an "execute this macro/else (regardless of conditions?) and then the next else". I'm assuming/hoping conditions on the next else are treated the same way. While a quirky form of "logic", at least it could turn out to be predictable. I'd hate to rely on a bug for my macro programing, however.  ;)

I'm still not sure using the bug would work for thejfk as I think he has time conditions for each macro. Are conditions of each macro/else branch tested for execution of that branch when the branch starts with a delay?  Also I suspect some of his times overlap and he'd need at least a 3 level macro else.

Steven,

I did try a delay in macro 3 - it had not effect.

Please understand that I am not promoting this as a programming approach.  My sum total testing this amounted to around 45 minutes - not much of a robustness test.  I was really just trying to duplicate what theJFK was seeing.  I had never seen this type of macro used before.
Title: Re: Running two macros with one trigger
Post by: thejfk on October 12, 2008, 02:22:32 AM
To clarify.
I wasn't trying to do anything fancy.
Macro 1: Driveway lights A2-A3 triggered by eagle eye A10 from dusk to dawn
Macro 2: living room lights triggered by A10 from 8:00pm to 11:00pm...
That's it!
Title: Re: Running two macros with one trigger
Post by: steven r on October 12, 2008, 03:29:02 AM
I have a Driveway light  (macro1)  triggered by an eagle eye(A10)
I set up a living room light  (macro 2)  triggered by the same(A10)...
...I set up another two macros (hallway/bedroom ) triggered by one eagle eye(D1) ...
...
Macro 1: Driveway lights A2-A3 triggered by eagle eye D1 from dusk to dawn
Macro 2: living room lights triggered by D2 from 8:00pm to 11:00pm...
Ok new problem. If you set your eagle eye for D1, it will also use address D2 as dusk / dawn detector.
I thought you had one eagle eye set for A10 to trigger Driveway light  (macro1) and living room light  (macro 2) and the other eagle eye set to D1 to trigger the two hallway and bedroom macros.

Title: Re: Running two macros with one trigger
Post by: thejfk on October 12, 2008, 10:41:07 AM
Yes Steven You are correct!
The driveway eagle eye is A10
Thanks

I modified my post
Title: Re: Running two macros with one trigger
Post by: steven r on October 12, 2008, 07:43:12 PM
...
Macro 1: Driveway lights A2-A3 triggered by eagle eye A10 from dusk to dawn
Macro 2: living room lights triggered by A10 from 8:00pm to 11:00pm...
...
Ok I'd recommend a macro (A10) with two elses. I'll leave the coding to you but basically you need to make 3 tests in this order.
Do NOT start any of them with a delay.
That should work as well as keep it simple.
Title: Re: Running two macros with one trigger
Post by: thejfk on October 12, 2008, 11:10:08 PM
Thanks Steven.
I set it up the way you suggested and it works fine,but I found another glitch(I'm sure you guys already know)
On the driveway lights only (skipping the else's and living room lights altogether)
I used 2 conditions..."after dusk AND before dawn" The activity monitor showed the A10 trigger but no activation of the A3-A4 lights.
When I changed to 1 condition "between dusk and dawn" everything works fine.
I switched back and forth several times to confirm this and every time I got the same result...apparently "after dusk and before dawn" is not the same as "between dusk and dawn"
Title: Re: Running two macros with one trigger
Post by: steven r on October 13, 2008, 12:59:12 AM
...apparently "after dusk and before dawn" is not the same as "between dusk and dawn"
I have to think it through each time. It helps if you realize AHP makes it's calculations based on a day being from 12:00:01am to 12:00:00pm so "after dusk and before dawn" never happens in the same day. Actually I'm not sure if midnight starts or ends the day but you get the idea. I stay away from using midnight in any of my timers.