Please login or register.

Login with username, password and session length

Author Topic: Can a macro call another macro?  (Read 25420 times)

steven r

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 74
  • Posts: 2189
  • Halloween with X10
Can a macro call another macro?
« on: November 16, 2004, 10:47:46 AM »

The link
http://www.activehomepro.com/plugins/index.h
tml under "Flexible Triggers Start Your
Smart Macros" says:


There are many ways to start a Smart Macro.
Any of the following triggers can be used:

Motion Sensors
Remote Controls
Plug-in Controllers
Wireless Switches
Touch-Tone Controller
Timers
Other Macros

Does this mean a macro can call another
macro? If so how? I haven't figured out a
way yet.

If a macro could call or transfer to
another macro this would be a very useful
feature.
Logged
BVC let's me tell my camera where to go!
:) Murphy is my beta testing pal. He helps me find problems whether I like it or not. :)

X10 Pro

  • Hero Member
  • *****
  • Helpful Post Rating: 23
  • Posts: 1416
Re: Can a macro call another macro?
« Reply #1 on: November 16, 2004, 01:37:14 PM »

Unfortunately, you can't call a macro from
another macro. This is a mistake in the list,
and I'm having it corrected.
Logged

steven r

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 74
  • Posts: 2189
  • Halloween with X10
Re: Can a macro call another macro?
« Reply #2 on: November 16, 2004, 11:00:41 PM »

"Unfortunately, you can't call a macro from
another macro."

Is it not possible due to hardware
limitations or is it a programming
impossibility?
Logged
BVC let's me tell my camera where to go!
:) Murphy is my beta testing pal. He helps me find problems whether I like it or not. :)

donald mcmow

  • Hero Member
  • *****
  • Helpful Post Rating: 0
  • Posts: 306
Re: Can a macro call another macro?
« Reply #3 on: November 17, 2004, 10:23:52 AM »

I have to agree/disagree with everyone -
unless I am mistaken could you not have one
macro trigger(call) another macro? I would
imagine that as long as you mantained a
dummy module (the same address as the macro
trigger) would that not be the same as
executing another macro?
Logged

X10 Pro

  • Hero Member
  • *****
  • Helpful Post Rating: 23
  • Posts: 1416
Re: Can a macro call another macro?
« Reply #4 on: November 17, 2004, 12:38:10 PM »

It's not possible in the hardware to run a
macro from another macro.
Logged

steven r

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 74
  • Posts: 2189
  • Halloween with X10
Re: Can a macro call another macro?
« Reply #5 on: November 17, 2004, 09:00:01 PM »

"...I would  imagine that as long as you
maintained a dummy module (the same address
as the macro trigger) would that not be the
same as executing another macro?"

I thought of that idea also. My initial
test didn't work but I'm not sure I set the
dummy up correctly. Let us know if you
succeed.
Logged
BVC let's me tell my camera where to go!
:) Murphy is my beta testing pal. He helps me find problems whether I like it or not. :)

Scott T

  • Full Member
  • ***
  • Helpful Post Rating: 1
  • Posts: 28
Re: Can a macro call another macro?
« Reply #6 on: November 17, 2004, 09:36:43 PM »

Can I have two macros running at the same
time?
I have a 2 Dawn Simulator macros and each
are 1h 30m total.  I want one to trigger at
5:15a and another at 6:00a.  Will the stand-
alone CM15A handle both?


Logged

X10 Pro

  • Hero Member
  • *****
  • Helpful Post Rating: 23
  • Posts: 1416
Re: Can a macro call another macro?
« Reply #7 on: November 18, 2004, 12:44:40 PM »

Scott T: That should work fine. You can have
more than one macro (with delays) running at
the same time.
Logged

mike

  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 17
Re: Can a macro call another macro?
« Reply #8 on: November 19, 2004, 03:49:05 AM »

I've actually observed a SmartMacro
triggering another SmartMacro although I
can't confirm that the conditions on
the "called" SmartMacro were being
evaluated. The second Macro was triggred
when the first Macro turned on an appliance
module with the same house/unit code that
the second Macro was configured for an ON
trigger. It was inadvertent and puzzling at
first what was happening. It's on my list
of things to look into once I get a bunch
of other things sorted and working.

Mike
Logged

kevinw

  • Guest
Re: Can a macro call another macro?
« Reply #9 on: November 23, 2004, 03:41:30 PM »

Actually, it is possible for a macro to
trigger another macro.  This is dangerous
in that it can create infinite loops, but
it can be useful.

