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 (Trigger events, or Events) and Event variables.
- Cloud trigger actions (Trigger actions, or Actions) and Action variables.
- Routes between actions.
- Success and Failure actions.
The Cloud triggers never make API calls instead they react to IoT Portal events and execute the defined actions. By default, 100 Triggers are allowed per second. Only Super Ops+ have rights to change it.
Cloud trigger events
Cloud trigger actions
|A 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 are the sequence of instruction that examine information (e.g., math.if), acquire data (e.g., property.current), manipulate values (e.g., math.expr), store information (e.g., thing.attr.set), and execute commands (e.g., method.exec). Each action has access to the Trigger variables made available in preceding Actions, including the Event 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 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 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.
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:
For floating point values, below is a table of supported precision values:
Triggers allow for different routing to occur based on binary success and failure paths as well as through decision actions (such as math.if). 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.