Difference between revisions of "What Are Flags?"

From X10Wiki
Jump to navigation Jump to search
Line 1: Line 1:
== Questions ==
#REDIRECT [[Using Flags]]
What do Flags do in SmartMacros?
== Answer ==
Problems running macros in X10 SmartMacros Software are often related to transceived house codes. Go into Tools-->Hardware Configuration, and make sure that the House Code for the motion sensor or remote control in question is checked in the lower right corner of the screen. Also, ensure that you run the Tools-->Download Timers and Macros command whenever you are done changing macros.
SmartMacros adds two features to ActiveHome Pro: macro conditions and flags. Without conditions, macros always run when the interface receives the macro’s On or Off command. Some sample conditions are:
"It`s Nighttime" or "It`s Daytime AND It`s Friday."
Flags add global variables into your macro set-up. In computer programming, a global variable is one that can be accessed from any context in a program. Basically, flags let macros communicate with each other.
Bob has a motion sensor that is programmed for B1. When he is home, he wants it to sound a chime whose house and unit code are A4. When he is away, he wants lights A5 and A6 to come on. Bob sets a Slimline Switch to B2-B4 and puts it near his door. He will press B2 On when he leaves and B2 Off when he gets back.
First, Bob goes into the Tools menu and selects Preferences. In the SmartMacros tab, he makes sure that Simple or Advanced is checked, not Wizard. Then Bob makes five macros:
Trigger // Condition(s) //==> Action(s)
B2 On // None //==> Set Flag 4 On
B2 Off // None //==> Set Flag 4 Off
B1 On // If Flag 4 Is Off //==> Sound A4 Chime
B1 On // If Flag 4 Is On //==> A5 Light On, A6 Light On
B1 Off // If Flag 4 Is On //==> A5 Light Off, A6 Light Off
In this example, Bob has assigned a "meaning" to Flag 4: if flag 4 is on, Bob is away; if flag 4 is off, Bob is home.
Bob is happy with this, but he would also like his house to look and sound occupied when he is away. He builds some macros at unused house codes:
M7 On // If Flag 4 Is On // A7 Light On
M7 Off // If Flag 4 Is On // A7 Light Off
M8 On // If Flag 4 Is On // A8 Radio On
M8 Off // If Flag 4 Is On // A8 Radio Off
Instead of putting sensors or remotes at M7 and M8, Bob just builds Timers for these macros, scheduling a light and a radio to come on and off at certain times, but only if he is not home. You may want to click on View Advanced Layout in the Timer Designer to access the Security checkbox, which will make timers randomly vary by 20 minutes or so for a lived-in appearance. 
Here is a more complex script to automatically record 3 cameras based on motion sensors and not stop until motion ceases on all three cameras:
A5 On // None //==> Set Flag 5 On, Start Video Recording, Switch to Cam B5
A6 On // None //==> Set Flag 6 On, Start Video Recording, Switch to Cam B6
A7 On // None //==> Set Flag 7 On, Start Video Recording, Switch to Cam B7
A5 Off // If Flags 6 and 7 are Off //==> Stop Video Recording, Set Flag 5 Off // ELSE If Flag 5 Is On// Set Flag 5 Off
A6 Off // If Flags 5 and 7 are Off //==> Stop Video Recording, Set Flag 6 Off // ELSE If Flag 6 Is On// Set Flag 6 Off
A7 Off // If Flags 5 and 6 are Off //==> Stop Video Recording, Set Flag 7 Off // ELSE If Flag 7 Is On// Set Flag 7 Off
[[category: Software]]

Latest revision as of 21:18, 3 August 2007

Redirect to: