ISY-99i/ISY-26 INSTEON:Procedural Programs using Run If

From Universal Devices, Inc. Wiki

Beginning with beta 2.6.4 of firmware version 2.7 for ISY-26 and ISY-99i series, a new Run (If) command has been added. The former Run command is now Run Then; the Run Else command is unchanged. Instances of the new command within programs will appear as Run 'Program Name' (If). All former instances of Run 'Program Name' within programs will now appear as Run 'Program Name' (Then Path); instances of Run 'Program Name' (Else Path) will remain unchanged.

The Run (If) command will evaluate the If condition of the specified program, and run either the Then clause or the Else clause depending as the condition is True or False. When the If clause contains no condition, the Then clause will be run. In the new firmware, a program which is set to run at startup will likewise evaluate the If condition to determine which path to take, defaulting to the Then clause in the absence of a condition.

Why do we need Run (If), doesn’t the ISY automatically run programs based on the If conditions?

Yes, the ISY automatically runs programs when an event occurs that changes an If condition for an enabled program. The difference is that Run (If) always runs the program based on the conditions without needing an event to occur. In Addition, the program can be disabled such that it runs only when Run If/Then/Else are used, and never runs due to an event.

What happens if an event occurs that changes the If condition while the program is currently running?
  • If the program is not enabled then nothing happens, the program continues running as it currently is.
  • If the program is enabled then either the Then or Else will run (business as usual).


This new command provides the ability to run programs in a procedural manner without the awkward workarounds required previously. Simply uncheck the Enabled box so that the program does not run independently, and it becomes a callable procedure, complete with conditions. These procedure programs may be nested just as other programs. A main program may call several of these procedure programs consecutively in order to evaluate multiple conditional paths.

It should be noted that when a program is not enabled, its conditions are not automatically evaluated. Therefore, its Then and Else clauses may contain statements which alter the program's conditions, without causing the program to stop running the current path, as happens when the program is enabled.

As an example, consider a simple Welcome Home keypad button which turns on a group of lights, and optionally turns on an additional set of lights if the time is between sunset and sunrise:

Program Welcome Home - Enabled
If
        Control 'Welcome Home KPL non-toggle button' is switched Off
     Or Control 'Welcome Home KPL non-toggle button' is switched Fast Off

Then
        Set Scene 'Welcome Home Scene' On
        Run Program 'Welcome Home Dark' (If)

Else
   - No Actions - (To add one, press 'Action')


Program Welcome Home Dark - Not Enabled
If
        From    Sunset
        To      Sunrise (next day)

Then
        Set Scene 'Welcome Home Dark Scene' On

Else
   - No Actions - (To add one, press 'Action')

For additional examples, see:






ISY-26 INSTEON / ISY-99i Series INSTEON : How-To Guide