Please login or register.

Login with username, password and session length

Author Topic: Macro stopping a macro  (Read 6585 times)


  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 10
Macro stopping a macro
« on: August 21, 2006, 12:35:52 AM »

Is it possible for a macro to stop the execution of another macro? ???

Example: In a macro, a delay of 90 minutes is set for a lamp to go off. During this period of time, I change my mind and want to let the lamp ON, and start another macro which have another behavior with the lamp. How can I stop the first macro running?

Also: If I press three times the A1 button on my remote, which trig a macro (the macro have a short delay), will the "extra" command stay in memory and be executed later? I'm asking this one in case of some impatient user (i.e. my wife::)) didn't see nothing and push the button many times before something happen... ;)

Martin.  ;D

steven r

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 74
  • Posts: 2189
  • Halloween with X10
Re: Macro stopping a macro
« Reply #1 on: August 21, 2006, 11:56:14 AM »

In theory there is no limit to the number of concurrent macros that can be run as well as no way to stop a running macro short of purging all macros from AHP.

There are some tricks you can do with flags, however. Here's an example that might help you.

  • Start by defining a dummy module M2
  • Then build a macro to trigger on "M1 ON" with these steps.
    • Is flag 1 set?          Only executes macro if its not already being used
    • Set flag 1
    • Set flag 2
    • Delay 90 minutes
    • M2 on
  • Then build a macro to trigger on "M2 ON" with these steps.
    • Is flag 2 set?          Only executes macro if flag is set.
    • Turn off lights
    • Clear flags 1 & 2
  • Then build a macro to trigger on "M1 OFF" with these steps.
    • Clear flags 1 & 2

The above may need a bit of tweeking but basically it should work. (Some don't like to use HC "M" but I like it because I can remember M for macro. I've also never had any problems with using it myself.)

Ok here's what happens...
A press of the button starts macro M1 ON. Once started the test for flag 1 prevents it from being started again. After 90 minutes M1 ON turns on module M2 which in turn starts the M2 ON macro. (A macro can't call another macro but it can trigger a module that in turn does. This is why the dummy module must be defined.) If at any time you decide you don't want M2 ON macro to be executed, running M1 OFF will clear flag 2 and stop it.

Note: The above is not perfect. e.g. If you started the timer by pressing M1 ON at say 9:00 pm and then changed your mind at 9:30 pm and pressed M1 OFF and then at say 10:00 pm pressed M1 ON again, you would have two timers running. The first to finish, the one you started at 9:00 pm, would take priority and it's lights out at 10:30 pm. (9:00 pm + 90 minutes.)
« Last Edit: August 21, 2006, 12:14:26 PM by steven r »
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. :) | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 All rights reserved.