Advanced Programming Training Revision 2-5a

HAI
“Integrated Automation”
Advanced
Programming
SET YOUR “PHASERS”
ON STUN!




We understand the
need for
communication,
but……………...
as a courtesy to all,
please set your CELL
PHONES for silent
operation
This will be appreciated
by everyone
Introduction

Programming the Omni Family of
automation controllers using HAI’s 1105W
Dealers PC Access Upload / Download
Software
Please remember……….



Programming is an art
No two people use exactly the
same programming style, unless
duplicating successful
programming routines
We are here to provide you the
bricks & mortar to build your
own individualized programs for
your customer
1st MAIN PRINCIPLE of
Programming………
It’s all contingent on your ability to offer your
customer the true benefits of convenience,
energy savings, and peace of mind.

I. User’s life Styles
 Married?
Single?
 Family? small or grown children?
 Frequent
entertainers?
 Working? Retired?
 Usually home?
 Out of town often?
2nd MAIN PRINCIPLE of
Programming………
Again, It’s all contingent on your ability to offer your customer the
true benefits of convenience, energy savings, and peace of mind.

II. Individual Needs
 Handicapped?
 Many,
or few, temperature zones?
 Many, or few, security zones?
 Degree of automated lights desired
 techni-phobic (needs 1 button operation)
 techni-maniacs (want every feature available)
 Use
of peripheral gadgets?
• Touch Screens, Infra-Red, Voice
recognition, etc.
Topics to be covered………..








Quick Outline of HAI Basic Programming
Theory
Programming Inputs, Outputs & Conditionals
Flags
Button Vs Flag
Loops
Nesting
Examples
Training Promo’s
Quick review of Basic Programming



HAI controllers are event driven
A change of state must occur
before any program will execute
The controller is constantly
searching, every second, for a
change of state
Basic Criteria in Programming
 When, An activity must occur, an input to the controller must change
state before any programming line will execute.
 Command, Every program has a command to perform as a result of
the When.
 &IF, The ‘&IF’ statement is optional in all programming lines. It is
used as a conditional. As the controller watches all of the inputs to the
system, it is constantly looking for matches for the ‘When.’ When the
match occurs, the system looks for a conditional (&IF), to see if the
condition “is true” or “is NOT true.” If the condition “is true” it executes
the Command. If the conditional “is NOT true” the Command is not
executed.
INPUT / OUTPUT / & IF

WHEN










(These are the “In’s”)
Time
User Button
Control
Security
Zone
All On
All Off
Alarm
X-10
Misc.





Phone Dead / Phone Line Ring
Phone On Hook / Off Hook
AC ON / AC OFF
Battery Low / Battery OK
DCM Fail / DCM OK

COMMANDS









(“Outs”)
Control
Security
Button
All On
All Off
Scene
Temperature
Message
& IF
(and “if true” or “not true”)
 Unit




Security
Zone
Time
Misc.

None, Never, Light, Dark, Phone Dead /
Ring, On Hook / Off Hook, AC On / Off,
Battery Low / OK
Basic Programming Example

In a simple application, a program is created to turn a light on when a door is
opened and it is dark (it is dark after sunset). Please note: NOT READY is a
security term which means the zone is open and the security system is NOT
READY to arm.

WHEN Front Door NOT READY &IF DARK: Front Entry Lt ON

The controller has the above line of programming

5:58 PM the Front Entry light is off
5:59 PM the homeowner walks in the Front Door and leaves the door open
6:00 PM Sunset occurs
6:01 PM is the Front Entry light on or off?
Many programmers will argue that the light will be on because the statement
becomes true at 6:00 PM. This is an incorrect assumption. Notice the line of
programming begins with ‘When’ (a moment) not ‘If’ (a state). The key is that an
HAI controller is event driven. The line is only executed at the time the Front
Door is opened. At that moment sunset had not occurred. Until the door is
shut and reopened after 6:00:01 PM, the Front Entry light will not be
commanded to turn on.





The action of opening the door causes the system to look at whether it is ‘dark’ or
‘light’ outside and then execute, or not execute, the command.
FLAG, the virtual relay





