X10 Community Forum

🖥️ActiveHome Pro => Plug-ins => Smart Macros => Topic started by: Gilbert on September 03, 2007, 04:15:48 PM

Title: MS16a and 3 different macros / tasks
Post by: Gilbert on September 03, 2007, 04:15:48 PM
Hello,

I've AHP, smartmacros and different active-eye sensors and I want to manage this :

from 7am to 8pm, if the sensor is triggered, send an e-mail and chime,
from 8pm to midnight, activate the porch light,
from midnight to 7am, activate the big (anti-theft) light.

I've tried different ways to program it : timers and macros but the result is never accurate :

three different macros, with the same trigger (E1), but each macro has a separate condition (E1 is the address of the active-eye):

Triger condition E1 is ON and
the time is between 7:01 AM and 8:00 PM
end Trigger conditions
wait 5 seconds
... (next sequences)

Triger condition E1 is ON and
the time is between 8:01 PM and 00:00 AM
end Trigger conditions
wait 5 seconds
... (next sequences)

Triger condition E1 is ON and
the time is between 00:01 AM and 7:00 AM
end Trigger conditions
wait 5 seconds
... (next sequences)

------------------
Results : I receive sometimes the result on false hours, sometimes together...

Do you have any idea of this problem ?
Regards,
Gilbert

Title: Re: MS16a and 3 different macros / tasks
Post by: Puck on September 03, 2007, 07:17:31 PM
When using ELSEs, never start a macro with a delay.
Title: Re: MS16a and 3 different macros / tasks
Post by: Gilbert on September 04, 2007, 01:47:56 AM
When using ELSEs, never start a macro with a delay.


Hu, I don't use else's here, just some delay and one condition (time between). But thank you for the info.
Title: Re: MS16a and 3 different macros / tasks
Post by: Puck on September 04, 2007, 08:56:29 AM
Triger condition E1 is ON and
the time is between 7:01 AM and 8:00 PM
end Trigger conditions
wait 5 seconds
... (next sequences)

Triger condition E1 is ON and
the time is between 8:01 PM and 00:00 AM
end Trigger conditions
wait 5 seconds
... (next sequences)

Triger condition E1 is ON and
the time is between 00:01 AM and 7:00 AM
end Trigger conditions
wait 5 seconds
... (next sequences)

When you have 3 macros that are all triggered by the same E1 ON, ELSEs are involved even if you didn't click on the ELSE button while writing the macros. ;)
Title: Re: MS16a and 3 different macros / tasks
Post by: steven r on September 04, 2007, 12:08:14 PM
...When you have 3 macros that are all triggered by the same E1 ON, ELSEs are involved even if you didn't click on the ELSE button while writing the macros. ;)
Gilbert: I recommend rewriting it with elses. I believe it will work then.

