X10 Community Forum

🖥️ActiveHome Pro => Plug-ins => Smart Macros => Topic started by: jimnfl on November 04, 2005, 06:17:53 AM

Title: how to use flags
Post by: jimnfl on November 04, 2005, 06:17:53 AM
the directions on how to use flags are
vague.  can anyone tell how to use them and
their purpose.
Title: Re: how to use flags
Post by: Tuicemen on November 04, 2005, 03:46:28 PM
flags are conditions to be used in
smartmacros they can be used set or cleared.
They can be used to lengthen the number of
conditions a macro checks before running.
you can set/clear a flag any number of ways
even with another macro. Eg If you have one
macro "A" set  flag 1 at the begining of the
macro and clear it at the end. then You can
have another macro "B" check to see if flag
1 is set/cleared thus it tells macro B if
macro A is running or not.
Using flags can become as complicated as
your imagination lets it. :)
Title: Re: how to use flags
Post by: tom j on May 17, 2006, 01:32:46 AM
flags are conditions to be used in
smartmacros they can be used set or cleared.
They can be used to lengthen the number of
conditions a macro checks before running.
you can set/clear a flag any number of ways
even with another macro. Eg If you have one
macro "A" set  flag 1 at the begining of the
macro and clear it at the end. then You can
have another macro "B" check to see if flag
1 is set/cleared thus it tells macro B if
macro A is running or not.
Using flags can become as complicated as
your imagination lets it. :)

Say how about another general example of a flag and there uses. Thanks

Tcj
Title: Re: how to use flags
Post by: jatracy on May 17, 2006, 10:08:23 AM
I tried using flags in my multiple motion detector setup. I was setting a flag in a macro each time motion was detected and turning on the lights and clearing the flag when the motion detector sent the OFF command. I also had an else statement look at all the flags to decide to turn the lights off or not. The problem I had, was I was trying to insert a delay in the macro before clearing the flag (as opposed to setting the delay on the motion sensor), but the flag would get cleared as soon as the macro was triggered. I have since stopped using flags and I just setup the motion detectors for the amount of delay I want and check the status of the dummy appliance modules that are on the same HC/UC. I would prefer to use flags, but it works so why break it if it ain't broken!
Title: Re: how to use flags
Post by: Tuicemen on May 17, 2006, 10:33:23 AM
I use dummy/phantom modules as well as flags but that for another thread. Heres a simple example of a flag I use to tell my system that I'm working day shift anything which would run during the day if I'm home checks to see if the flag is setor cleared first.Also I can have macro wich will only run if I'm at work by checking to see if this flag is set or not. Macro is triggered by a motion sensor  and has limitations eg: if my wife gets up at this time for some unknow reason!
but for the most part it works flawlessly ;) :D Note: the flag is cleared every night with a timer instead of at the end of the week in case of a false set. ;)
Title: Re: how to use flags
Post by: tom j on May 19, 2006, 12:48:04 AM
I use dummy/phantom modules as well as flags but that for another thread. Heres a simple example of a flag I use to tell my system that I'm working day shift anything which would run during the day if I'm home checks to see if the flag is setor cleared first.Also I can have macro wich will only run if I'm at work by checking to see if this flag is set or not. Macro is triggered by a motion sensor  and has limitations eg: if my wife gets up at this time for some unknow reason!
but for the most part it works flawlessly ;) :D Note: the flag iscleared every night with a timer instead of at the end of the week incase of a false set.

Say this is great thanks!! bought Active home Pro a while back but because of range issues I haven't hooked it up yet. Guess I should download the software and start experimenting still currently using the old Active Home. Just wondering do you know if there are any books that help explain this kind of programing? really would be great if there was it would be a big help. One last thing what's the definition of a flag anyway. Thanks Again!

Tcj
Title: Re: how to use flags
Post by: steven r on May 19, 2006, 03:58:38 AM
...Just wondering do you know if there are any books that help explain this kind of programing?...
This forum is the closest thing you'll find to a book. There's a good chance that what you want to do has been done before. If not, someone will give you an idea how. This is what I call "drop & drag" programming. Try it out. Start building a macro and drag each step over. If you have a problem or question, let us know.

