Rule Engine

A Rule Engine is like a set of instructions that follows a logical condition. It works based on the principle of "When certain conditions are met, perform a specific task." You can think of it as a smart interpreter for if-then statements. The if-then statements in this case are called rules.

With the Rule Engine, you can create as many rules as you want. A rule will execute when the specified condition or conditions are met. However, if you do not want a rule to execute automatically after creating it, you can turn it off in the rules table. All other rules will still execute automatically.

To create a new Rule, click on Rule Engine in the left menu.

If this is the first rule you are creating, the Create your first rule page will be displayed.

Otherwise, the Rule Engine page will be displayed, showing the list of previously created rules.

On the Rule Engine page, click on the +Create Rule or +Create button.

The Rule Engine form will be displayed.

In the Rule Engine form, configure the following settings:

In the Name text box, enter a name to identify the rule within your organization.

Select the alert type that you want to show from the Alert type drop-down list. The following alert types are available:

  • Info - notifications that are not critical or alarming.

  • Warning - notifications that might require attention or action to prevent problems.

  • Danger - notifications that warn users about a hazardous or critical condition that needs to be addressed urgently.

A rule consists of three elements/blocks: IF, IS, and THEN. In the Rule Engine form, each element is presented in boxes with a light blue background. You can configure each element as follows:

IF

The IF block is used to select the measured data of a data field from one or more devices of a specific device type.

Select the device type from the Device type drop-down list.

Select the data field that you want to input for the rule from the Data field drop-down list.

Select the device to which you want to apply the rule, either by 'Select from list' or using the 'Select from map' option.

Select from list

  • Click on the text box and then, from the list, select the devices one by one. A tick mark will appear next to each selected device. You can click again on a selected device to deselect it.

  • If you have selected only one device, its name will appear in the text box.

  • If you have selected more than one device (e.g., 3 devices out of 20), the text in the text box will show as 3 of 20 selected.

Select from map

This option only works if your devices have been configured with geolocation.

  • Click on the Open map button.

  • A map will open in a model box.

  • Zoom (Ctrl + Scroll) into the area where your devices are located.

  • You can use a combination of circle and polygon shapes to define areas where the device could be.

  • Once added, you can edit the name of a circle or polygon by clicking on the edit (pencil) button.

  • You can delete a circle or polygon by clicking on the delete (bin) button.

Clicking on the delete button will not remove the devices shown inside the shape from the map.

  • Once finished, click on the Save button in the map modal.

  • Click on the + button to add more IF blocks and apply boolean operators like AND and OR between them.

IS

The IS block is used to compare the selected data using one of the following criteria:

Compare with constant - compares the measured values from selected data fields with a user-defined constant value using one of the following conditions.

  • Less Than - checks whether the measured value is less than the provided constant.

  • Less Than Or Equal - checks whether the measured value is less than or equal to the provided constant.

  • Equal - checks whether the measured value is equal to the provided constant.

  • Greater Than Or Equal - checks whether the measured value is greater than or equal to the provided constant.

  • Greater Than - checks whether the measured value is greater than the provided constant.

  • Not Equal - checks whether the measured value is not equal to the provided constant.

Select the Compare with constant option.

Select the condition from the drop-down list that you want to use as the comparison operator.

In the text box, enter the value you want to compare with the measured values form the data fields.

Compare with device measurement - compares the measured values from selected data fields with a data field from another device using one of the following conditions.

  • Less Than - checks whether the measured value is less than the provided constant.

  • Less Than Or Equal - checks whether the measured value is less than or equal to the provided constant.

  • Equal - checks whether the measured value is equal to the provided constant.

  • Greater Than Or Equal - checks whether the measured value is greater than or equal to the provided constant.

  • Greater Than - checks whether the measured value is greater than the provided constant.

  • Not Equal - checks whether the measured value is not equal to the provided constant.

Select the Compare with device measurement option.

Select the condition from the drop-down list that you want to use as the comparison operator.

Select the device type from the Device Type drop-down list.

Select the data field from the Data field drop-down list.

Select the device from the Device drop-down list.

Geofence - check whether the devices are located inside or outside the created geofence on the map using one of the following conditions.

  • In the areas - Check if the devices are currently positioned within the geofence.

  • Outside the areas - Check if the devices are currently positioned outside the geofence.

  • In the areas for last time - Check if the devices are currently positioned within the geofence, for a specified timeframe.

  • Outside the areas for last time - Check if the devices are currently positioned outside the geofence, for a specified timeframe.

Select the Geofence option.

Select the condition from the drop-down list that you want to use as the comparison operator.

If you have selected In the areas for last time or Outside the areas for last time, select a timeframe from the text box next to it. You can also enter any timeframe manually in the textbox.

Click on the Open map button and then select the devices from the map. You can use polygon shapes to select any number of devices.

THEN

The THEN block is used to define what actions to take if the selected criteria is true.

You can send an email to a provided email address or downlink a message to a selected device.

Email

Sends an email to a provided email address.

  • In the To text box, enter the recipient's email address. You can add more than one email address by separating them with semicolons.

  • In the Subject text box, enter the subject of your email.

  • In the Message text box, type in the message body that you want to send.

Sends a downlink message to a specific device.

  • Select the device that you want to send the downlink from the Device name drop-down.

  • Select the pre-configured downlink name from the Downlink name drop-down.

If you want to send emails and downlinks to multiple devices, you can add multiple THEN blocks by clicking on the + button.

The following configurations allow you to define the frequency of rule execution:

  • Execute every <timeframe> - executes according to the defined timeframe.

  • Trigger once - executes only once.

The Enabled button switch is used to enable or disable the rule. By default, any rule you create is set to Disabled unless you turn on the Enabled button switch to enable it.

After configuring the rule, click on the Save button.

Deleting a Rule

All the rules you have created are listed on the Rule Engine page. If you want to delete a rule, click on the rule in the list. The rule will open in edit mode. Scroll down the page, and click on the Delete button to delete the rule.

Last updated