Event-driven programming

Programming is based on events. When an event is triggered, other actions can take place. 

Example: If you program to lower the projector screen in the Theater by pressing a keypad button. You can program the receiver, DVD player, and projector to power up and start playing a DVD also. Programming the system is where the true value of Composer Pro becomes a reality. 

To program the system using Composer Pro, you drag and drop Events and Actions that you create for corresponding devices to a programming Script pane. The sections below show these panes.

Events (Programming pane)

Select an event (left side of the window):

Actions (Actions pane)

Select the action(s) (right side of the window):

Script (Script pane)

After you select the Event, Drag the Actions commands to the Script pane (middle pane):

The next table describes events, actions, and the script.

Programming Item

Description

Events

All programming begins with events. An event is a “when” statement. An event is the trigger report that something happened that results in an automation. Events happen instantaneously. On a keypad, pushing a button is one event. Actions all occur under Events. Examples of events include:

  • When the door opens
  • When it is 7:00 AM
  • When it is sunrise

Actions

After the event identifies to the system that something occurred, it sends actions. The following are the methods that are used by the system to define actions:

  • Commands. The Commands tab displays all available commands for a selected item in the Action Device Tree. A command is a “do” statement. Commands are actions the Director tells the device to do. Examples of commands include:

Light: on, off

Blu-ray player: play, stop, pause

Security device: arm, disarm

TV device: Power on/off, change channel

  • Conditionals. The Conditionals tab displays all available conditionals for a selected item in the Action Device tree. A conditional is an “if” statement. An “if” statement asks a true/false question to the device. Examples of conditionals include:

If door is open

If after 5 PM

If light is greater than 50 percent

  • Loops. The Loops tab displays all available loops for a selected item in the Action Device tree. A loop is another type of conditional. A conditional loop is a “while” statement. It is something that is ongoing. Examples of conditional loops:

While the sprinklers are on

While the motion detector detects movement

While a doorbell switch is being pressed

Warning: Using loops (WHILE statements) can potentially overwhelm the controller’s CPU. Use loops sparingly.

  • Delays. A delay stalls a program from running to ensure actions that occur at the right time.

Script

The linking of events and actions is defined in the script.

Tip: To configure or program devices, you can use properties, agents and variables also. These are considered advanced configuration and programming tasks. See “Using and Programming with Agents ” or “Examples: programming with variables.”