X10 Community Forum

🖥️ActiveHome Pro => Plug-ins => Smart Macros => Topic started by: myron18 on July 22, 2007, 11:19:16 AM

Title: calling macro from a macro
Post by: myron18 on July 22, 2007, 11:19:16 AM
A number of times I've seen "Macros can't directly call another macro" or a similar type statement.  In Smart Macros, I've found that I can call another macro directly by clicking on "conditions" in the upper right column, then "Advanced functions". Drag "X10 Address Command" to the module area. This can directly trigger another macro`. I'm guessing that by including flags, and other conditions, this can enable nesting macros.
Title: Re: calling macro from a macro
Post by: steven r on July 22, 2007, 01:27:41 PM
Interesting! I haven't tried that approach. Most of us here use the "dummy module" approach to trigger the next module. Your idea maybe easier. Does it matter if the macro being called has conditions?
Title: Re: calling macro from a macro
Post by: Boiler on July 22, 2007, 02:00:16 PM
A number of times I've seen "Macros can't directly call another macro" or a similar type statement.  In Smart Macros, I've found that I can call another macro directly by clicking on "conditions" in the upper right column, then "Advanced functions". Drag "X10 Address Command" to the module area. This can directly trigger another macro`. I'm guessing that by including flags, and other conditions, this can enable nesting macros.

Could you have meant "Appliance Control" from the "advanced functions".  The "X10 Address Command" issues an address but does not issue an on or Off command - it won't trigger a macro.  After reading your post, I tried triggering a macro with the Appliance Control and it works.

Steven - This works with conditions as well.

Thank you myron18 - I've been using the dummy module technique for so long it's become second nature.  Never thought to try the Advanced command.  This will really clean up a lot of clutter in my setup.

Another shining example of a person not knowing that something can't be done - and doing it!
Title: Re: calling macro from a macro
Post by: steven r on July 22, 2007, 05:38:25 PM
....Another shining example of a person not knowing that something can't be done - and doing it!

At the risk of tempting the "If It Works, Don't Fix It Gods", I think I'll do a backup of my .ahx file, remove a few of my "dummy modules" and tempt Murphy.

Thanks again, myron18.
Title: Re: calling macro from a macro
Post by: Boiler on July 22, 2007, 05:54:07 PM
At the risk of tempting the "If It Works, Don't Fix It Gods", I think I'll do a backup of my .ahx file, remove a few of my "dummy modules" and tempt Murphy.

I know those Gods well.  They've kicked my but on numerous occasions.  I created a test file to check it out.  I'm not ready to begin rewriting my whole system.  It'll take some time probably some courage from an aluminum can before I get there.

Let me know how things work out.
Title: Re: calling macro from a macro
Post by: steven r on July 22, 2007, 08:15:35 PM
Removing all my dummy variables turned out to relatively painless. As long as I matched the ONs to the ONs and the OFFs to the OFFs, I should be in good shape.  ;)

I was dreading that I might delete a dummy variable and still have a macro trying to call it. Fortunately the process was made easier by something X10 did right with the AHP software. As I went to delete a dummy variable, it would list all the macros that had it in it and ask if I really wanted to delete it.

Well off to see if it worked.
Title: Re: calling macro from a macro
Post by: myron18 on July 22, 2007, 10:42:42 PM
When I initially tried the "X10 Address Command" to trigger a macro, it worked. I was playing around with options for triggering, and am not sure whether I unintentionally wrote a second parallel trigger. When I have time, I'll try it again.
Title: Re: calling macro from a macro
Post by: steven r on July 22, 2007, 11:41:37 PM
When I initially tried the "X10 Address Command" to trigger a macro, it worked....
If you had created an address like "M1" followed by turning off another "M" module e.g. "M3 Off" for example, you would of effective done an M1 and M3 off. The "M1" piggybacks with the next command. Maybe that's what happened.
Anyway thanks for leading us down the path of discovery.
Title: Re: calling macro from a macro
Post by: steven r on July 23, 2007, 03:54:25 PM
Appliance Control Bug?

