Step by step guide to rules

Introduction

After you’ve installed AirQ Networks devices and configured the control unit (according to the installation guide in the support page), the first questions that you will get are: how I can turn on/off a relay depending a sensor value? How I can send an SMS or an Email if there is a problem in my automation system? How I can turn on lights of my garden between midnight and six o’clock? Here there are all the answers. Thanks to the rules you can build the intelligence of your system. No programming skills are required. All in a few of steps using the software of the control unit.

Rules screenshot

A screenshot of the rules graphic interface. This rule means: “if temperature of sensor 111.0.0.0 is higher than 25°C, turn on the cooling valve (relay 1 of the control board 6.0.1.10)”

Rules

In AirQ Networks systems, a rule defines a behaviour. The behaviour is expressed with a simple concept: if something happens, do some actions. In other words, if conditions are verified, execute actions. Then a rule is composed of conditions and an action list.

Conditions

You can express conditions in a chain. All conditions are chained by logical operators AND or OR

condition A AND condition B AND ... AND condition N
condition A OR condition B OR ... OR condition N

You can specify also only one condition. The form of a condition is

entity1 COMPARE TO entity2

Where an entity is an element of the system (temperature of sensor X, relay of control board Y etc.) and the comparison is one of the operators (<,<=,=,>,>=).

So if you can express something like “if the temperature of sensor 101.1.2.3 is higher than 15°C and time is between 16:00 and 20:00”.

Later will be listed all the entities to compose comparisons.

List of actions

The actions define all the operations that the control unit must command. So a rule is something like this:

if CONDITION is verified
execute ACTION1, ACTION2, ..., ACTION N

Later will be listed all the available actions.

Manage rules

You can manage rules using the control unit web interface. You can access to the rules page in three modes:

  1. From the top menu, clicking on Rules button;
  2. From the devices statuses summary, clicking on the rules button of a device;
  3. From the dashboard, clicking on the rules button from the More menu of a box.

Rules are grouped by device, so after you access to the rules page, you will see a tab composed of all paired devices and the control unit. If there aren’t paired devices, you will see only the control unit tab.

You can define any rule in any group you want. The groupings are made to the device only as a matter of order.

Add a new rule

To add a new rule, select a tab and click on Add new rule button.

add a new rule

A form to add a new rule

For the adding of a new rule, three parts are mandatory:

  • Rule name;
  • At least one condition;
  • At least one action.

You can add conditions and actions clicking on the “+”button.

Add conditions

A condition is a comparison between two entities. Depending of its structure, an entity can stay on both sides of comparison or only on one side. In the interface, a condition is made of three selections.

selection

entity selection on the left side of a condition

 

comparison selection for a condition

Comparison selection for a condition

 

right side selection for a condition

Selection of an entity for the right side of a condition

a chain of conditions

A chain of conditions with AND operator

In the interface, after clicking on add icon for a condition, appears three selections: the first and the third allows you to select an entity, the second is for the comparison operator. As you can see in the pictures, a lot of entities are available. You can select a device, a scene or other entities provided directly by the control unit, like the Time Between operator and another rule. Later we list all available entities.

If you add more conditions, you can see a fourth selection (except for the last inserted condition) where you have to select the logical operator (AND, OR) in order to connect the conditions.

Remember you can select only all conjunctions or disjunctions (A list of conditions with AND and OR in the same chain is not allowed).

 

 

Delete a condition

To delete a condition, just click on X icon on the left of the condition:

delete a condition

Delete a condition clicking on the X icon

 

Undoing an entity

To undo an entity, click on the corresponding icon.

undo an entity

Undoing an entity clicking on the arrow icon

 

List of entities available

Now are shown all entities that you can choose to compose a condition.

Number entity

A number entity allows you to create a condition that compares an entity with a number. A number entity is selectable on both sides of a condition.

select number entity

Select a number entity for compare an entity with a number

set a value for a number entity

Set a value for a number entity

 

Boolean entity

A Boolean entity allows you to create a condition than compares an entity with a truth-value. For example, if you add the condition “if 6.1.2.3. RELAY1 = True” means “if the relay 1 of the control board 6.1.2.3 is on”. A Boolean entity is selectable only on right side of a condition.