A macro that has executed at least 1 delay
can call another macro or itself.

You call another macro by sending its
trigger command.  One way to do this is to
define an appliance module in the software
with the same address as the macro
trigger.  This will make the command
available.

You can stop running macros by using
the 'Purge Delayed Macro Events' command
from the Tools menu in ActiveHome.

Macros that are called from other macros
can use conditions if the Smart Macros
plugin is installed.

There is a limit of 8 pending macros
running at once.

Conditions are checked when the macro is
called.  This is useful if you want to
check conditions during the middle of a
macro.

If you have a macro that calls other
macros, you are responsible to make sure
that macros don't call each other in an
infinite loop.

You can create interesting things using
this macro recursion like an infinitely
repeating timer.  For instance, if you
wanted to execute macro C4 every 5 minutes
you could do the following:

Macro C1 (Start Timer)
- Set Flag 1
- Delay 5 seconds
- Turn C3 On

Macro C2 (Stop Timer)
- Clear Flag 1

Macro C3 (Timer Macro)
If Flag 1 Then
- Turn C4 On
- Delay 5 minutes
- Turn C3 On

Macro C4 (This macro will be executed every
5 minutes indefinitely.  If C4 has
conditions, the conditions will be checked
every 5 minutes.)
Logged

bronco

  • Full Member
  • ***
  • Helpful Post Rating: 3
  • Posts: 63
Re: Can a macro call another macro?
« Reply #10 on: October 18, 2006, 08:53:13 PM »

I have simulated it by macro1 in AHP sending out a command(ex: appl mod) that is really a macro in my CM-11 which in turn sends the command to run the second macro2 in AHP.  It was more reliable that using the phantom and doing everything the AHP.
Logged

roadking

  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 14
Re: Can a macro call another macro?
« Reply #11 on: October 25, 2006, 09:34:19 AM »

"You can create interesting things using
this macro recursion like an infinitely
repeating timer.  For instance, if you
wanted to execute macro C4 every 5 minutes
you could do the following:

Macro C1 (Start Timer)
- Set Flag 1
- Delay 5 seconds
- Turn C3 On

Macro C2 (Stop Timer)
- Clear Flag 1

Macro C3 (Timer Macro)
If Flag 1 Then
- Turn C4 On
- Delay 5 minutes
- Turn C3 On

Macro C4 (This macro will be executed every
5 minutes indefinitely.  If C4 has
conditions, the conditions will be checked
every 5 minutes.)"



I have looked at this post several times and still cannot determine how to get a repeating macro.  I'm trying to get some lights to dim and brighten several times during our Halloween party.......

The post quoted above has macro c3 turning on macro c4 and itself.   Can someone post a picture showing how to do this?
Logged

ArtClark

  • Guest
Re: Can a macro call another macro?
« Reply #12 on: October 27, 2006, 02:50:02 AM »

Sorry, I'm not good with Pictures, but....   I'll Use the Printed steps and get a little "wordy" to try and help.
1) Create a new macro - Name it "Start Timer" - Set Trigger to "C1 On"
    Add Set/Clear Flags Device and Set Flag 1
    Add Delay and Set to 5 Seconds
    Add "C3 On" Command  (Here you can either drag "Phantom" Module C3 and turn it on or
                                       Use "Advanced Functions" - Appliance Module - Set to C3 On )

2) Create Another New Macro - Name it "Stop Timer" - Set Trigger to "C2 On"
    Add Set/Clear Flags Device and Clear Flag 1

3) Create Another New Macro - Name it "Timer" - Set Trigger to "C3 On"
    Show Conditions and add Condition "Flag Status" - Check for Flag 1 Set
    Now Add devices
    Add "C4 On" Command (Use same methods as Above,  Phantom or Advanced Function)
    Add Delay and set to 5 Minutes  (This is the "Timer Cycle" time.  Alter as needed.  This is not the "Function" time.
    Add "C3 On" Command (Again - Same Method as Above)

4) Create Another New Macro - Name it "Function" or whatever you want - Set Trigger to "C4 On"
    Add Commands and delays as desired to turn on or off anything.  Use your imagination but be sure to insert some
    delays between commands so as to not confuse things.
    IMPORTANT:  The total time of this macro SHOULD NOT be equal or greater than the time set in Macro C3.  If it were, you would start to pile up work for the interface.  Eventually, all would be bad........

Hope this helped......
Logged
 

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