Flags used as counters
Flags as timers
Flags that keep status
Flags that trigger
Flag locations
 Omni
LT Unit #’s 29-36
 Omni II
Unit #’s 73-128
 Omni Pro II Unit #’s 257-392
FLAGS

The easiest way to define a flag it to refer to it as a ‘virtual relay’. It is
considered a virtual tool. A flag can be in one of three separate states:
on, off, or a counting number between 0 and 255. If a flag has a value
from 1 to 255 it is considered on and if it’s value is 0 it is considered
off.

A flag is created by naming a unit that has been designated as a flag.
The unit numbers for flags are different in each type of Omni, but serve
the same functions: (OmniPro II 393-511 / Omni II 73-128 / OmniLT 2936). If a house program uses all of the flags, unused controller outputs
can be used (OmniPro II 257-392 / Omni II 65-72 / OmniLT 17-24, 27 &
28). Once a flag is named it can be turned on, off, set to a value,
incremented or decremented. The context in which a flag is used
within a routine determines the flag’s function.

Flags are a powerful programming tool that can be used in several
ways to accomplish advanced programming routines. The following
examples show the main uses of flags as a counter, timer, trigger, or
status keeper. There is no need to ‘declare’ how a flag is to be used.
Flag Used as a Counter


Objective A: Turn off the HVAC system if any windows
are opened & turn HVAC back to AUTO when all
windows are closed
To be named in the NAMES section of PC Access



ZONES (under Zones): FRoom Window, MB Window, Kitchen Window, Office
Window
FLAG (under Units): “Window Flag”
Solution:










1. WHEN FRoom Window NOT READY: INCREMENT Window Flag
2. WHEN FRoom Window SECURE: DECREMENT Window Flag
3. WHEN MB Window NOT READY: INCREMENT Window Flag
4. WHEN MB Window SECURE: DECREMENT Window Flag
5. WHEN Kitchen Window NOT READY: INCREMENT Window Flag
6. WHEN Kitchen Window SECURE: DECREMENT Window Flag
7. WHEN Office Window NOT READY: INCREMENT Window Flag
8. WHEN Office Window SECURE: DECREMENT Window Flag
9. WHEN Window Flag ON: Thermostat MODE OFF
10. WHEN Window Flag OFF: Thermostat MODE AUTO
Flag Used as a Counter

Lines 1,3,5,7: Increment the ‘Window Flag’ each time a window is opened. Since
all the windows are closed when the controller is programmed, opening the first
windows sets ‘Window Flag’ to 1.

Lines 2,4,6,8: Track window closings. The ‘Window Flag’ counter is
decremented by 1 each time a window is closed.

Line 9: When a counter is decremented to ‘0’ it is perceived by system as moving
from on to off. This change of state from on to off can be used as a change of
state to trigger another event. In this case, the thermostat is placed in
‘automatic’ mode each time all of the windows in the house are closed.

Note: Line 10 will only work in HAI controllers with firmware 1.8 and later.

Line 10: When a counter is incremented from ‘0’ to ‘1’ it is perceived by system as
moving from off to on. The ‘on’ condition can be used to trigger another event. In this
case, the thermostat is placed in ‘off’ mode each time the first window in the house is
opened.
Flag Used as a Timer



Objective B: To turn on the outside floodlights for 5
min. when motion is detected in a driveway or yard.
Objective B1: To also allow the user to run a program to
shut the outside floodlights off, even if the time has not
elapsed in the above program.
To be named in the Names section of PC Access

Zone (under Zones): Outdoor Motion

Flags(under Units): “Time Light” & “Flood Flag”


Use flag #’s corresponding to Model of Omni system
Floodlights(under Units): Floodlights (specific address or addresses)
Flag Used as a Timer

Solution B:





1. WHEN Outdoor Motion N/R: Flood Flag ON FOR 5 MIN.
2. WHEN Flood Flag ON & IF Dark: Floodlights ON
3. WHEN Flood Flag OFF: Floodlights OFF
This program will turn the lights on when the motion is first detected. Each time motion
occurs the timer will renew to the full 5 minutes. When the 5 min. elapses without motion the
light is turned off.
Solution B1:

In some cases the user may want to defeat the timer. A flag can be used (“Time Light Off”)


1. WHEN Outdoor Motion N/R &IF Time Light ON:Flood Flag ON
FOR 5 MINUTES.
2. WHEN Flood Flag ON & IF Dark: Floodlights ON
3. When Flood Flag Off: Floodlights OFF
4. WHEN Time Light OFF: Set Flood Flag to “0” (OFF)

The homeowner can be given a simple way (X-10 device) to turn the Time Light Flag on and off.


When it is On, the light turns off after 5 minutes, when Time Light Flag is turned off the light will
turn off..
Flag Used as a Trigger


Objective C: To simplify thermostat temperature control
for multiple Omnistats when the user is Home, Away, or
away for a longer period of time (Vacation).
To be named in NAMES section of PC Access


Flags: “Comfort,” “Setback,” “Vacation”
Solution C:












1. WHEN Comfort ON: Down T'Stat MODE AUTO
2. WHEN Comfort ON: Down T'Stat HEAT SETPOINT 68
3. WHEN Comfort ON: Down T'Stat COOL SETPOINT 72
4. WHEN Comfort ON: Up T'Stat MODE AUTO
5. WHEN Comfort ON: Up T'Stat HEAT SETPOINT 68
6. WHEN Comfort ON: Up T'Stat COOL SETPOINT 72
7. WHEN Setback ON: Down T'Stat MODE AUTO
8. WHEN Setback ON: Down T'Stat HEAT SETPOINT 65
9. WHEN Setback ON: Down T'Stat COOL SETPOINT 75
10. WHEN Setback ON: Up T'Stat MODE AUTO
11. WHEN Setback ON: Up T'Stat HEAT SETPOINT 65
12. WHEN Setback ON: Up T'Stat COOL SETPOINT 75
Flag Used as a Trigger
13. WHEN Vacation ON: Down T'Stat MODE AUTO
 14. WHEN Vacation ON: Down T'Stat HEAT SETPOINT 62
 15. WHEN Vacation ON: Down T'Stat COOL SETPOINT 78
 16. WHEN Vacation ON: Up T'Stat MODE AUTO
 17. WHEN Vacation ON: Up T'Stat HEAT SETPOINT 62
 18. WHEN Vacation ON: Up T'Stat COOL SETPOINT 78
 19. WHEN ARM DAY: Comfort ON
 20. WHEN ARM DAY INSTANT: Comfort ON
 21. WHEN ARM NIGHT: Setback ON
 22. WHEN ARM NIGHT DELAY: Setback ON
 23. WHEN ARM AWAY: Setback ON
 24. WHEN ARM VACATION: Vacation ON
 25. WHEN OFF &IF Fire Flag OFF: Comfort ON
In this example, Away, Setback, and Vacation’ are all being used as trigger flags. Once the
system is armed the Setback, Comfort and Vacation flags will remain on indefinitely. There is no
need to turn these flags back off. Each time a programming line turns the appropriate flag on
(i.e. Comfort ON) the lines associated with ‘WHEN Comfort ON’ will execute even though the flag
is already on. The action of turning the flag on (even if the flag was not previously in an off
state) triggers all routines the start with ‘WHEN the flag ON’.
Notice that each of the three temperature ranges begin with placing the thermostat mode in
‘auto’. The methodology ensures that the thermostat will maintain the desired temperatures. In
an automated environment it is assumed that the system will correct a users mistake. On a nice
day a user may manually turn a thermostat ‘off.’ If they leave with the thermostat in the ‘off’
mode there is an expectation that the house will not become too hot or too cold while they are
away. By starting all temperature settings with ‘auto’ a thermostat should never accidentally be
left in the ‘off’ mode.



Flag Used to Keep Status



Objective D1: To turn the kitchen light on for 15 minutes
when user walks through hall from bedroom to kitchen
between the hours of 12 AM & 6 AM
To be named in the NAMES section of PC ACCESS

Zone:
“ Hall Motion”

Flag:
“ Nite Lt Flag”

Unit:
“Kitchen Light”
Solution D1:

1. (WHEN) 12:00 AM MTWTFSS: Nite Flag ON for 6 hours

2. WHEN Hall Motion N/R & IF Nite Lt Flag ON: Kitchen Light on for 15
min

Kitchen Light will go on for 15 minutes only when “Nite Light Flag is on” and user walks
through Hall Motion Detector
Flag Used to Keep Status


Objective D2: In the event of a fire alarm, turn the
thermostat & fan OFF to avoid feeding air to the fire.
Also, prevent placing the thermostat & fan on AUTO
when security is disarmed from a fire condition.
To be named in the NAMES section of PC ACCESS


Solution D2: (Unsafe Solution)




Flag: “Fire Flag”
1. WHEN FIRE ALARM: Thermostat Mode Off
2. WHEN FIRE ALARM: Thermostat Fan Auto (Fan Auto=OFF)
3. WHEN OFF(Security): Thermostat Mode AUTO
Without a flag, a very dangerous scenario can occur. If a fire were to occur, it is
human nature to first disarm the system, then determine if it is a false alarm. In the
lines above, the system would appropriately turn the thermostat Off. Unfortunately,
when the system is disarmed, the thermostats would be turned back on!
Flag Used to Keep Status

To prevent this very dangerous situation, a flag is
used.

Solution D2 (Safe Solution)

•
1. WHEN FIRE ALARM: Fire Flag ON FOR 15 MINUTES
•
•
•
•
•
•
•
2. WHEN FIRE ALARM: Thermostat MODE OFF
3. WHEN FIRE ALARM: Thermostat FAN AUTO (FAN AUTO = OFF)
4. WHEN OFF &IF Fire Flag OFF: Thermostat MODE AUTO
5. WHEN AWAY: Fire Flag OFF
6. WHEN NIGHT: Fire Flag OFF
7. WHEN VACATION: Fire Flag OFF
8. WHEN Fire Flag OFF: Thermostat MODE AUTO
Line one turns ‘Fire Flag’ on any time a fire alarm occurs. ‘Fire Flag’ is not controlling
anything, it is simply keeping track of the fire condition status (in fire alarm or not). The
second change is to the fourth line. The addition of the ‘&IF Fire Flag OFF’ is being used to
determine if it is safe to place the thermostats in automatic mode. By consulting the ‘Fire
Flag’ the thermostats are kept from restoring when the system is disarmed during a fire.
Lines six through eight reset the ‘Fire Flag’ each time the system is armed. Using this
approach, the ‘Fire Flag’ is reset each time the smoke detector is reset. Line 8 ensures the
thermostat is never left in off mode since the Fire Flag is reset 15 minutes after a fire
condition is detected.
Button vs. Flag

