Programming Triggers

Overview

Triggers can be programmed in various ways depending on the type of target device.

Controller triggers are programmed using the Trigger panel ( Triggers ) of the device’s Properties Management console.

Triggers for Production Things can be programmed in three different ways:

  1. Triggers programmed in the Things’ Production Template are inherited by the Template’s Production Things. Inherited triggers can be modified in individual Things and, when saved, their Production Template trigger will also be modified. The change will propagate to all the Things belonging to the Template.
  2. Triggers may be programmed in the individual Production Things Trigger panel accessible through the Thing’s Properties Management Console.
  3. Triggers may be programmed using the Bulk Actions window accessible through the Things Management Console.

This guide describes the process for programming triggers based on:

The guide also provides an example of an Online status change trigger.

To create a Trigger for your Production Template, Thing or Controller:

  1. Open the target device from its management console.
  2. Select General (General) -> Triggers (Triggers).
  3. Click on the New Trigger button (New).
  4. Give the trigger a Name and select the Event that will be used to program it.
New trigger

Data Published Triggers

To program a trigger based on Data published:

  1. Give the trigger a name (e.g. Temp Alert).
  2. Set Event to Data published.
  3. Enter and existing channel name (suggestions will be offered as you type the channel name), or enter a new channel name if it does not exist yet.
  4. If the data published is a structured JSON, select the Data Field whose value will be used to compute the trigger.
  5. Select the Rule Type. The following list contains links to the various Rule Type programming and testing guides available:
  1. Thresholds, which allow you to set Thresholds and program actions when the thresholds are crossed.
  2. Location which allows you to set geo-fencing boundaries and program actions based on device location relative to the geo-fence.
  3. State is used to program actions based on device state changes, or when a device remains in its current state.
  4. Bit mask used to program actions based on the value of individual bits of the data received by CloudPlugs IoT.
  5. Any Data is used to program actions when any type of data is received by the platform.
  1. You will then program the action(s) for each trigger created.
  1. Save the action.
  2. Save the Trigger
  3. Save the device or Production Template.
Note:
The Trigger will not work if the Production Template, Thing or Controller is not saved after the Trigger is created.

Online Status Change Triggers

To program a trigger based on the change of online status of a device:

  1. Give the trigger a name (e.g. Device Offline).
  2. Set Event to Online status change.
  3. Select the action(s) to be executed when:
  1. The device goes online.
  2. The device goes offline.
  3. The device changes state either from online to offline or viceversa.
  1. Supported actions are:
  1. Save the action.
  2. Save the Trigger
  3. Save the Thing, Controller or Production Template.
Note:
The Trigger will not work if the Production Template, Thing or Controller is not saved.

Example

Here is an example of an Online status change trigger for a Production Thing called demo-003.

We will create a trigger that:

  1. Sends and e-mail to two addresses when the device changes status from Offline to Online.
  2. Sends an SMS to two phone numbers when the device goes from Online to Offline.
  3. Sends an e-mail, every time the device changes status Online to Offline or viceversa.

The following screenshots show how the individual actions are created before the trigger and the device are saved. These actions have already been saved and have been re-opened for the screenshot.

Online action Offline action
Device online Device offline
Status change action
Status change
Trigger is saved Thing device is saved
Trigger saved Device offline
Still need help? Get in touch!
Last updated on 6th May 2021