KickAss Macro Structure
The next word we call the Keyword. Note in our example we use two Keywords for the Trigger Macros. The very first Macro uses the Keyword Initialize because we have a reason to group this Macro with other Macros not related to the swimming pool, because the switch itself needs to be initialized in the event it loses it’s programming. This is not supposed to happen, but occasionally does if there is a serious power failure. Hence all the macros related to restoring normal function after a severe outage are grouped under the Keyword Initialize.
Subsequent macros are all grouped under the Keyword Pool, as are the Rules. Although this program doesn’t use any, Scenes and Modes would be defined the same way.
Following the Keyword is the body of the Macro title. This serves to differentiate macros from one another and are related to the task being performed. It’s a good idea to use similar body structure for similar functions. Hence Macro Pool Status Request and Macro Sprinkler Status Request do the same thing, one for the pool and the other for the irrigation system.
The 3-digit number in brackets following the title is the DTMF sequence that can act as a trigger for the Macro, and the text in curly braces is the Voice Recognition phrase. Ideally, a Trigger Macro has both options, while an Action Macro has neither.
The elements on the first line appear precisely as represented (except for the designation “Macro”) in a HAL Macro. The second line does not. The second line is a comment and serves to describe the function of the Macro.
The third line contains only the word “Begin”. This is cosmetic and merely habit from past programming practice. But it does help make the rule more readable, and we encourage using it.
Immediately following the Begin statement are the Action Statements. Trigger Macros have few actions, whereas Action Macros consolidate many actions in a single place. The Action Statements are closed out with an End statement to balance the Begin, but this is merely a cosmetic convenience.
Rules Structure
Rules are documented in a format very similar to the Macro format. The word Rule followed by the Keyword and then the remaining portion of the name are identical to the Macro format. However, there is no field for a DTMF sequence or a Voice Recognition phrase.
The comment field is in the same place as in the Macro, and the Rule proper is placed between Begin and End statements.
However, the Rule contains much more than the simple list of actions given in the Macro. There are two mandatory items. A Trigger Event (TE) and at least one action.
|