I may of stumbled into a bug using the Appliance Control option. I'm testing it now but it appears, in some cases, to be saving an ON command even if you program an OFF.

I'm still working on a specific example but I definitely have macros where I have programed "Appliance Control OFF" and had a macro report display it "Appliance Control ON". It hasn't happened every time but may be happening more often when there already is a macro with an "Appliance Control ON" programed.

So don't jump into using this option to start a macro that you wish to be triggered by an off command.
Title: Re: calling macro from a macro
Post by: Boiler on July 23, 2007, 05:05:46 PM
I may of stumbled into a bug using the Appliance Control option. I'm testing it now but it appears, in some cases, to be saving an ON command even if you program an OFF.

Steven,
I confess I didn't try triggering an off macro before (only on). 

I just coded the following macros to check the off call.  Seems to work flawlessly (25 times).  My test lamp turns on and off reliably, and all the codes are verified in activity monitor and on my Testerlinc.  Everything is downloaded to the CM15a.  I've triggered with RF, Powerline, and clicking a M2 switch on within AHP. 

Quote
Main Macro (M2)
Trigger M2 On
Appliance Control M3 on
delay 10 sec
Appliance control M3 off

On Macro (M3)
Trigger M3 On
Module A12 On

Off Macro (M3)
Trigger M3 Off
Module A12 Off

I don't doubt for a second what you're seeing.  I'm a bit curious about the date code/firmware revision of your CM15a.  If you'd like to try my test file, let me know and I'll send it to you.


[TTA Edit: Formatted MACRO for visual impact.]
Title: Re: calling macro from a macro
Post by: Boiler on July 23, 2007, 05:19:56 PM
Update

Tried the same test file with macro M2 (main) stored in the PC.  Works fine for powerline commands.  Very flakey with RF (works ~ 60% of the time).


Main Macro (M2)
Trigger M2 On
Appliance Control M3 on
delay 10 sec
Appliance control M3 off

On Macro (M3)
Trigger M3 On
Module A12 On

Off Macro (M3)
Trigger M3 Off
Module A12 Off
Title: Re: calling macro from a macro
Post by: steven r on July 23, 2007, 05:50:27 PM
...I just coded the following macros to check the off call.  Seems to work flawlessly (25 times)....
The bug has nothing  to do with calling another macro. Once you get the Appliance OFF saved it works fine.

The problem I had was that I programed the appliance control to send a "P5 ON". Later in a different macro I programed an appliance control to send a "P5 OFF". After downloading the file to the CM15A, I did a macro report to find that the command that I wanted to be "P5 OFF" was saved as "P5 ON".

"P5 ON" triggers a macro that starts all my lights flashing. "P5 OFF" triggers a macro that then stops all the lights flashing. Needless to say the problem was immediately obvious when I went to test those macros and the lights continued to flash.

It's been awhile since I tried it but in the past, I've experienced problems setting up macro to trigger on an OFF if an ON already exits for that same House and Unit code, also.
Title: Re: calling macro from a macro
Post by: Boiler on July 23, 2007, 06:29:20 PM
The bug has nothing  to do with calling another macro. Once you get the Appliance OFF saved it works fine.

The problem I had was that I programed the appliance control to send a "P5 ON". Later in a different macro I programed an appliance control to send a "P5 OFF". After downloading the file to the CM15A, I did a macro report to find that the command that I wanted to be "P5 OFF" was saved as "P5 ON".

"P5 ON" triggers a macro that starts all my lights flashing. "P5 OFF" triggers a macro that then stops all the lights flashing. Needless to say the problem was immediately obvious when I went to test those macros and the lights continued to flash.

It's been awhile since I tried it but in the past, I've experienced problems setting up macro to trigger on an OFF if an ON already exits for that same House and Unit code, also.

