X10 Community Forum

🖥️ActiveHome Pro => Plug-ins => Smart Macros => Topic started by: yvanmarl on August 21, 2006, 12:35:52 AM

Title: Macro stopping a macro
Post by: yvanmarl 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
Title: Re: Macro stopping a macro
Post by: steven r 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.


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.)