Please login or register.

Login with username, password and session length
Advanced search  

News:

The Buster PiX10Hub is here! Created by the Community, for the Community.:)% #:)

Author Topic: Macros calling Macros that set flags  (Read 8683 times)

Boiler

  • Guest
Macros calling Macros that set flags
« on: July 27, 2007, 05:43:32 PM »

I'm not sure if this is news to anyone, but I think I've learned something new (hard to tell some days - I've forgotten so much over the years).

I've been testing the "macros calling macros" using the "advanced function" with "module" and "appliance" control calls. 

This is a continuation of the thread Calling a macro from a macro.

Using Steven R's macro file that incorporates a looping macro, I expanded things a bit to check the Module and Appliance control functions.  After having several fits (cold beverage breaks) I constructed a macro using the tried and true dummy module call.  Unfortunately this didn't function either (another beverage break as a result). 

The macro I was tying was:

Macro 1 (P1)
Trigger on P1 on
Set P5 on {calls Macro P5 via dummy module}
.
.
Set P4 on {calls Macro P4 via dummy module}



Macro 5 (P5)
Trigger on P5 on
Set Flag 2
.
.



Macro 4 (P4)
Trigger if P4 on and Flag2 set
.
.
.


The problem with the above is that Macro 5 never sets the flag2.  I've tried this a number of different ways (delays, etc.) but, if the called macro tries to set a flag, it doesn't seem to work.

If I move the Flag 2 set function into macro1 everything works fine.

I've done some searches and haven't found this addressed so far.  Is this news to anyone aside from myself (maybe I've been taking too many breaks)?
« Last Edit: August 06, 2007, 06:23:33 PM by Boiler »
Logged

tomh

  • Full Member
  • ***
  • Helpful Post Rating: 1
  • Posts: 56
Re: Macros calling Macros that set flags
« Reply #1 on: August 02, 2007, 08:27:44 PM »

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
Logged

bronco

  • Full Member
  • ***
  • Helpful Post Rating: 3
  • Posts: 63
Re: Macros calling Macros that set flags
« Reply #2 on: September 26, 2007, 05:32:23 PM »

Also, you can't set a flag from a macro that is stored on the PC, such as one that contains "Video Recording Function"
I have had the best luck using two CM-15, one not hooked to the PC(downloaded and then disconnected USB) to handle Flags.
THe other one hooked (USB) to the PC to run Video functions.
When I tried using only one cm-15 and saving a separate macro for flags and the other for Video cmds, sometimes it worked but I think that the cm-15 processer is too slow to handle both reliablely.
Logged

spam4us

  • Sr. Member
  • ****
  • Helpful Post Rating: 3
  • Posts: 138
Re: Macros calling Macros that set flags
« Reply #3 on: September 27, 2007, 12:21:55 AM »

I am by no means the expert here but if you call the P4 macro from the P5 macro as I have it below, it should work.  I found out the hard way (thanks Puck & everyone else) that your Macro1 will not wait for macro5 to finish before it triggers Macro4.  So, macro4 takes off before macro5 has had a chance to execute.

One other thing I got burned on.....reset your flags each time you do a test.

Macro 1 (P1)
Trigger on P1 on
Set P5 on {calls Macro P5 via dummy module}
.
.


Macro 5 (P5)
Trigger on P5 on
Set Flag 2
Set P4 on {calls Macro P4 via dummy module}

.


Macro 4 (P4)
Trigger P4 on
If Flag2 set
.
.
.
Logged
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.