Kick Hard - Pull the Trigger on Rules and Macros
Triggers, Conditions and Actions
Triggers, or Trigger Events (TE) are anything that initiates evaluations or actions. A TE can be a Voice Recognition (VR) event, an X10 Sensor, a button press, time of day or any one of a great number of other events.
A simple Rule illustrates this:
RULE NoonWhistle
IF Time OF Day = 12:00 PM
THEN Play WAV file “Whistle.WAV”
The Trigger (TE) is the time of day. The Action is to play the .WAV file. Everyday at noon, this rule will trigger.
Conditions, or Secondary Conditions (SC) are additional conditions to be evaluated after the trigger, but before executing the actions. For example, suppose we want our noon whistle to only sound if the house is occupied.
RULE NoonWhistle
IF Time OF Day = 12:00 PM
AND House Mode is Normal
THEN Play WAV file “Whistle.WAV”
And finally, Actions are a list of individual steps taken once the conditions have been evaluated as true.
Both Rules and Macros have Triggers and Actions. But they have very different Triggers, and only Rules have Conditions.
Macros, Room Scenes, and House Modes
Macros, Scenes and House Modes are all variations on the same basic construct. All are fundamentally a collection of sequential program statements, executed in order and unconditionally once triggered. These statements can be almost anything. They can turn on or off various devices, set flags and timers, and invoke other macros.
Macros
A Macro may be triggered any of four different ways. It may be called from a rule or another macro, it may be triggered by a Voice Recognition (VR) event, it may triggered by a 3-digit DTMF touch-tone sequence, and finally, it may be scheduled.
Macros have three important parts. First is the name. This is defined when the macro is created, and may not be changed short of deleting the macro and re-entering it. It is very important to think carefully about the name because this is the only way to group related macros together. It is an excellent idea to define keywords for related macros and start all related macros with that keyword. For example, macros related to swimming pool control might all start with the keyword POOL. See the sample HAL Program for Swimming Pool control for an example of this.
The second part of the macro is the trigger. Triggers are optional. Macros need not have any means to be triggered other than being called by another macro or rule, or from a schedule.
|