Triggers

The Cloud triggers provide event-driven (Cloud trigger events) functionalities to instantiate the appropriate actions (Cloud trigger actions).  The rules are defined in the actions to react to the real-time events.  The condition defined in an event actively listens to the real-time data and when the threshold is met as defined in the event it causes a trigger to execute.  A trigger includes the following components:

  • Cloud trigger events and Event variables.
  • Cloud trigger actions and Action variables.
  • Routes between actions.
  • Success and Failure actions.

By default, 100 Triggers are allowed per second. Only Super Ops+ has the right to change it. Also, triggers are not allowed to have more than 1000 actions.

Cloud trigger events

Cloud trigger event is a condition that causes a trigger to execute. The  Cloud trigger has access to a set of variables collectively known as Trigger variables. The first set of variables available to the trigger are the Event variables. These variables will differ between events. For more information on  Events and Event variables, see  Cloud Trigger Events.

Cloud trigger actions

Cloud Trigger actions are the sequence of instruction that examine information (e.g.,  math.if action), acquire data (e.g.,  property.current action), manipulate values (e.g.,  math.expr action), store information (e.g.,  thing.attr.set action), and execute commands (e.g.,  method.exec action). Each action has access to the Trigger variables made available in preceding  Actions, including the  Event variables.

Trigger variables

The trigger variables represent the metadata that is accumulated during the course of executing a trigger.  It could be in the form of Event variables that are generated at the time the event occurs, or Action variables that are generated upon the completion of some actions.  These variables can be used as inputs to subsequent actions to enable complex manipulation of data within a trigger.

Event variables

Event variables will be of the format  $(event.NNN), where  NNN is the specific variable name.  Event variables express the point-in-time metadata from the particular event that occurred to execute the trigger.  Event variables include data that is current as of the execution of the trigger.

Action variables

Action variables will be of the format  $(action.X.NNN), where  X is the number representing the action that is the source of the variable (starting with zero) and NNN is the specific variable name. For more information on  Actions and Action variables, see Cloud Trigger Actions.  Actions that query data from a connection or thing will query the data stored in the database, newly published data may not be available if it was published within the same trigger.

Formatting variables

When specifying a variable, you can use a format syntax to render the value in a special way, for example, to restrict the number of decimal places.  To use this feature, when specifying a variable, you may add a ":" (colon) and the format string.  For example, if you query the current value of a property, it will output $(action.0.value) representing the current value of a particular property.  You could specify $(action.0.value:%.2f) to limit the precision of the property value to 2 decimal places.

Below is the table of supported formats:

FormatData typeDescription
%dIntegerbase 10
%oIntegerbase 8
%xIntegerbase 16 (lower case)
%XIntegerbase 16 (upper case)
%fFloatdecimal point notation (123.45)
%eFloatexponent notation
%UStringURL encode variable
%msStringTo retain milli seconds. By default, the milliseconds are truncated
%somStringModify the date to return the start of the month, truncating the date to the first day of the month, and the time to midnight.
%lenIntegerUsed as a string (or an array) variable modifier to return the length of the string (or array).

For floating point values, below is a table of supported precision values:

FormatDescription
%fdefault width, default precision
%9fwidth 9, default precision
%.2fdefault width, precision 2
%9.2fwidth 9, precision 2
%9.width 9, precision 0

Routes

Triggers allow for different routing to occur based on binary success and failure paths as well as through decision actions (such as math.if action). This allows for a single trigger to make decisions based on information it has acquired and execute different actions based on the result of the action. The next action executed, based on the result of the current action, is called the Route. The  Event has a single  Route leading to the first action to execute. Most actions only have the option for a success and a failure route. Some actions have three routes: failure, true, and false.

Success and failure actions

Although it is common for failure routes to lead to a  Failure action, it is possible that an action may fail to execute and the failure route leads to a corrective or an acceptable alternate action that would cause the trigger to terminate on a  Success action.

Data published on things may take time to become available in the database if multiple values are published at the same time. For example, calling a property.change event on property #1, and then reading the current value of property #2 may yield an old property value if it has not yet been stored in the database.

Trigger report generates reports of trigger events that has been executed with exact time, period and status of execution. For more information on trigger reports, see Viewing Trigger Report.

This section contains the following pages: