Onboard Rules and Actions

Firmware version C4 for the ioBridge IO-204 web gateway, the IO-204-PRO web gateway (discontinued) and the Gamma PRO include onboard program space for you to create rules and actions. The onboard rules and actions operate when the web gateway is online or offline. They also let you create some very complex logic to control X10, servos, outputs, serial devices, etc without having a connection to a server (the IO-204-PRO does not support X10 and Servos). All of the “programming” is done thru web-based wizards on the ioBridge.com or ioBridgePro.com Interface.

Getting Started

Onboard Rules and Actions require that the web gateway has the C4 firmware or better. To access the Onboard Rules and Actions for your web gateway, follow these steps:

  • Select the Module tab
  • Choose the web gateway you want to program

* Then select the Onboard Rules subtab

What is a Rule?

A rule is essentially an if/then statement. “If the temperature is too high, then turn on the fan.” You can break that rule down into two distinct parts: a condition and an action. Onboard rules for the IO-204 follow the same pattern. You can create multiple conditions and multiple actions under each rule. If there are multiple conditions for a rule, all the conditions must be true for the action(s) to be executed. In rules with multiple actions, all of the actions will be execute when the rule is true.

Adding Rules

To add a rule, click Add Rule on the Onboard Rules and Actions part of the ioBridge.com Interface.

The IO-204 support three types of rules:

  • Standard Rules – logic that is continually checked to be true
  • Periodic Rules – logic that is checked to be true periodically
  • Push Update Rules – logic that allows you to push updates to the server when true

Standard Rules

A standard rule is a set of conditions that are continually checked and when they are all true, the associated actions are executed.

Periodic Rules

A periodic rule is a set of conditions that are checked periodically and at that time if they are all true, the associated actions are executed.

Push Update Rules

A push update rule allows you to push updates to the server. The updates can contain the state of a digital input, the value of the analog input, and the pulse count of a particular web gateway channel. Once the server has the updated value, you can created server-based actions to push messages to web services like email, RSS, Twitter, and web application APIs.

There six types of push update rules:

  • Analog Input (Push on Condition) – Push an analog input value to the server when the value hits a defined condition
  • Analog Input (Push at Interval) – Push an analog input value to the server periodically
  • Digital Input (Push on State Change) – Push the digital input state to the server when the digital input state changes
  • Digital Input (Push at Interval) – Push the state of a digital input to the server periodically
  • Pulse Count (Push at Limit) – Push the pulse count to the server when a limit is reached
  • Pulse Count (Push at Interval) – Push the pulse count to the server periodically
  • Pulse Count (Push at Interval and Reset Count) – Push the pulse count to the server and reset the pulse count.

Adding Conditions

Once a base rule is added, you can add conditions to the rule by clicking “Add Condition” under the rule. A rule with no conditions is always true. You can add more than one condition and in this case all conditions must be true in order to execute the associated actions.

There are 6 conditions that you can add to a standard or periodic rule:

  • Digital Input – Base condition on status of a digital input (On / Off)
  • Digital Output – Base condition on status of a digital output (On / Off)
  • Analog Input – Base condition on analog value (0 – 1023)
  • Pulse Count – Base condition on pulse count (0 – 4294967295
  • Variable Value – Base condition on variable value (0 – 255)
  • Module Status – Base condition on web gateway status (Online / Offline)

Variables

Included in the onboard rules program space are four variables that you can set using the rules. Each variable is designated by a letter, namely A, B, C, D. Each variable can hold a number from 0 – 255. Use variables to check whether or not an action has executed. Variables also help coordinate conditions from multiple rules.

Adding Actions

Once a base rule is added, you can add actions to the rule by clicking “Add Actions” under the rule. You can add more than one action to a standard or periodic rule.

Any of the functions of the web gateway can be an action. There are 8 different action types possible to add to standard or periodic rule:

  • Set Digital Output State
  • Set Pulse Count
  • Set Variable Value
  • Pulse Digital Output
  • Send Serial Out with Digital Output
  • Send Serial Out with Serial Smart Board
  • Set Servo Position
  • Send X10 Command

Synchronization

There is program space onboard the IO-204 web gateway that stores the rules and actions that you create. You design the set of rules using the ioBridge.com Interface and when you are all finished, you then synchronize the rules to the web gateway by clicking “Sync Rules”. The server responds with the percentage of the program space used when synchronization is successful. The interface warns you when the rules are out of sync – you want to sync after you have completed all of your changes. The web gateway will display a ”-” briefly when it receives the new rules.

Clearing Rules from Web Gateway

To clear the actions from the web gateway, click Clear Rules. This does not delete your rules but clears them from the web gateway’s memory space. The web gateway will briefly display a ”-” when the web gateway has cleared its rules.

Deleting Rules, Conditions and Actions

To delete a rule, condition, or action from the ioBridge.com interface, click the “X” and confirm that you want to delete that item.

Projects

Servo Controlled by Switch

This mini project involves moving a servo between two set positions based on the state of a button.

Part List

Procedure

  1. Connect Servo Smart Board to an open channel
  2. Set channel to Servo Mode
  3. Connect servo to open servo smart board channel
  4. Connect button to open channel set to I/O mode
  5. Add standard rule
  6. Add Digital Input and Variable Value conditions
  7. Add Set Servo Position and Set Variable Value actions
  8. Click Sync Rules

Rules Explanation

  • Rule 1: Conditions are true when the switch is off and variable is not equal to 0. The actions that execute are setting the servo to position 1000us and setting the variable to 0. This lets the rule only execute once vs. sending the position to the servo over and over. The position is set once since the we set the variable to 0.
  • Rule 2: Conditions are true when the switch is on and the variable is not equal to 1. The actions that execute are setting the servo to position 2000us and setting the variable to 1. This lets the rule only execute once.

Router Watch Dog

The IO-204 knows if the network connection is up or down. You can created a very quick project that reboots your router when ever it locks up or signal an alarm when the web gateway is offline.

Part List

Procedure

  1. Connect Buzzer board to Ch 2 set to I/O mode
  2. Connect Relay board to Ch 1 set to I/O mode
  3. Connect power lines of router through the relay board terminals
  4. Add rules based on Module Status condition
  5. Add Pulse Output actions to both the buzzer board and relay board channels
  6. Click Sync Rules

Rules Explanation

  • Rule 1 – This will beep the buzzer every 10 seconds when the web gateway is offline
  • Rule 2 – This rule will run every 120s when the web gateway is offline. The action pulses the relay board for 10 seconds turning the router off for 10 seconds and then back on.