Please login or register.

Login with username, password and session length

Author Topic: Smart macros making a dummy out of me  (Read 7572 times)

spam4us

  • Hero Member
  • *****
  • Helpful Post Rating: 3
  • Posts: 152
Smart macros making a dummy out of me
« on: September 22, 2007, 03:39:38 PM »

I have read many many post concerning smart macros, flags, dummy/phantom modules.. but I just can't get this to work.

F1,2,3,4 are floodlights
"L" is the monitored house code
L5 On = it;s OK to turn on the light
L6 On = it's OK to sound the chime
L11 On = security system armed Away From Home status
L12 On = security system armed At Home status
L11 & L12 are never on at the same time but can both be Off at the same time
D9 is the trigger for sound Chime Macro
D16 is the trigger for the Light Disposition Macro. to see it the light should be turned off or not)
All of the above are defined as appliance modules.
E1 is an Active Eye.  I intend to have an E2, E3, E4 Active Eyes each controlling floodlight F2, F3, F4 respectively. They will all need to do the Flood Light light disposition and sound chime macro.
Flags are used to prevent the Macro from executing if another trigger is received and the macro is still running.

Trigger E1 ON (Active Eye On)
   If L5 ON And Flag2 Off  (L5 on = light OK to turn on)
      Delay 1 sec.
      Set Flag2 On
      Turn on Driveway Flood (F1) (turn the light on)
      Set Flag2 Off
   Else
   Delay 1 Sec
   Set D9 On (trigger the Sound Chimes Macro)
   Set D16 On (trigger floodlight disposition Macro)

Trigger D16 On (floodlight disposition macro. This macro will either turn the light off or leave it on. This macro checks the status of the security system. If it is armed away from home L11 on, do the following)   
Trigger D16 On
   If Alarm On Away From Home (L11 On) And  Flag13 Off
      Delay 1 sec.
      Set Flag13 on
      Turn On Inside House lights H1, H2
      Delay 1 minute
      Turn Off All Floods (F1, F2, F3, F4)
      Delay 30 seconds
      Turn Inside House Lights Off H1, H2
      Set Flag13 off
      Set D16 Off
   Else (if the security system is armed at home (L12 on, do this)
   If  Alarm Armed At Home (L12 On) and Flag14 Off
      Delay 1 sec
      Set Flag14 On
      Delay 1 minute
      Turn Off All Floods (F1, F2, F3, F4, F5, F6)
      Set Flag14 Off
      Set D16 Off
   Else (If neither armed away nor armed at home, or not armed at all, do this)
   Delay1
   Set D16 Off (turn the Floodlight disposition macro trigger off)

Trigger D9 On (Sound Chimes Macro L6 On means that it is OK to sound the chime)   
   If L6 On And Flag12 Off (L6 on = OK to sound the chime)
      Set Flag12 On
      Sound Chimes (n9, N10, N11)
      Set Flag12 Off
      Set D9 Off
   Else
      Delay 1 sec
      Set D9 Off (turn off the Sound Chime trigger)

Before I run the E1 On macro, I make sure the the Alarm is set to only one of the following
L11 on or L12 On  Which ever is on I have the other turned off before I run the E1 On macro.
I have the Lights OK to turn on Dummy module (L5 On)
I have the Chimes OK to turn sound Dummy module (L6 On)

When I run it on the PC, all is fine.
If I run it on the interface, it doesn't work correctly or the same each time.  Either the Chimes do not sound or the floodlight doesn't turn off.  I can see the D9 On in  the Activity Monitor and I can also see the D16 ON but only the D16 floodlight disposition macro gets ran.

Any help is appreciated.

Thanks

Logged

Puck

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 171
  • Posts: 1799
Re: Smart macros making a dummy out of me
« Reply #1 on: September 22, 2007, 07:58:31 PM »

spam4us: The first thing I recommend is to NOT start a macro with a delay if the trigger for that macro is used more than once via an else. This can cause macros to not execute as logically intended.

If a delay is required, set or clear flags or even turn a dummy module ON or OFF before the delay.

Quote
      Delay 1 sec.
      Set Flag2 On
      Turn on Driveway Flood (F1) (turn the light on)
      Set Flag2 Off
 

This should be as follows for 2 reasons: 1) No delay to start & 2) the flag will be more effective at preventing re-entry.

      Set Flag2 On
      Delay 1 sec.
      Turn on Driveway Flood (F1) (turn the light on)
      Set Flag2 Off
 
Also, make sure that it is not possible for any combination of actual conditions to satisfy more than one macro with the same trigger.

Example:

Quote
  Else
      Delay 1 sec
      Set D9 Off (turn off the Sound Chime trigger)

The else should have a condition that distinguishes it from the other alternatives.

Quote
   Set D9 On (trigger the Sound Chimes Macro)
   Set D16 On (trigger floodlight disposition Macro)

In order for this to run reliably, you need to put a delay between each step. The delay needs to be long enough to allow the 1st step to complete. AHP does not wait for a subroutine call to execute before it continues on... it just calls it and moves on; what gets executed is not always predictable nor reliable.

To sum up my recommendations:

1) Don't start with a delay
2) Give all your macros a unique condition
3) Add appropriate delays between sub-macro calls
« Last Edit: September 22, 2007, 09:46:06 PM by Puck »
Logged

TakeTheActive

  • Hero Member
  • *****
  • Helpful Post Rating: 126
  • Posts: 1047
  • Old !@#$% Tinkerer!
Don't Forget About the "BASE +1" Rule!
« Reply #2 on: September 23, 2007, 07:35:07 AM »