select boolean entity

Select Boolean entity on right side of a condition

Boolean entity value choice

Boolean value is True or False

 

 

Sensor entities

You can use the data detected by a sensor in a condition. In the entities selection list you can see all the IDs of your paired sensors (preceded by its name if you have assigned it in the dashboard or in the device statuses summary view). The main data depends by the sensor type. For instance, an AirQ 101 sensor provides the temperature data, an AirQ 110 provides the humidity data, an AirQ 111 both. Other data are common to all sensor types and are the signal level, the battery level and linked. Main data, signal level and battery level are comparable with a number or with another sensor data. A linked status is comparable with a Boolean (True or False).

You can choose a sensor data on both sides of the condition.

sensor data type selection

Sensor data type selection

a temperature comparison with a number

A temperature of a sensor compared with a number

 

Control board entities

You can compose conditions based on control board statuses. In the entities selection list you can see all the IDs of your paired control boards (preceded by its name if you have assigned it in the dashboard or in the device statuses summary view). Depending of the control board model, you can choose inputs and outputs provided by the board. For example, an AirQ 300 provides 4 inputs and 2 relays.

In addition to the I/O statuses, you can choose the signal level (comparable with a number), verify if a control board is linked to the control unit, and if the board has the backup battery check if the board is powered with the mains or with the battery.

If you select an option on the left side of the condition, except for the signal level, the right side will automatically completed with a Boolean entity. However you change it as you wish.

options for a control board entity

Entity options for an AirQ 300 control board type

check a relay status condition

A condition that checks if a relay is off

 

If a control board has consumption-measuring feature, you can choose the consumption option. So you can compare the consumption with the consumption of another relay or with a number (the number expresses a value in watts).

water boiler consumption condition

a condition that checks if the boiler connected to the relay 1 is consuming more than 1000 watts.

 

Timer entity

The “time between” entity allows you to create a timed condition. So you can verify is the current time is in a time interval in the day. You can choose this entity only on the left side of a condition.

time between entity

A condition that becomes true if the current time is in the specified interval

 

Weather entity

You can compose a condition based on weather condition. After you’ve selected the weather entity, you can choose one of these options: weather condition, temperature, humidity, pressure, wind chill, wind direction and wind speed. The city of the weather depends by the configuration of the weather widget in Setup->General Settings->Weather widget settings. All entity options except for the weather condition are comparable with a number.

Weather condition option allows you to execute actions if a weather condition is verified. This option is comparable with a Boolean.

a weather condition

You can compose a condition using the weather condition

With the meteo entity you can define condition at the sunrise or at the sunset. A condition with sunrise/sunset means from the sunrise/sunset hour to the next hour. For example, if sunrise hour is 6:30am, the condition is true between 6:30am and 7:30am. If you want to execute an action only one time, you have to set a duration.

 

Arithmetic operators

Starting from the right side of the condition, you can compose more complex expressions using arithmetic operators (+,,*,/).

Now we explain with an example the use of arithmetic operators in the rules. Suppose you have two AirQ 111 sensors (for each sensor, ti is the temperature and humidity is hi) and you have to express the condition:

t_1>(1,2*(t_2*h_2))/h_1

You can add a condition as shown in following image:

A rule condition with arithmetic operators

A rule condition with arithmetic operators

A rule condition with arithmetic operators

From the previous image, you can see the expression tree. Starting from your formula, you have to select the arithmetic operators respecting the precedence of parentheses. In the example, you have to choose in sequence:

  1. The logical operator >. On the left side you have t_1 defined using a sensor entity; on the right side you have the other part of the formula.
  2. The arithmetic operator /. On the right side you have h_1 defined using a sensor entity; on the left side you have the other part of the formula.
  3. The arithmetic operator *. On the left side you have the number 1.2 defined with a number entity; on the right side you have the other part of the formula.
  4. The arithmetic operator *. On the left side you have t_2 defined using a sensor entity; on the right side you have h_2 defined using a sensor entity.

Scene entities

You can compose a condition using the statuses of a scene. You can check if a scene is ON/OFF or if a scene is enabled/disabled. You can compare a scene entity with a Boolean.