Puck: Are you saying if I had two macros using the same addresses one would act as an else to the other? Any logical way to determine which would be executed 1st and what what would happen if their conditions overlapped.
Title: Re: MS16a and 3 different macros / tasks
Post by: Puck on September 04, 2007, 12:25:58 PM
[Puck: Are you saying if I had two macros using the same addresses one would act as an else to the other? Any logical way to determine which would be executed 1st and what what would happen if their conditions overlapped.

When editing a macro, if you enter an X10 trigger address that already exists for another macro, it will appear as an else to its predecessor. When this happens you will immediately see the cascading macro tabs at the top of the editor screen. The order of the tabs from left to right is the else order.

This is how elses can be created without physically clicking on the add else button.

Because AHP else statements do not execute as a true else (as most programmers are familiar with), for reliability, you must make sure that it is not possible for more than one set of conditions to be true throughout the else string of macros. I also found that if any macro in an else starts with a delay, AHP tends to treat the ELSE as an AND.
Title: Re: MS16a and 3 different macros / tasks
Post by: Boiler on September 04, 2007, 05:27:41 PM
When editing a macro, if you enter an X10 trigger address that already exists for another macro, it will appear as an else to its predecessor. When this happens you will immediately see the cascading macro tabs at the top of the editor screen. The order of the tabs from left to right is the else order.

This is how elses can be created without physically clicking on the add else button.

Thank you Puck,
That little tidbit simplifies my life greatly.  I'm one of those "anal" types that writes everything out longhand before diving into the AHP interface.  I never knew that adding a second trigger automatically created an else statement.  I've been writing these out and painstakingly checking all my If's and else's.

Just tried this and it works like a charm.  Maybe it's me, but this method of adding an Else statement results in significantly less Brain Pain.

Thanks again,
Boiler
Title: Re: MS16a and 3 different macros / tasks
Post by: TakeTheActive on September 04, 2007, 09:46:40 PM

When editing a macro, if you enter an X10 trigger address that already exists for another macro, it will appear as an ELSE to its predecessor. When this happens you will immediately see the Cascading Macro Tabs at the top of the editor screen. The order of the Tabs from left to right is the ELSE order.

Thank you Puck,

That little tidbit simplifies my life greatly...

...Just tried this and it works like a charm.  Maybe it's me, but this method of adding an ELSE statement results in significantly less Brain Pain.

Boiler,

Without a dedicated TEAM of ACTIVE Community Organizers, what will keep this very useful " tidbit " from floating off into the "Corkboard Ether" (...just a collection of random facts, scattered in random replies, across random threads...) just like its predecessors? ??? :( :-[

Suggestions?

[Or, maybe BXVC -Bill- will simply (unjustly, IMHO) CENSOR me again for publicly speaking the truth regarding my ongoing dissatisfaction with what's been going on "Behind the Scenes" here, since multiple PMs to various Community Organizers proved futile...  :( :o >:( ]
Title: Re: MS16a and 3 different macros / tasks
Post by: Boiler on September 05, 2007, 12:03:31 AM
Quote
Boiler,

Without a dedicated TEAM of ACTIVE Community Organizers, what will keep this very useful " tidbit " from floating off into the "Corkboard Ether" (...just a collection of random facts, scattered in random replies, across random threads...) just like its predecessors? ??? :( :-[

Suggestions?

[Or, maybe BXVC -Bill- will simply (unjustly, IMHO) CENSOR me again for publicly speaking the truth regarding my ongoing dissatisfaction with what's been going on "Behind the Scenes" here, since multiple PMs to various Community Organizers proved futile...  :( :o >:( ]

TTA,
I share some of your frustration.  The forum contains a wealth of information an knowledge.  However this information is difficult to access and "we" Oldtimers and Co's alike are guilty of the following:


Don't get me wrong, I plead guilty to most of the above.  I will try to change my ways.

At the same time, we are faced with a number of "new" modules that are rewriting the way we use AHP.  This should be a HUGE BANNER presented on entry to the forum.  We've already had many users (both new and old) that have had problems with these units (and these are only the registered users - who knows how many users we've lost). 

We've recently been called egomaniacs and other names on a couple of threads.  I don't believe that for a second.  I do believe that many of our forum visitors get extremely frustrated trying to organize and make sense out of the scattered information on the forum. 

BTW - I chose this forum several months ago because it seemed to be the only "active" and "relevant" forum.  I still believe that to be the case.  Nonetheless, we really need to step things up (CO's and regulars alike).

TTA - of the above, the only thing that I see as objectionable is your last comment aimed at BXVC -Bill.  I read your original post, but I can't honestly say that I remember the "censored" section.  Nonetheless, based on what I've seen, I trust Bill to do the right thing according to the forum Etiquette rules (I believe you helped write these).

PM's and Thread replies welcomed,
Boiler

Title: Re: MS16a and 3 different macros / tasks
Post by: Tuicemen on September 05, 2007, 12:59:23 PM

Without a dedicated TEAM of ACTIVE Community Organizers, what will keep this very useful " tidbit " from floating off into the "Corkboard Ether" (...just a collection of random facts, scattered in random replies, across random threads...) just like its predecessors? ??? :( :-[

Suggestions?

Actually this is why I created the "Helpful Tips and Suggestions" threads for each of the Plug-ins!

In these I requested help from other COs as well as users to keep these "tidbits" from getting buried in a sea of questions or creating a Sea of stickies!
To Date: No other CO   has added a link, ??? ::) although some have: split the topics, or made some modifications to the threads without adding any Value to the thread!
Note: This tidbit is now linked from Topic: Helpful Hints and Suggestions (Smart Macros)  (Read 5331 times)    (http://www.x10community.com/forums/index.php?topic=8207.new;topicseen#new)
Title: Re: MS16a and 3 different macros / tasks
Post by: HA Dave on September 05, 2007, 09:28:15 PM
Puck  thank you for such great and HELPFUL information! (And congratulations... as I see your nearing the record on helpfuls)

And despite what others may say fear not.. your post will not be lost. The very words contained in the post serve as meta-tags, and will allow for searchable results by future users.

Data is accumulating in such large volumes that humans will never be able to keep it properly categorized and organized. Thank God (and Bill Gates) that we have computers to sort through these mountains of posts for us.

Fortunately... this is a Community forum. Our concern for the other members... (not the information)... is at the very heart of the Community.
Title: Re: MS16a and 3 different macros / tasks - (timer for switches not for macros ?)
Post by: Gilbert on September 22, 2007, 10:11:52 PM
I tried different ways to do my job.

Now, it works with 3 dummies :
one switch (transceiver appliance with poll) ON from 6am to 8pm (timer set),
one switch (transceiver appliance with poll) ON from 8pm to 0am (timer set),
one switch (transceiver appliance with poll) ON from 0am to 6am (timer set).

and it works perfectly if I create my 3 macros with switch state check (E1 is the ws16 and macro address):

Trigger Conditions E1 ON and
Module Status ON - DUMMY 06-20
END Trigger Conditions
... (next steps)...

Trigger Conditions E1 ON and
Module Status ON - DUMMY 20-00
END Trigger Conditions
... (next steps)...

Trigger Conditions E1 ON and
Module Status ON - DUMMY 00-06
END Trigger Conditions
... (next steps)...

BUT, why the simple option of setting a timer into the macro doesn't work ? That's why timer are made for, no ?

Like :

Trigger Conditions E1 ON and
Time is between 00 am and 06 am
END Trigger Conditions
... (activation of switches)...

I understand the idea of dummies and flags, but is the timer function working only for devices and not for macro's ? If I put timers with devices, all is OK, but never with macros. If the answer is NO TIMERS inside MACROS, why this option is available ?

BTW, may I use any ghost switch for dummies or should I use switches with poll function (and then, what's the use of that poll feature) ?

BTW 2 (...) : what can I do to avoid multiple runs (within seconds) with that macro when the ws16a is detecting someone ? Use flags to delay the different steps or for blocking multiple runs ? Or should I change the delay inside the ws16 ?
The idea is to run the macro only once in between 5 minutes.

Thank you
Gilbert

Title: Re: MS16a and 3 different macros / tasks
Post by: svcguy on August 12, 2008, 01:06:23 AM

Because AHP else statements do not execute as a true else (as most programmers are familiar with), for reliability, you must make sure that it is not possible for more than one set of conditions to be true throughout the else string of macros. I also found that if any macro in an else starts with a delay, AHP tends to treat the ELSE as an AND.


Not to bring up an old thread (>*<), but what if I *DID* want all three conditions to be checked?  Should I use a delay first.  My scenario is this:

MS16 - set to H5
Camera - set to J1
Chime - set to K1
Socket Rockets (2) - set to D5

When the H5 triggers, I want the lights at D5 to come on *always*, my record J1 macro to start *always* and my chime K1 macro to start only between 8:00am and 10:00pm.  In that order.

My record J1 macro goes like this

Condition:  Flag 1 is OFF
  Turn Flag 1 ON
  Select Camera J1
  Take Snapshot
  Begin Recording
  Delay 20 sec.
  Stop Recording
  Turn OFF J1
  Delay 2 min ( to finalize recording, else sometimes AHP crashes)
  Turn Flag 1 OFF

My Chime K1 macro goes like this:

Condition Flag 2 OFF
  Turn Flag 2 ON
  Chime K1
  Delay 30 sec
  Turn Flag 2 OFF

So, just do I add a delay (5 sec) to the start of each macro to get them all to start? ???

Thanks,
Andy
Title: Re: MS16a and 3 different macros / tasks
Post by: Puck on August 12, 2008, 09:17:43 AM
svcguy: For your example I suggest simply creating an ELSE macro with the two separate scenarios and the time conditions to determine which one executes. The leading delay in a macro and its tendency to execute all macros is a software bug and although it may work and do what you want, it may lower the the reliability of your setup. So whenever there is a more stable way of performing an action, it would be best to take that route. Plus you never know when an update may come out and this bug gets fixed.  ::)
Title: Re: MS16a and 3 different macros / tasks
Post by: svcguy on August 13, 2008, 08:57:57 PM
Puck, I like your idea and am going to try it out.  I did, however, come up with another solution. 

I created a master macro Back Motion ON triggered by H5 ON:
D5 ON                         //  Turn Back Porch Lights ON
Delay 5s                       //  Delay required or else it doesn't function properly
M2 ON                         //  Dummy module (2-pin appliance) that triggers Back Door Chime Macro
Delay 5s                       //  Delay required (see above)
M3 ON                         //  Dummy module (2-pin appliance) that triggers Record Back Door Macro

and Back Motion OFF triggered by H5 OFF
D5 OFF                        //  Turn Lights OFF
M2 OFF                        //  Housekeeping; not really needed
M3 OFF                        //  Housekeeping; not really needed


This way my tested and working Back Door Chime and Record Back Door Macros can be left intact.  For whatever reason, without a delay it didn't quite work properly.  It seemed that it tried to do everything at once resulting in M3 turning on before M2 ( ??? ), and the Back Door Chime Macro never firing.

We will see.  They work and I'll field test them in the coming days to see if they hold up.

Andy
Title: Re: MS16a and 3 different macros / tasks
Post by: SteveRF on August 23, 2008, 01:38:15 PM
SvcGuy,
I was wondering... Do you activate light and recording after dark only ?
Do you record at anytime before dark ?
My X10 cams (B&W and Color) really suck after dark, even with a light....
I have one set up on an X10 motion controller to monitor the pool but I woudl be hard pressed to identify the face.
The quality is just not there....

Steve
Perdido Beach, AL