1. Home
  2. Knowledge Base
  3. Cloud API
  4. IoT-Ignite Rule Editor

IoT-Ignite Rule Editor

IoT-Ignite Rule Editor is a drag&drop tool to create rules on the data obtained from gateways. These gateways must be registered to your account. If you want to learn how to register your gateways, please refer to IoT-Ignite Registration page. IoT-Ignite Rule Management document also explains what a rule means in IoT-Ignite platform.

In this article, we will explain how Rule Editor works and how we can create a rule using it. There are two types of rules in IoT-Ignite platform:

  • Cloud Rule
  • Gateway Rule.

Gateways powered by Ignite Agent does not send sensor data if these sensors do not have a data configuration. Therefore, it is mandatory to create and publish data configurations before running rules. Please refer to Sensor Data Configurations for further information.

Cloud Rule

Cloud rules run on the IoT-Ignite Cloud with the data gathered from gateways. There are three main components in the IoT-Ignite rule management. These are input, operation, and action. Basically, an action is executed if an input data matches the rule in operation. We will explain them in detail.

Input

Input is what the gateways send to IoT-Ignite Cloud. There are five different input types in the rule editor.

  • Sensor Data
  • Presence
  • Location Info
  • Rooted Info
  • Gateway Event

Sensor Data

In the sensor data input, we can choose any sensors that are connected to the gateways. In the sequel, the data gathered from these sensors are checked considering the operation. Equals, Not Equals, Greater, and Lower operations can be used with sensor data input.

Presence

In the presence input, we can choose a gateway, node or sensor. Afterward, the rule management system controls the presence of the selected gateways, nodes or sensors. If we add a presence input without selecting none of them, the rule works for the presence of all the gateways in the tenant. The only valid operation for Presence input is  Equals operation and the only valid values for Equals operation are “ONLINE” and “OFFLINE” string values.

Gateway Event

As we mentioned earlier, the other rule type in IoT-Ignite rule editor is the gateway rule. We will explain the gateway rules later in this article. In the cloud rules, the result of the gateway rules can be used as an input. It is only interested in the occurrence of the gateway rule. The only valid operation is Equals operation and the only value is “VALID” string.

Location Info

The gateways send different types of information to the IoT-Ignite Cloud. Application info, battery info, and network info are examples. In addition, location info is also an information that is sent to IoT-Ignite Cloud by the gateways. There are latitude, longitude, and location provider data in the location info. In the location info input, we choose a gateway which we want to track. Furthermore, the only valid operation for  Location Info input is Location operation.

Rooted Info

Rooted Information is another information sent from gateway like Location Info. We can create rules based on whether the gateway is rooted or not. Therefore, only a gateway is selected in the Rooted Info input. The only valid operation for Rooted Info is Equals operation and the valid values are “true” and “false” strings.

Operation

Operation is used for the control of the input data. There are six different operation types in the rule editor.

  • Equals
  • Not Equals
  • Greater
  • Lower
  • Location
  • Geofence

In addition, there are “Expire Duration” and “Valid for” parameters which are commonly used for all of the operations. An action is not triggered with repetitive input data in a period which is defined as the “Expire Duration” parameter. The unit of the expire duration is the minute. In addition, the rule must be valid during the “Valid for” parameter for action execution. “Valid for” parameter’s unit is also minute.

Relational Operators

The input data can be checked with the relational operators such as Equals, Not Equals, Greater, and Lower. For all the relational operators, we must set the value which will be compared to the input data.

Location

Location operation is used with Location Info input as it is mentioned before. In this operation, we define an area via drawing circle on the map. In addition, we must choose IN/OUT parameter for the tracking of the gateways.

Geofence

In the geofence operation, we must write the name of the geofence configuration as a value and choose IN/OUT parameter. Firstly, a geofence configuration should be defined. Afterwards, it is used in the rule. The gateways send only in/out info to the cloud considering the geofence configuration. For instance, we defined a geofence configuration named as “İstanbul”. The gateways that use this configuration send to the cloud “In İstanbul” or “Out İstanbul” data. Therefore, we must write İstanbul as value for the geofence operation.

Action

There are several options to execute as a result of the rule. Multiple actions can be connected to the same operation. Thus, we can trigger more than one action within the same condition and it is not required to define multiple rules which include the same inputs and operations. Eight actions were implemented in the rule editor for the cloud rule.

  • Send Mail
  • Send Message
  • IFTTT
  • Twitter
  • REST Service
  • Ring
  • Actuator Message
  • Change Policy

In some of these actions, we can integrate parameters into some fields with using their keyword. In the following table, you can see the parameters and their keywords to use in the actions.

Parameter Keyword
Sensor Data @@SENSOR_VALUE@@
Gateway ID @@DEVICE_ID@@
Node ID @@NODE_ID@@
Sensor ID @@SENSOR_ID@@
Time @@TIME@@

It is required to define configurations for the Send Mail, IFTTT, and Twitter actions. You can review External Services document to learn how to describe these configurations.

Send Mail

First of all, SMTP configuration must be done for the tenant to use Send Mail action. After that, we can send an e-mail as an action. An e-mail can be sent to the multiple recipients by using a semicolon (;) between e-mail addresses.

Send Message

You can send a message to the gateways. This message is directly displayed on the gateway’s screen.

IFTTT

First of all, IFTTT configuration should be done for the tenant. You can trigger an event which is defined in IFTTT. In the IFTTT action, event name must be written. The values parameters are optional. They are passed to the IFTTT event if it is needed.

Twitter

First of all, you should connect to Twitter and approve this service to use Twitter action. After that, you can send a tweet on behalf of the connected twitter account.

REST Service

You can call any external REST services as an action in the rule editor. In this action, you must set 3 parameters.

URL: External service URL that will execute the action of the rule.
Token: It is used for authentication to access REST services. It is located in the request header.
Data: It is the HTTP POST data parameter that REST service will consume.

You can use Calling REST Service as an Action in IoT-Ignite Rule document to get information in detail.

Ring

You can raise an alarm on the gateways with volume level and duration parameters. The duration parameter is in seconds. Ring file in the gateway can be determined manually. Otherwise, the default tune will be used.

Actuator Message

Several sensors are implemented as an actuator. You can send a message to these actuators to take an action. To illustrate, you can send “OPEN” message to the led actuator sensor to open led. The actuator message is specific for the actuator.

Change Policy

You can change the policy of the gateways as a result of a rule. This action requires that mode and policy parameters are defined. You can read Gateway Container-Mode document if you want to learn what the mode and policy refer.

Join

Join acts as a AND(&) operator. We can combine two rules via Join element.

Gateway Rule

Gateway rule is very similar to the Cloud Rule. Distinctly, gateway rules run on the gateways. The gateways do not require any internet connection to process the rules. At first, the rules must be sent to the gateways. Gateway Container-Mode document includes how to sent the rules to the gateways. The gateways collect data from any sensors and do edge processing. Gateways send an event data, which means the rule is valid and executed, to the IoT-Ignite cloud.

Gateway rules have the same components which are input, operation, and action. In the gateway rules, inputs, operations, and actions are limited compared to the cloud rules. Only Sensor Data input can be used. In addition to this, you can use Geofence operation to handle the gateways’ locations. Moreover, only Ring, Actuator Message, and Change Policy actions are available in gateway rule.

The other main difference is that the “Expire Duration” and “Valid for” parameters in operations are in milliseconds instead of minute.

Was this article helpful?

Related Articles