A button and a flag are very similar. A button is designed to be a
simple method for a user to trigger multiple actions based on a
single event. The term button is synonamous with “SCENE” or
“MACRO,” & the term is used to signify ‘One Button” operation.
For instance a ‘Good Night’ button is a very popular routine that
will arm the security to night, turn off some lights as desired and
setback the temperatures on the thermostats, all executed from
running the same “Button.” Since this routine is designed to
either be triggered from the console, or telephone (menu
function #3), or through another interface such as a button next
to the bed (X-10, a wireless keyfob, or an ALC ‘program’ switch)
it is best to use a button. Essentially a button functions just like
a trigger flag. When it is executed a number of actions can
occur. The same functionallity can be achieved with a trigger
flag for routines that should be hidden or that the user should
not manually operate. Functionally a button and a flag are
identical the key difference being whether the user should have
manual operation.
Loops


Objective E: To flash a light on and off when the phone
rings and keep it flashing as long as the phone keeps
ringing.
To be named in the NAMES section of PC Access



Flag: “Light Flash”
Unit: Family Rm Lt
Solution: E




1. WHEN PHONE RINGING: Light Flash ON for 1 second
2. WHEN Light Flash OFF & IF PHONE RINGING: Light Flash ON FOR 1
SECOND
3. When Light Flash ON: Family Rm Lt ON FOR 1 Second
This program can be a helpful application for the hearing impaired or notification
while in the shower or vacuuming. The first line triggers starts the routine based
on the first phone ring. The first ring executes line 3, which turns the ‘Family
Rm Lt’ on for 1 Second and then turns the light back off (1 flash cycle). Each
time the ‘Light Flash’ flag turns off the system looks to see if the phone is still
ringing (line 2). As long as the phone is still ringing line 3 will execute every
second. When the phone stops ringing line 2 becomes false and the routine
stops.
NESTING, a Button executing a Button
WHEN Front Yard: Water Area 1
ON
WHEN Front Yard: Water Area 2
ON
WHEN Front Yard: Water Area 3
ON
WHEN Front Yard: Water Area 4
ON
WHEN Front Yard: RUN Back
Yard
WHEN Front Yard: RUN Back
Yard
WHEN Front Yard: Water Area 1
ON
WHEN Front Yard: Water Area 2
ON
WHEN Front Yard: Water Area 3
ON
WHEN Front Yard: Water Area 4
ON
WHEN Back Yard: Water Area 5
ON
WHEN Back Yard: Water Area 6
ON
WHEN Back Yard: Water Area 7
ON
WHEN Back Yard: Water Area 8
ON
WHEN Back Yard: Water Area 5
ON
WHEN Back Yard: Water Area 6
ON
WHEN Back Yard: Water Area 7
ON
WHEN Back Yard: Water Area 8
ON
Execution Order: 1 2 3 4 5 6 7 8
Execution Order: 1 2 3 4 5 6 7 8
WHEN Front Yard: Water Area 1
ON
WHEN Front Yard: Water Area 2
ON
WHEN Front Yard: RUN Back
Yard
WHEN Front Yard: Water Area 3
ON
WHEN Front Yard: Water Area 4
ON
WHEN Back Yard: Water Area 5
ON
WHEN Back Yard: Water Area 6
ON
WHEN Back Yard: Water Area 7
ON
WHEN Back Yard: Water Area 8
ON
Execution Order: 1 2 3 4 5 6 7 8
Nesting…….Execution order



When a button is executed, all of the items within the button are executed
and placed on a ‘stack’. A stack is a programming term that reflects the
order in which items are executed. Think of a stack as index cards. As
each programming line is executed, an index card is written stating what
the system should do next. One card can only be placed on top of the
card that preceded it. When the system is executing the cards, it only
pulls from the bottom. Since the system is ‘stack’ based, it searches for all
programming lines that match a ‘button’ that is being executed. Each item
within the button is placed on the stack and executed in the order in which
they were placed.
The term ‘nesting’ refers to a ‘button’ executing a ‘button’. In this
scenario, the second button is always placed at the end of the stack.
Therefore, the second button will only execute after the first ‘button’ has
completed its tasks. This can lead to some interesting results unless the
execution order of buttons is understood.
Notice that regardless where the ‘WHEN Front Yard: RUN Back Yard’ is
placed, Back Yard will always be executed after Front Yard.
Bathroom Heater on in During Cold Weather


Objective F: To turn on the bathroom heater for 30
minutes on weekday mornings(7:00 AM), but only when
there is someone home AND the outdoor temperature is
cold (below 45 degrees).
Solution:

7:00AM MTWTF & IF Outdoor Temp N/R & IF NIGHT (armed in night):
UNIT 5 ON FOR 30 MINUTES.

This program is utilizing a double conditional available in Omni II and
Omni Pro II. If the 1st conditional is cancelled, the 2nd conditional will
be cancelled also.
Cycling a Fan On & Off


Objective G: To have the bedroom fan cycle ON FOR 20
MINUTES and then OFF FOR 90 MINUTES while the
system is in the AWAY mode to keep the temperature
stabilized.
To be named in the NAMES section of PC Access



Flags: “Cycle Flag” “Cycle Timer”
Unit: Bedroom Fan
Solution:





1. WHEN AWAY: Cycle Flag OFF
2. WHEN Cycle Flag Off & IF AWAY: Bedroom Fan ON FOR 20 MINUTES
3. WHEN Bedroom Fan OFF & IF AWAY: Cycle Timer ON FOR 90 MIN.
4. WHEN Cycle Timer OFF & IF AWAY: Cycle Flag OFF
This program will save energy by reducing the amount of time the HVAC system
will run due to more even temperatures in the home.
Cycle Sprinkler Zones On & Off


Objective H1: To activate sequentially four sprinkler
zones (sprinkler valves), each of the zones to be turned
on for a specific amount of time on a regular daily time
schedule
Objective H2: To activate the same sequential sprinkling
routine as above, at any time of the day by running a
“Button” (Macro).

Solution H1:

2:30 PM MTWTFSS: Sprinkler #1 ON for 15 Min.

2:45 PM MTWTFSS: Sprinkler #2 ON for 15 Min.
3:00 PM MTWTFSS: Sprinkler #3 ON for 10 Min.
3:10 PM MTWTFSS: Sprinkler #4 ON for 20 Min.


Cycle Sprinkler Zones On & Off

Solution H2:

To be named in the NAMED section of PC Access
User Button: “Start Sprink”
 Flag: “Sprink Flag”

1.WHEN Start Sprink: Sprink Flag ON
 2.WHEN Start Sprink & IF Sprink Flag ON: Sprink #1 ON for 15
 3.WHEN Start Sprink & IF Sprink Flag ON: Sprink #2 ON for 15
 4.WHEN Start Sprink & IF Sprink Flag ON: Sprink #3 ON for 10
 5.WHEN Start Sprink & IF Sprink Flag ON: Sprink #4 ON for 20
 6.WHEN Sprink #4 OFF: Sprink Flag OFF



When the "START SPRINK" macro is activated, a Flag (SPRINK FLAG) is turned on. As long as
the Flag is "ON", each line of the program will be executed.
Next, SPRINKLER #1 will turn for a fifteen-minute duration. After the fifteen-minute period has
expired, SPRINKLER #1 will turn off, breaking connection to VALVE #1. The valve will shut off
and SPRINKLER #1 OFF will trigger SPRINKLER #2 to turn on. Similarly, SPRINKLER #3 will start
when SPRINKLER #2 OFF, and SPRINKLER #4 will start when SPRINKLER #3 OFF.
Cycle Sprinkler Zones On & Off








If the homeowner only wants to water depending on soil moisture or amount of
rainfall, this can be accomplished by using a "fixed type" moisture sensor or rain
gauge. The connection should be made to a zone (Zone 14 here) that is configured
as an “Auxiliary” zone type. When the moisture or rainfall exceeds a fixed point, the
sensor will make the zone not ready. The condition should be added to the first line
of the "START SPRINKLER" macro:
WHEN START SPRINK &IF MOISTURE SENSOR SECURE: SPRINK FLAG ON
If at any time, the homeowner would like to stop the sprinkler sequence, you can
create an "END SPRINK" macro button. This macro will shut off the current
"SPRINKLER" valve and terminate any pending programs under the "START
SPRINK" macro button:
1. WHEN END SPRINK: SPRINK FLAG OFF
2. WHEN END SPRINK: SPRINKLER #1 OFF
3. WHEN END SPRINK: SPRINKLER #2 OFF
4. WHEN END SPRINK: SPRINKLER #3 OFF
5. WHEN END SPRINK: SPRINKLER #4 OFF
HAI Special Training Offer
Omni LT Promo 11 (Limit two)
For professional Dealers / Installers
 Package

Includes:
OmniLT controller1

Universal Console with trim ring
1105W Dealer Windows
PCAccess
Two Way X-10
Lock and Keys
Serial Cable
RJ31X telco jack and cable
Sample home control programs
(computer not included)

$551 Value….Only $ 459.00







HAI Special Training Offer #2
Omni II Promo 14 (Limit two)
For professional Dealers / Installers
Package Includes:










Omni II controller1
Flush Mount Console with Silk Screen
1105W Dealer Windows PCAccess
RC-80 Single Stage Thermostat
Two Way X-10
Lock and Keys
Serial Cable
RJ31X telco jack and cable
Sample home control programs
(Computer not included)
$1033 Value….SDP $949…Training special…$ 864.00 (includes shipping!)