Program is a universal logic task which contains a list of trigger conditions (Triggers) and list of commands (Commands) to execute when input triggers are triggered.
Program task can be enabled and disabled by setting the Enabled setting. The Restart On Retrigger setting defines the behaviour of the program execution when program is executed while previous execution is still running (e.g. can happen when program is using delays). If Restart On Retrigger is true the previous task is terminated and the program is executed from the beginning. If Restart On Retrigger is false the trigger will be ignored and the previous task will execute without interruption.
Programs can be executed manually or with triggers. Each trigger contains an input value and triggering condition. Multiple triggering conditions can be entered in the Triggers list. Program is executed when any trigger condition is met.
Picture 1: Program task settings
Trigger contains an object value and triggering condition. Conditions can be value comparisons (=, <, <=, >=, >) or value changes (ValueChanged). Triggers can be edited in the trigger editor form.
Picture 2: Trigger form
Conditions for triggering are rechecked with each update of the object value. By default the trigger is only triggered the first time the condition is met. If the same condition is met on next value update (i.e. device sends the same value two times in succession) trigger is not triggered. Setting the Allow Retrigger option enables running the task even when the same condition is met repeatedly with each value update.
Several different commands can be used for implementing different logical operations and command sequences. Command are edited in the command tree editor.
Sets output value to a constant value or to the value of an object.
Picture 3: Set value form
Calculation function can also be assigned to variable (e.g. +1 will give your object increased value by 1).
Executes object function.
Picture 4: Run form
If Checks the condition where input property is compared to a constant value or to a value of an object. The settings of the if command can be edited in If editor form.
Picture 5: If form
Any combination of subcommands can be inserted below the If command. Subcommands are executed when conditions are met. Else is executed if conditions for If command were not met. Else can only be inserted after If command.
Delays the program execution for a constant time or a delay defined by an input value linked to an object.
Picture 5: Delay form
Http Request Is used to execute commands on devices that support http API calls. Devices and other programs can be controlled with this command (i.e. XBMC, boxee, IP cameras, DVRs and other automation systems). Commands can be executed using Basic Authentication, Username and Password. Optionally the Username and Password settings can be injected into the URL string. If the POST Data is empty the call is executed using the HTTP GET command. If POST Data is filled the call is executed using HTTP POST command. Custom Headers (e.g. custom SOAP headers) and Content Type can be used with the call HTP POST. Text strings for URL and POST Data can include value parameters. Parameters can be added by clicking on the "..." button.
Picture 5: Http request form
Exits the program execution. Exit can be used to terminate the program when certain condition is met (e.g. in an If command).
Restarts the program execution after a constant time or a delay defined by an input value linked to an object.
Abort Commands are executed on program abort. Program is aborted when Running property is set to false or by calling the Abort() function. Program is also aborted on configuration restart when uploading the configuration. Commands are executed only if abort is called when program is still running. This can happen if a main program is waiting for some delay (Delay command is used).
Enabled, Running and Blocked values can be inserted into themes via Boolean control. Run and Abort functions can be called via RunFunction control.