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.
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.
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 184.108.40.206 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.
You can manage rules using the control unit web interface. You can access to the rules page in three modes:
- From the top menu, clicking on Rules button;
- From the devices statuses summary, clicking on the rules button of a device;
- 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.
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.
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.
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:
Undoing an entity
To undo an entity, click on the corresponding icon.
List of entities available
Now are shown all entities that you can choose to compose a condition.
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.
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 220.127.116.11. RELAY1 = True” means “if the relay 1 of the control board 18.104.22.168 is on”. A Boolean entity is selectable only on right side of a condition.
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.
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.
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).
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.
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.
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.
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:
You can add a condition as shown in following image:
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:
- The logical operator >. On the left side you have defined using a sensor entity; on the right side you have the other part of the formula.
- The arithmetic operator /. On the right side you have defined using a sensor entity; on the left side you have the other part of the formula.
- The arithmetic operator *. On the left side you have the number defined with a number entity; on the right side you have the other part of the formula.
- The arithmetic operator *. On the left side you have defined using a sensor entity; on the right side you have defined using a sensor entity.
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.
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.
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.
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.
You can turn on/off more relays of a control board at the same time using the “relays group” action.
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.
Rules activation actions
You can start/stop another rule using an action.
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 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.
To add an Email notification you have to set:
- Email subject;
- One ore more Email addresses (separated by a comma);
- The text body.
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>(22.214.171.124).TEMP</V>” means “the current temperature of the sensor 126.96.36.199”.
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.
After you have created a rule, you can see it in the list of rules for the group of the 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 icon, you can stop it and then the rule executor doesn’t evaluate the rule. After you have stopped a rule, the icon becomes . 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 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.