...E1 is an Active Eye.  I intend to have an E2, E3, E4 Active Eyes each controlling floodlight F2, F3, F4 respectively...

Don't forget about the "DARK" photosensor in each motion sensor - you'll need to skip 1 UnitCode -> E1, E3, E5, E7...
« Last Edit: September 23, 2007, 07:37:32 AM by TakeTheActive »
Logged
Low Post Count != Low Knowledge - High Post Count != High Knowledge ;)

ADVICE TO X-10 NEWBIES FROM AN X-10 OLD-TIMER

Puck

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 171
  • Posts: 1799
Re: Don't Forget About the "BASE +1" Rule!
« Reply #3 on: September 23, 2007, 10:27:30 AM »


...E1 is an Active Eye.  I intend to have an E2, E3, E4 Active Eyes each controlling floodlight F2, F3, F4 respectively...

Don't forget about the "DARK" photosensor in each motion sensor - you'll need to skip 1 UnitCode -> E1, E3, E5, E7...

The ActiveEye is the only sensor that can turn this feature on or off; but still a good idea. You never know when you may want to use it or you might forget to turn the feature off.
Logged

spam4us

  • Hero Member
  • *****
  • Helpful Post Rating: 3
  • Posts: 152
Re: Smart macros making a dummy out of me
« Reply #4 on: September 24, 2007, 01:58:11 AM »

Puck &TakeTheActive   Thanks for the replies.  I won't forget about the +1 feature.  I redid my macros so that I only had one true statement if there were else statements.  I thought that by putting a delay at the beginning of each Macro would force the else to act as an AND.  Is this correct?  If it is, do all of the true conditions try to execute at the same time?

Example:
trigger e1 on
  If a is true
    delay 1 sec
     Set B1 On
  Else
   If B is true
    delay 1 sec
    Set B2 On
  Else
   If C is true
    delay 1 sec
    Set B3 On

In the above example, I thought I read that the delay would force the execution of the next else even if the preceding one was true.  In other words, if a is true and b is false and c is true, than the result of the above macro would be B1 & B3 being set on On.  Is this correct?
 
Well after a trying weekend, I have found out the following.

If you run your macros from the interface, each time you make a change, you have to Download Timers and Macros back into the interface. OK, I understand that.


     I have some dummy/phantom modules that I use for various actions(switches) in my macros. These modules are all on the monitored house code.   An example would be a dummy module to see if it's OK to turn the lights on and another to see if it's OK to sound a chime. If the dummy light module is on, turn on the light.  If the dummy chime module is on, sound the chime.  If off, take no action.

     Here's where the problem comes in.
If you change a dummy module by clicking on it in ActiveHome Pro from Off to On or On to Off, the interface doesn't see the change right away.  I've triggered my macros and they weren't recognizing the correct status of the dummy modules.   I went thru many hours of frustration.  I then went and plugged in a mini controller, set it to the monitored house code and turned the dummy modules on and off from the mini controller instead of thru ActiveHome Pro.

     It stopped raining, the clouds cleared, the water parted, an the sun came out. ALL MY MACROS WORK LIKE THEY ARE SUPPOSED TO.

     Now here are my questions.
1. Is the above a true observation or not?

2. If you are running a combination of macros that run from the PC and others that run from the interface, what type of interaction can I expect with the interface recognizing a change that was made to a monitored module by a macro that is running on the PC and the other way around?

I'm not expecting anyone to test this for me.  I was hoping that someone has already experienced this.

thanks
Logged

Puck

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 171
  • Posts: 1799
Re: Smart macros making a dummy out of me
« Reply #5 on: September 24, 2007, 10:05:24 AM »

spam4us: Welcome to the wonderful world of ELSEs.  :D

Quote
If you change a dummy module by clicking on it in ActiveHome Pro from Off to On or On to Off, the interface doesn't see the change right away.  I've triggered my macros and they weren't recognizing the correct status of the dummy modules.   I went thru many hours of frustration.  I then went and plugged in a mini controller, set it to the monitored house code and turned the dummy modules on and off from the mini controller instead of thru ActiveHome Pro.

Quote
Is the above a true observation or not?

I have found that PLC macro triggers always properly trigger & execute; RF and AHP dummy calls mostly do but sometimes when all seems fine they don't. Whether these methods are a higher burden on the CM15A and/or AHP, if it's the interaction between the CM15A and the PC or if it's certain conditions that cause this. So all observations are true; recognize what works and what doesn't to improve you own macros.


The million dollar question:

Quote
If you are running a combination of macros that run from the PC and others that run from the interface, what type of interaction can I expect with the interface recognizing a change that was made to a monitored module by a macro that is running on the PC and the other way around?

I have never had much luck with reliability when using monitored house codes in my conditions, but others have. Others have problem with flags interaction between CM15A & PC executed macro, and I haven't. It seems that so many little variables can effect how a macro executes and there can be variants between how they execute for different set ups (and lets not forget all the different CM15A firmware date codes).

Since starting an macro with a delay can cause undesigned reactions, I recommend avoiding that for reliability purposes. They do tend to act as an AND and all macros try to execute at once; so if you were to use it that way and it works for you, then stagger your delays so all don't execute at once.

Avoiding this and ensuring unique conditions per macro is my suggestion. Make sure only one gets executed and it does all that you want it to do. I haven't seen a limit on the number of elses yet, and I have use ones that were 16 deep with no problems.

Experiment to see what works best, and let us know what your final macros are like.
Logged
 

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