a scene condition

A condition with a scene entity

Rule entities

You can compose a condition using the statuses of another rule (check if the selected rule is started). This entity is comparable with a Boolean.

rule entity in a condition

A condition that verifies the statuses of another rule

List of actions available

Now are shown all actions that you can choose in your rules.

You can add, delete or undo an action clicking on corresponding icons, like for the conditions.

After you’ve added a new action, you can choice a device, a scene, a rule or SMS/Email notification.

An action example

An action example, with delay and duration not set

Every action has two parameters that alter its default behaviour:

  • Delay. The value in seconds of the action delay. When the conditions are verified, the action will be executed after the specified seconds. If the value is 0 (default value), there isn’t delay.
  • Duration. This value, in seconds, is the time interval of the validity of the action. The time interval starts when the conditions of the rule are fulfilled until to n seconds for the specified duration. After this time, the action may not be performed, but it will be only after the chain condition changes state (goes into not verified and then occurs again). If the parameter value is 0 (default value), there is no duration. This parameter can be used to avoid possible conflicts between the various rules that have been specified for your system.

Control board actions

You can switch on/off or pulsate the relays of every linked control board.

actions for a control board

An actions list for an AirQ 305 board

turn on a relay

An action that turns on a relay

 
turn off a relay

An action that turns off a relay

pulsate a relay

An action that pulses a relay

 

You can turn on/off more relays of a control board at the same time using the “relays group” action.

turn on/off a relay group

Turn on relay 1 and relay 3 at the same time

Scene actions

You can start/stop or enable/disable a scene using an action. If you have selected ON/OFF option and the dropdown menu has value True, the action starts the scene, otherwise stops it. If you have selected Enable option and the dropdown menu has value True, the action enables the scene, otherwise disables it.

scene actions

Scene actions

Rules activation actions

You can start/stop another rule using an action.

start stop a rule using an action

An action that starts another rule

Notifications actions

You can set an action that allows you to send an Email or an SMS, choose respectively the action sendEmail or sendSMS. After the choice, you can see the buttonnotification popup button. If you click on it, a module for setup the notification will appear.

To send notifications make sure to be connected to Internet. The SMS can be sent only if you have a sufficient quantity on your MyHome/Igloo account, otherwise the SMS can’t be sent.

Email notification popup

To add an Email notification you have to set:

  • Email subject;
  • One ore more Email addresses (separated by a comma);
  • The text body.
 
sms notification popup

To add an SMS notification you have to set:

  • one ore more phone numbers, each of one composed by a prefix and the effective number;
  • The text body. You can insert until 160 characters.
 

Take a look the left column and the text body of the two previous images. If you choose a device entity (the same used for the conditions) from the left column, a string in the form “<V>device.entity</V>” will be inserted starting from the cursor position in the text body. When the condition of the rule is verified, before sending Email/SMS notification, the software will replace the string with the correspondent entity value. For example, the string “<V>(101.2.1.0).TEMP</V>” means “the current temperature of the sensor 101.2.1.0”.

In order to choose how often you can send the notification, you have to change the values in Setup->Access credentials->Messages sending frequency. The default time value for Email messages and for SMS is 3600 seconds.

Rules operations

After you have created a rule, you can see it in the list of rules for the group of the device.

 

list of rules

list of rules for the group of the selected device

From the list you can do some operations:

  • Update a rule. You can edit the rule name, the conditions and the action. Click on the corresponding button to save the changes;
  • Delete a rule. You can delete the rule clicking on the corresponding button;
  • Start/Stop a rule. After you have added a rule, this is automatically started. If you click on the stop a rule icon, you can stop it and then the rule executor doesn’t evaluate the rule. After you have stopped a rule, the icon becomes start a rule. If you click on it, the rule will start.
  • Access the log of the rule. The software of the control unit has a log of the rules, where you can see history statuses of a rule (anomalies, sent messages etc.). Click on the rule log button icon to access to the log.

Log of the rule

As described before, you can access to a log that shows all old statuses of a rule. In Message column you can see the detail of the action or a software warning; in Success column you can see if the action has got success.

rule log