Rules Endpoints
Rules define the conditions that trigger actions in IoT Platform . For example, a Rule can define that an email is sent to a specific person with a specific message when the temperature of a specific refrigerator goes over 20° and the water sprinkling system can be automatically turned on.
The definition of a rule comprises the following –
Name
Description
Entities
Specify the Application(s), Product(s) or Device(s) to which the Rule applies.
Schedule
Specify the schedule during which the Rule conditions are active.
Conditions
Specify the conditions that trigger the Rule, such as when a Device reading is within a specific value range, over a specific threshold, entering/exiting a geo-fence and so on.
Scheduled (CRON) Rules
Rules can also be triggered according to a CRON-defined schedule. For example, to report the status of a Device every half-hour. When a CRON schedule is defined for a Rule, then no other conditions in this Rule are relevant, including the schedule
AND Logic
Inside a Rule – To define that multiple Conditions must be met at the same time in order to trigger the Rule (AND), define multiple Conditions inside the same Rule.
OR Logic
Between Rules – Rules run at the same time. Therefore, you can define multiple Rules, each with their own Condition. If the Condition of two Rules exists for a specific Device, then both Rules are triggered when their conditions are matched.
Actions
Specify the operations that are activated when the conditions of the Rule are matched, such as sending an SMS/email, making a call, sending information to an ERP/CRM or activating a command on the Device (such as opening a light or closing a lock). You can also specify that an AlarmInstance is created when the Rule is triggered. Various fields of information from the Rule itself and/or from the Event that triggered the Rule and/or from the related Application can be used by the Action that is triggered by this Rule.
IoT Platform provides a variety of endpoints for handling Rules, as follows –
Rules/Post
Rules/Get (List)
Rule/Get (Specific)
Rules/Delete
Rules/Patch or Rules/Put