Please login or register.

Login with username, password and session length

Author Topic: AHP flag bug  (Read 5860 times)

pomonabill221

  • Hero Member
  • *****
  • Helpful Post Rating: 13
  • Posts: 239
AHP flag bug
« on: July 11, 2012, 03:12:50 PM »

Hello all!
  First, AHP 3.318, CM15.
I created 4 macros for controlling my HVAC fan and outside air intake damper.
Three of the macros are pretty much identical except for the time delay, and the fourth turns the fan off and closes the damper.

MACRO 1,2,3....
*************
P15 on  (or P15 off or P16 on) TRIGGER
condition... IF flag 10 OFF
end IF

delay 1 sec.          (needed as per bug)
A16 on                  HVAC fan ON and damper OPEN
SET flag 10           so multiple macros will not run resulting in multiple OFF's being sent
DELAY 1 hour         (macro 2 is delay 2 hours, macro 3 is delay 4 hours)
A16 OFF                HVAC fan OFF and damper CLOSE
CLEAR flag 10        enables macros to run
***************
**********
MACRO 4

P16 OFF   trigger    (manually turns off fan and closes damper)
CLEAR flag 10         (enables macros to run again)
A16 OFF                HVAC fan OFF and damper CLOSE
**********

The problem I have stumbled on is:

1)  IF I run MACRO 1 or 2 or 3, flag 10 gets set.... ok
2)  Try to run MACRO 1,2,3 during the 1,2,4 hour delay, another A16 ON does NOT get sent because flag 10 is still set and the conditions fail.....  ok
3)  Run macro 4 (resets flag 10)... ok
4)  Run MACRO 1,2,3 again.... ok... BUT FLAG 10 DOESN'T SET! it is still cleared and I can run the macros again!!!

It seems the only way the flag will set again is after the 1,2,4 hour delay has timed out, and macro 1 or 2 or 3 clears the flag, NOT macro 4 (that is supposed to clear the flag as well).

Another clue might be that if I use Tools/Purge macro delayed events, then flag 10 will set like it should THE FIRST TIME THE MACRO(s) ARE RUN, but ONLY the first time!

This could/would be a possible problem that others are having using flags, and wondering why the flag doesn't work as expected.
Logged

pomonabill221

  • Hero Member
  • *****
  • Helpful Post Rating: 13
  • Posts: 239
Re: AHP flag bug
« Reply #1 on: July 12, 2012, 02:18:53 AM »

Well, after some deep thought (ya need it for this stuff!), I came up with a work around.
  In the three macros that I was
1)testing for flag 10 clear
2) setting flag 10
3) turning on my HVAC fan/damper
4) delaying for 1,2 or 4 hours,
 I removed the set flag 10.
  Then, I created two separate macros that were triggered by A16 on and A16 off (the HVAC fan/damper module address), and had those macros set (for the A16 on) and clear (A16 off) flag 10, so they are independent of the delay macros.
  In thinking of the problem, I believe that once the time delay is triggered, the macro has control of the flag, and NOTHING else can change it's state until the time delay has timed out.
  You probably would not notice this if your delay was short, or you didn't have a delay, but for long delays, this would be a problem, and the only way to control the same flag is to create a macro that ONLY sets or clears the flag.
  Really kinda cludgy, but it works now!
Logged

JMac

  • Hero Member
  • *****
  • Helpful Post Rating: 23
  • Posts: 462
Re: AHP flag bug
« Reply #2 on: July 12, 2012, 05:55:23 AM »

Thanks for the info - this will help in my future macro development, and maybe to go back and reorganize some of the old ones!
Logged

pomonabill221

  • Hero Member
  • *****
  • Helpful Post Rating: 13
  • Posts: 239
Re: AHP flag bug
« Reply #3 on: July 12, 2012, 01:46:37 PM »

You are welcome, JMac!  :angel:
I have a cheat sheet near my computer, so when I need to create a macro, or do something that I have run into in the past, it will remind me of the "gotchas" that AHP has...  rofl
  This one really stumped me, but after playing with it, I saw a pattern, and (as with most macros), had to create a workaround.
  Even this cludge has it's problems, but it does what I wanted it to do.
  I just wish there was some way that a running macro could be cleared, other than using tools/purge delayed macro events.  That would be very handy as well!
Logged
 

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