Flags??

Started by murray, February 05, 2008, 09:27:49 PM

Previous topic - Next topic

murray

Can someone explain flags to me?  I can't get into my head how they work in a macro.  I want to prevent a macro from working for a short period, say 10 minutes, then activate that macro.  I have a motion sensor that starts a sequence, but when armed I can't leave the house without it activating.  I need a macro that allows me to exit the house, the motion sensors "sees" me as I exit but does nothing, then 10 minutes later it is active to start the sequence.  Any help would be greatly appreciated.

steven r

If I understand what you want to do, this should work. Flags while make macro ignore all but the 1st trigger.

Sensor set as M1 and at least 1 dummy module in AHP set as M3. You may need one as M1 also but I'm not sure.

M1 ON - Triggers on "M1 ON" & "Flag 1 clear"
set Flag 1
delay 10 min
clear Flag 1
M3 ON

M3 ON - Triggers on "M3 ON"
[Execute stuff here]


There may be a better way to do this but I'll need some sleep before I see it.  :)
e.g. It could be easier to set a delay in the sensor and trigger a macro from its OFF signal.

Skip M2 as a sensor set as M1 will also use M2 to send a dusk / dawn signal. Dummy module(s) allow macros to be called.
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. :)

Walt2

You'll also need a way to clear Flag 1, because if it is ever set, the M1 On macro will never be able to execute.  I know that with my CM15A's firmware, a "clear all memory" will leave all the flags set.
* Sears Home Control System, Radio Shack Plug 'n Power, NuTone, Stanley LightMaker, BSR, HomeLink.
* Tecmar Device Master, CP290 (LightHouse), CM11A (AH), CM14A (AH2), CM15A (AHPro).

steven r

#3
Quote from: Walt2 on February 07, 2008, 06:04:45 PM
You'll also need a way to clear Flag 1...
I was pretty tired when I was typing that up of the top of my head but I did remember to clear the flag after the delay.

Quote from: Walt2 on February 07, 2008, 06:04:45 PM
...I know that with my CM15A's firmware, a "clear all memory" will leave all the flags set.
Your's sets the flags? I'm not at home now but I'm pretty sure mine clears them.
Do some CM15As respond differently? Is this an undocumented firmware change?
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. :)

Puck

Quote from: steven r on February 07, 2008, 09:13:06 PM
Your's sets the flags? I'm not at home now but I'm pretty sure mine clears them.
Do some CM15As respond differently?

My flags remain unchanged after a "clear interface memory" on both CM15As (different date codes). The reason being is this command clears the external EEPROM where the AHX file is stored and not the micro-controller's internal RAM where the flags are stored.

QuoteIs this an undocumented firmware change?

I do recall Walt2 mentioning this characteristic in other posts, but he also has one of the original beta test units. It would be interesting to see how other people's flags react when the memory is cleared to see if there were firmware changes and when.

Walt2

#5
Quote from: steven r on February 07, 2008, 09:13:06 PM
I was pretty tired when I was typing that up of the top of my head but I did remember to clear the flag after the delay.

Yea, I noticed that you clear the flag at the end of that macro, but if for whatever reason, that flag becomes set, that macro will never be able to run.

Quote from: steven r on February 07, 2008, 09:13:06 PM
Your's sets the flags? I'm not at home now but I'm pretty sure mine clears them.
Do some CM15As respond differently? Is this an undocumented firmware change?

I guess my CM15A does respond differently.  It does indeed set all the flags when I clear/erase its memory.

Anyway, I just think it is simply good programming to intentionally set all the flags one uses to the desired state, rather than just assume/hope they have the value you expect.
* Sears Home Control System, Radio Shack Plug 'n Power, NuTone, Stanley LightMaker, BSR, HomeLink.
* Tecmar Device Master, CP290 (LightHouse), CM11A (AH), CM14A (AH2), CM15A (AHPro).

steven r

Based on the above comments, I'd recommend clearing your CM15A to see what happens. For me the default condition has always been that the flags were clear. If want to have a way to reset your flags, I recommend a simple macro that clears all the flags.

On a clearer head, I recommend modifying my original suggestion by ending M3 with the clear flag 1 rather than the M1 macro.

       M1 ON - Triggers on "M1 ON" & "Flag 1 clear"
       set Flag 1
       delay 10 min
<--   clear Flag 1               
m     M3 ON                                                     
o
v
e

t      M3 ON - Triggers on "M3 ON"
o     [Execute stuff here]
-->   clear Flag 1
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. :)

ckjk616

I'm new here, and just beginning to understand flags. What is the difference between using a flag and using a dummy module? So far, they seem the same. Isn't the condition that a flag be set or not and a dummy module being on or off the same thing?

In one case, a motion sensor triggered macro that quickly turns a light on and off as a signal, does so only once within a certain time period (otherwise it would drive me crazy). It seems like a longer running macro can be triggered several times while the first one is still running. Is this right? What effect does that have?

In another case, an upstairs hallway motion sensor turns lights on downstairs, gives me a minute to go downstairs, then sets a flag, allowing a second macro to turn the lights off when I return to the upstairs hallway. My time downstairs varies, so a set delay wouldn't work for me.

Do these sound right? When should I use dummy modules?

Finally, when a wall switch is physically turned off (having been turned on by a macro, controller, or remote), does the software recognize it as off? It seems like it doesn't.

Thanks,
Jeff

Puck

Quote from: ckjk616 on February 26, 2008, 09:00:35 AM
What is the difference between using a flag and using a dummy module?

Flags are conditions, Dummy Modules are just switches without a real device. Dummy Modules can only be conditions if its address is on the Monitored house code.

QuoteIt seems like a longer running macro can be triggered several times while the first one is still running. Is this right? What effect does that have?

Longer running macros can be retriggered if they do not have conditions to prevent this from happening.

QuoteFinally, when a wall switch is physically turned off (having been turned on by a macro, controller, or remote), does the software recognize it as off? It seems like it doesn't.

The Graphical User Interface (GUI) displays the state of the switches, but the software can only recognize, and use as a condition, those on the monitored house code.

ckjk616

Again, I'm new at this. Maybe I'm not making myself clear. Assuming the dummy modules are on the monitored house code, are they then the same thing as flags (conditions) or are there other uses for dummies? I just discovered a dummy will run a macro. Anything else?

Again, the switch I just tested is on the monitored house code. I turned it on with a mini controller, and the icon turned on on screen. Then I physically turned it off using it's push button. The icon on screen did not turn off. What am I missing?  Thanks

Puck

Quote from: ckjk616 on February 26, 2008, 11:06:34 AM
Again, I'm new at this. Maybe I'm not making myself clear. Assuming the dummy modules are on the monitored house code, are they then the same thing as flags (conditions) or are there other uses for dummies? I just discovered a dummy will run a macro. Anything else?

Dummy modules are generally used for creating and running macros that are not associated to a specific device. Dummy modules can also act as a pseudo-flag for a condition if it is on the monitored house code.

Tuicemen has compiled various links to help explain many parts of AHP including flags and dummy modules (aka Phantom Modules). X10 Issues? Please Read This First!

QuoteAgain, the switch I just tested is on the monitored house code. I turned it on with a mini controller, and the icon turned on on screen. Then I physically turned it off using it's push button. The icon on screen did not turn off. What am I missing?

AHP will not detect the state of most switches when they are controlled locally. It doesn't matter if the switch is on the monitored house code or not. There is no easy way around keeping AHP in sync when switches are controlled locally without the use of switches that provide X10 feedback to AHP.

PrimeGuild

If you are a programmer, then consider these FLAGS as Global Variables.