I've never seen that.  You've just described my basic configuration.  I have 23 instances of ON and Off macros at the same address.  Many of these are accompanied by a hardware module on the same address.  Nary a problem.

What version of AHP are you using? 
Title: Re: calling macro from a macro
Post by: steven r on July 23, 2007, 07:01:00 PM
...What version of AHP are you using? 
3.204

I haven't been able to do a step by step recreate of the bug but I have a simplified .ahx file that shows it, if anyone wants to look at it.
e.g. I can clear my CM15A, upload the test file, download to the CM15A, run a macro report and there will be macros with "Appliance ON" commands where AHP clearly shows I've put an "Appliance OFF". Perhaps it was a glitch but since it happened in more that one place in my file and nothing else seems wrong, I suspect an elusive bug.
Title: Re: calling macro from a macro
Post by: Boiler on July 23, 2007, 07:25:32 PM
Steven,

I'd love to try your .AHX file.  I have 3 CM15a's of various vintage (although I can't see how this could be a CM15a problem).  And two different AHP installs.

Let me know.
Title: Re: calling macro from a macro
Post by: steven r on July 23, 2007, 08:00:06 PM
...I'd love to try your .AHX file....
I just emailed you a copy of it. Let me know if it works for you.
If I figure out how to post it for anyone that wants it, I will.
Title: Re: calling macro from a macro
Post by: tomh on July 23, 2007, 11:18:13 PM
Steven and Boiler,

     I noticed this posting which was similar to mine about the timer limitation.  I thought I had exhausted all the possibilities until I read this.  I make the perfect beta tester since I do seem to gravitate toward problems.  I'm a Ziggy with a dark cloud over my head.  I tested the Appliance Control method and I can link at least 4 macros.  I can initiate via the AHP software on the screen or my mini controller.  I have not tried initiating via RF or for any longer than what I am going to write down.  It may seem lengthy, but I can always tweak things at a later date.  I just happy this part works.  I have also learned that due to transmission speed, a few delays don't hurt overall.  So, here is my contribution:

Quote
Main Macro=M2
Radio=C2

Trigger M2 ON
Appliance Control C2 ON
Delay 5 seconds (radio plays here)
Appliance Control C2 OFF (radio goes off here)
Delay 2 seconds (just 'cause it seems to work)
Appliance Control M3 ON

Trigger M3 ON
Appliance Control C2 ON (radio plays again)
Delay 5 seconds
Appliance Control C2 OFF (radio goes off again)
Delay 2 seconds
Appliance Control M4 ON

Trigger M4 ON
Appliance Control C2 ON (radio plays some more)
Delay 5 seconds
Appliance Control C2 OFF (radio goes off again)
Delay 2 seconds
Appliance Control M5 ON

Trigger M5 ON
Appliance Control C2 ON (radio plays for the last time)
Delay 5 seconds
Appliance Control C2 OFF (radio goes off for the last time)
Delay 2 seconds
Appliance Control M2 OFF
Appliance Control M3 OFF
Appliance Control M4 OFF
Appliance Control M5 OFF

I figure in the last step it would be a good thing to turn everything off so I don't get stray signals turning things off and on.  Heck, it's a workaround, but it does work at this point.  I am going to try it for a longer period of time over the next week to see if I can break the 4.5 hour timer limit per Macro.  Oh, my Macros were M2 calling on M3, M3 calling on M4, and M4 calling on M5 for a total of 4 Macros.  I created all the Macros from the drop down function on the Menu Bar (Edit--->Create Macro) and the Advanced Functions drop down box.

tomh


[TTA Edit: Formatted MACRO for visual impact.]
Title: Re: calling macro from a macro
Post by: Boiler on July 23, 2007, 11:55:58 PM
Tom,
I can't explain it yet, but I've confirmed Steven's observations.  Using his setup, the applicance control OFF command appears as an On command in the Macro Status Report.  Executing the macro(s) does not produce an OFF command.

I've done some things similar to your example and they have functioned well.  Steven's setup doesn't work, and at the moment, I don't understand why.  If anything, he is far more cautious with his use of delays and flag clears than I have been.

Title: Re: calling macro from a macro
Post by: tomh on July 24, 2007, 12:12:23 AM
Boiler,

     How peculiar.  I decided to set up a series of Macros to turn my radio on around 7 p.m. or so tomorrow.  My commands are to turn OFF the Macros in the end just like my example, and lo and behold, my Macro report shows them as ON.  I also noticed that my delays which I set up for 4 1/2 hours show 4:16:00 on the report.  What's that all about???  I know that if I attempt to set up a timer for more than 4 1/2 hours per Macro, I get a pop up saying that 4 1/2 hours is the limit per Macro.  Roseanne Rosannadanna said it best, "if it's not one thing it's another!" 

tomh
Title: Re: calling macro from a macro
Post by: steven r on July 24, 2007, 02:01:51 AM
It's a relief that others do see the problem and that it's not just my computer.

My last couple tries have worked ok but I'm going to continue to follow any Appliance OFF commands with a macro report to verify till I can figure out what is causing the problem. I still suspect that it happens most when there already exists an ON command for the same HC.

One possible "work around fix" seems to be to set up an OFF with a different HC and then modify the code.
e.g. Set one with A1 OFF and download. Then go back and change the A1 to what you want it to be, say P5 OFF.

...I make the perfect beta tester since I do seem to gravitate toward problems.  I'm a Ziggy with a dark cloud over my head....
Murphy and I have a special bond. I too have a knack for finding the bugs that only seem to happen while standing on your head and rubbing your tummy with your tongue sticking out.
Title: Re: calling macro from a macro
Post by: TakeTheActive on July 24, 2007, 08:55:00 AM

...If I figure out how to post it for anyone that wants it, I will.

What about:


I'm sure many other members know how to do this (and thus 'could' have replied to you). And, not trusting my memory completely, I'd bet that there might even be similar instructions somewhere in an Archived post. ;)
Title: Re: calling macro from a macro
Post by: Boiler on July 25, 2007, 08:00:57 PM
Steven,
I'm now in total agreement-

Appliance Control Bug!

I was testing the theory -
The Appliance Module Control will allow you to insert a command (Say Appliance Module P4 off) without there actually being a hardware device or macro at address P4.  I theorized that AHP might get confused by the order in which things were created and was trying the following:

After a number of successes I closed AHP and re-opened.  Upon re-opening the state of the Appliance Module call had flipped from Off to ON.  Nothing else had changed.  In fact, the correct code was still in the CM15a and still operated properly.  AHP just got confused and reinterpreted the call as an ON.

As a side note, I've been trying the dimmable module control.  So far I haven't had any problems (using absolute On/Off calls to trigger macros).  Seems a bit weird using a dimmable module to call a macro, but that would be just one item on a long list of weird X10 workarounds.
Title: Re: calling macro from a macro
Post by: steven r on July 26, 2007, 12:30:59 AM
...After a number of successes I closed AHP and re-opened.  Upon re-opening the state of the Appliance Module call had flipped from Off to ON.  Nothing else had changed.  In fact, the correct code was still in the CM15a and still operated properly.  AHP just got confused and reinterpreted the call as an ON....
Just to clarify, was it your experience that in spite of the the appliance flipping from OFF to ON in the report, that the code still executed as an OFF? I believe for me that it executed as ON after it switched.
Title: Re: calling macro from a macro
Post by: Boiler on July 26, 2007, 07:32:11 AM
Just to clarify, was it your experience that in spite of the the appliance flipping from OFF to ON in the report, that the code still executed as an OFF? I believe for me that it executed as ON after it switched.

Sorry, that was a bit misleading. 

My experience mirrored yours.  When the Macro report indicated an ON (incorrectly) AHP would execute an ON after downloading to the CM15a. 

In the case above :

This isn't a CM15a problem - it's doing exactly what AHP is telling it to do.  With that in mind, we have a decent chance of getting AHP fixed.

So far I have not been able to create the problem using the Module control (dimmable)
Title: Re: calling macro from a macro
Post by: steven r on July 26, 2007, 10:54:02 AM
...This isn't a CM15a problem - it's doing exactly what AHP is telling it to do.  With that in mind, we have a decent chance of getting AHP fixed...
Thanks for your continued testing and documentation of this AHP software bug.

While in this case, I'd love to be wrong and see an update be released fixing all the known bugs (including another one I found), unfortunately I don't share your optimism of seeing X10 release an AHP software update anytime soon.
Title: Re: calling macro from a macro
Post by: steven r on July 27, 2007, 06:20:45 PM
Boiler has continued his postings at http://www.x10community.com/forums/index.php?topic=13097.0;topicseen.
Title: Re: calling macro from a macro
Post by: tomh on July 28, 2007, 10:23:14 AM
Steven & Boiler,

     I too still am having problems.  I establish the commands and close AHP.  I reopen AHP and the macro commands register as an opposite state.  I have been trying to get my macro to run greater than 4 hours and so far they haven't worked.  I even ended my last macro of the 3 with the command to turn the first one off after executing the entire operation.  I think it's the software that is confusing everything.  I can get things to work with shorter periods of time although I don't know what the outer limit would be as to where it stops working.  Something so simple, yet so difficult.

tomh
Title: Re: calling macro from a macro
Post by: Boiler on August 02, 2007, 10:37:03 PM
Tomh,

I decided to answer your post here since you had your macro posted in this thread...

O.K.,

     Days later I have come to the conclusion that I won't be able to get a consistently working macro like I want.  I have tinkered and played, scratched my head, stood on my head, and taken many a beverage break.  I got one macro to work in 5 or 6 attempts and it was set up to turn a radio on in about 18 hours.  Now, today my activity monitor showed that the signal was sent at the proper time, but the radio didn't come on.  It is in a reliable circuit.  Sometimes the activity monitor doesn't even show the signal as being sent.  It does seem to work if I keep the timing short, although I don't know what the upper limit is and that could take a lot of experimentation.  Does X10 monitor this site, because I called and explained the situation to which they gave me some advice.  I e-mailed them the next day to let them know the result and haven't heard from them since.

tomh

It sounds like you may be having multiple problems. 

First and foremost, are you still using the appliance module calls?  If so I would abandon them and revert to the tried and true dummy module call.  At least until someone can better define the problems with the appliance module.

Secondly, if activity monitor is showing the proper "On" command at the proper time, you may have a noise, absorption, or phase problem.  This could be tough to diagnose with an 18 hour macro running.  Can you identify any specific devices that would be operating at the same time?  Have you been having any problems communicating with other devices.

Last, the macro you posted can be re-triggered.  Re-triggering could cause your timers to be "reset" to the new trigger time resulting in a delayed on time for your Radio.  Try adding a flag condition to your macro to prevent this.


Trigger M2 ON and Flag1 Off
Set Flag 1
Appliance Control C2 ON
Delay 5 seconds (radio plays here)
Appliance Control C2 OFF (radio goes off here)
Delay 2 seconds (just 'cause it seems to work)
Appliance Control M3 ON

Trigger M5 ON
.
.

Appliance Control M5 OFF
Clear Flag1

Update us on your findings
The Boiler
Title: Re: calling macro from a macro
Post by: tomh on August 12, 2007, 09:34:32 PM
Boiler,

     I still don't get consistent results with the longer time periods.  I went back to the dummy module method. I shouldn't have noise problems since my system runs with very few problems throughout the year and at varying times.  I did add a flag set at the beginning and a flag clear at the end to prevent re-triggering.  I'm beginning to think this is not achievable with the current software.  I will keep trying though.

tomh