...One last thing what's the definition of a flag anyway....
A flag is a setable condition that can be tested later. eg. You could set flag 2 from one macro and later test for it in another macro. You can have your macro take action or not based on the condition of the flag. Hmm... Perhaps not the clearest explanation. Hope it helped, anyway. Best way to learn is start making macros and see what happens.

Title: Re: how to use flags
Post by: Tuicemen on May 19, 2006, 08:44:01 AM
tom j: steven r is right
Quote
This forum is the closest thing you'll find to a book. There's a good chance that what you want to do has been done before. If not, someone will give you an idea how.
Users on this forum have been able to do things with AHP and the CM15A that even X10 hadn't thought of. Even when they said it couldn't be done we found workarounds to prove otherwise! ;) ;D :D as for the definition of a flag  check here: Definition of a flag   (http://kbase.x10.com/wiki/What_Are_Flags%3F) found at  the X10 Knowledgebase Wiki
Title: Re: how to use flags
Post by: maddoghoek on May 20, 2006, 03:29:09 PM
Is the current status of a dummy module held in the CM15 or do you need a PC running.  I was using flags to create an on/off switch of my motion detectors.
Title: Re: how to use flags
Post by: Tuicemen on May 23, 2006, 09:44:32 AM
maddoghoek  see: Using Phantom/dummy/ghost/virtual modules (http://www.x10community.com/forums/index.php?topic=8807.msg53198#msg53198)
Title: Re: how to use flags
Post by: RJMiller on October 16, 2006, 06:08:20 PM
Hi, I am also trying to use flags with phantom modules.

I am using a flag to show if it is a weekday or not.  Since SmartMacros only allow for two conditions I run this macro prior to the macro with the time range in it.  I am trying to decrease the number of phantom modules I have to use.  Somehow things just don't seem to be working.  I check flag 16 to see if set (weekday) and then check the time range then go about my business of taking action.

I use other flags to determine which door has opened...  door switch triggers a macro which sets a flag identifying say... door 1 as the one that is opened.  Then a checkflag macro looks at the flags and runs another macro specific to the flag it sees... flag 1 would be door 1 then action is taken.

For instance...

  Door 1 switch triggers a macro
    run macro checkweekday (set flag 16 appropriately)
    set flag 1
    run checkflag macro

  Checkflag macro
    if outside working hours and flag1 and 16 set (weekdays and door1)
      run door 1 macro

  Door 1 macro
    send email saying someone there after working hours

I can do this with multiple phantom modules but somehow the flag logic isn't working.  Anyone have any ideas?

  RJ

Title: Re: how to use flags
Post by: delibaker on October 16, 2006, 06:49:48 PM
RJ, you should be able to use the conditions "Weekday" and "Time Between" to do what you want.  I don't have the email option but I've included a screenshot of what it would look like!  HTH!

Title: Re: how to use flags
Post by: Tuicemen on October 16, 2006, 07:08:46 PM

  Door 1 switch triggers a macro
    run macro checkweekday (set flag 16 appropriately)
    set flag 1
    run checkflag macro

  Checkflag macro
    if outside working hours and flag1 and 16 set (weekdays and door1)
      run door 1 macro

  Door 1 macro
    send email saying someone there after working hours

I can do this with multiple phantom modules but somehow the flag logic isn't working.  Anyone have any ideas?

  RJ
You need to have your door sensor trigger a macro to set a phantom "ONLY" (no conditions or extra info like flags set etc)!  ;)
Your phantom address then is used in a macro to Set/clear flags
The problem is your security sensors/macros have to run from the PC. Flag macros have to run from the interface! Phantoms can run from either as can regular modules! ;) :D ;D
Hope this Helps!
Title: Re: how to use flags
Post by: KDR on October 16, 2006, 08:04:13 PM
Tuicemen   You are 100% correct and in addition if you have MyHouse and use it for emails in macros you can't use conditions in those macros either. I tested the Day Of Week condition and found it will work if you only select 1 of the days. If you select more then that the condition doesn't apply. And none of the Time conditions work. (Security and Email has the "store in interface" and "run from pc" grayed out.

It takes 3 macros to send an email from a security sensor if there are conditions that need to be met.  Macro 1 is setup for the security sensor status and then triggers macro 2 by way of a dummy module with the same address as macro 2. Macro 2 contains your conditionals and a dummy module which turns on if the conditions are met. Macro 3 which has the same house and unit code as the dummy module in macro 2, turns on at the same time, executing the content in macro 3 which is the send email command. I have spent a bit of time looking at this trying to see if a flag could be used but keep drawing a blank. Can anyone else see a way of using a flag instead of a dummy module?

By the way I don't actually drag and drop an appliance module into a room. I go to Advance Functions in the macro window and just drop in an Appliance Control in the macro body and give it a house and unit code.

Quote
Your phantom address then is used in a macro to Set/clear flags

I can see how this works provided the flags being set are looked at or tested for by a regular macro which is checking conditions and not one of these "run from pc" only modules or dropins. I would think that this is something that will be fixed in some future update version.

Added...
The problem with using dummy modules is that it takes 2 per email. I have my security system set to email me with a specific email message giving me detail of the zone that set off the sensor. Dummy modules = Number of sensors x 2. That could end up using a lot of house codes. 10 for me right now. Maybe another 20 to 30 or more down the road.
Title: Re: how to use flags
Post by: Tuicemen on October 16, 2006, 10:54:50 PM
KDR: Hopefully this is only a "temporary work arround" until X10 updates this plug-in ::) ;) :D
Title: Re: how to use flags
Post by: Tcat on April 29, 2007, 05:47:15 PM
I must be getting older, faster than I think.  ::)

I have climbed all over this community and I'm not getting it!  :(

I'm using a few really old pir's (motion sensors). the idea is to have cameras follow me...
I have macros that turn all cameras off, except where motion is....
They flip pretty fast!  :)

What I cannot seem to do is set a flag to not re-run every time there is motion...
I think I set to 4 minute delay (the pir's). But everytime I move, it re-triggers.
I am setting Flags on... 1 unique flag per camera. Clearing of course @ off (in the same macro - 1 per camera), no delay...
My assumption is the flag won't clear until the pir times out.. I now suspect that is not true...
The condition is pir on + flag set, so the theory (as I understand it) is the macro shouldn't re-run.
Maybe there is something to phantom macros I don't understand?

I'm attempting to use as Skype web cams with audio... it's working, as long as I don't move  :P
additionally, I'm doubling up BXVC with the low end cameras... Yes, the cameras work fine as audio input...

if I move, skype of course loses a/v as the macro fires...

I'm NOT using phantoms... calling the cameras directly...
any directions to look so I can keep what is left of my mind?

TIA -- maybe I will get some sleep with a little suggestion.
Tcat

Title: Re: how to use flags
Post by: -Bill- (of wgjohns.com) on April 29, 2007, 07:02:57 PM
Tcat

My suggestion would be to re-think the logic.   ;)

You don't want the cameras to switch every time motion is detected.  You want them to switch when motion is detected in a new area!

Something like:
"I see motion!"
"Is my camera on?"
   "Yes, it is, so I don't have to do anything more."
   "No, it isn't, so I switch to my camera."

Pardon the pseudo-code, but I'm sure you get the idea.   ;D
Title: Re: how to use flags
Post by: tom j on May 06, 2007, 09:32:28 PM
I use dummy/phantom modules as well as flags but that for another thread. Heres a simple example of a flag I use to tell my system that I'm working day shift anything which would run during the day if I'm home checks to see if the flag is setor cleared first.Also I can have macro wich will only run if I'm at work by checking to see if this flag is set or not. Macro is triggered by a motion sensor  and has limitations eg: if my wife gets up at this time for some unknow reason!
but for the most part it works flawlessly ;) :D Note: the flag iscleared every night with a timer instead of at the end of the week incase of a false set.

Hi Tuice! could you give me a hand with setting up a flag I'm trying to setup here's my current macro. Now I really only want to run this maco at certain times like if I'm taking the dog out I don't necessarily want the lights to brighten really want this macro to help deter crime two years ago someone walked on my porch and kicked the door in had a protector plus with a bunch of those large powerhorns and a aftermarket siren so the ^%$%^ got nothing zip! but that's another story want I would like to do is be able to turn this macro off and on without using the computer I was thinking I could use a flag with a trigger like C10 if C10 is on then the macro would proceed if not then it wouldn't run could you or someone walk me through how I could add a flag to this macro accomplish this. Thanks!!

Tom j

Trigger Conditions D4 on
and it's Nighttime
End trigger Conditions

Brigthen Porch Lights by 35%
Wait 10 Minutes
Dim Porch Lights By -35%
End
Title: Re: how to use flags
Post by: Tuicemen on May 14, 2007, 01:48:18 PM
tom j Problem your having is macros can only use 3 conditions and you've used them!
Here's the work around:[li]Create a dummy module C 10[/li]
[li]Create a macro that uses the dummy  "On" to set a flag (3), trigger it with a timer (some time after dark)[/li]
[li]Create another macro that  uses the dummy  "Off" to clear the flag, trigger it with a timer(when it is no longer night time)[/li]
[li]Now replace the night time condition in your macro with if flag 3 is on  [/li]

[/list]Now if you wish to walk the dog press C10 Off (this clears the flag) your macro won't fire,when you come home press C10 On (this resets the flag). ;) :D
1 problem if you walk the dog before timer triggers c10 and come home after it has set the flag then your lights will brighten! ::) ;)
I'm sure Puck had posted an example similar to this but I can't seem to find it! ::) ???
Title: Re: how to use flags
Post by: MANOWARİ on June 28, 2009, 06:09:13 PM
Sorry to bump an old thread. Newbie here and I didn't realize that the smart macros wasn't part of AHP software package. I just have 2 questions.
1. If/can I order just that plug-in for my existing AHP software and how much is it? The web site for ordering is kind of a nightmare.
2. The description for smart macros and the pdf file I downloaded is very basic. I program custom software for fire alarm systems so logic functions are 2nd nature to me but is this package going to let me do all that I can or is it just a step up from the simple version installed in AHP? Is there anyway to use negated triggers inputs/latch functions and can you use other macros as inputs for new macros? Thanks for any reply.
Title: Re: how to use flags
Post by: steven r on June 28, 2009, 08:52:43 PM
...I didn't realize that the smart macros wasn't part of AHP software package...
It wasn't in the original package but I believe it has been included in the current package for some time now.

...I program custom software for fire alarm systems so logic functions are 2nd nature to me...
Being an experienced programmer can actually be a handicap to using AHP since AHP has it's own set of quirks "required programming tricks" to get things done the way you would "logically" expect them to work. e.g. Betweens that cross the bewitching hour of midnight.

...is this package going to let me do all that I can or is it just a step up from the simple version installed in AHP?...
One thing I think is frustrating is that all logical decisions must be made before a macro starts. i.e. No branching from or in a macro. Also once a macro starts, there is no way to stop it's execution from software. All macros that start must complete.

While it may not do everything you'd like it to do, it is a big step from "the simple version". It can do a lot and is worth having. In addition, the X10 user base here has figured out how to some things with it that X10 never considered to be possible such as macros calling macros.

...Is there anyway to use negated triggers inputs/latch functions and can you use other macros as inputs for new macros?...
Sort of. Check out these User-Designed Working Macros (http://forums.x10.com/index.php?board=103.0) for some ideas.
Title: Re: how to use flags
Post by: MANOWARİ on June 28, 2009, 09:18:40 PM
Thanks for the quick reply. I just got the system Saturday so I'm still playing and learning. I think before I go any farther I'm going to order all the parts I think I may need then do some kind of floor plan/mapping routine to set it up most effectively. I've already found the iPhone App and love it. I think I'll read a lot more posts in the mean time. Thanks again for the answers. This seems like a great resource so far. :)%
Title: Re: how to use flags
Post by: ChrisJ on January 14, 2010, 01:00:16 AM
How are the house codes and flags used together? Is the flag set at the same time the house code is used? I am using house codes A to E however my eagleeye sensors do not operate all house codes. I am trying to set a flag to tell my bedroom sensor to turn off all lights only if the livingroom sensor is not active.

Livingroom sensor = C1  -  detects motion
Bedroom Sensor    = D10 - operates between 1am and 5:30am with a 40sec delay to turn off livingroom lights

both sensors and macros are the same code and number

If no one is in the livingroom and C1 has shut off, the bedroom door opens or closes, all livingroom lights should go off.

How do I distinguish between setting a flag for C1 while using D10 sensor?

thanks, Chris
Title: Re: how to use flags
Post by: lodtrack on January 31, 2011, 08:11:06 AM
Just a thought based on comments here re. flags and a common theme of many issues/problems  read on virtually every part of the forum...someone could make a mint writing an X10 for dummies book?  -:)