The IoT Portal is an event-driven architecture that enables applications to notify each other of changes in state as they occur and trigger corresponding actions. Cloud Trigger actions are the sequence of actions to be executed when an event is triggered in the platform. You need to add a trigger before adding the corresponding actions. For more information on adding a trigger, see Adding trigger.
Parameters for actions vary by type of action. For all of the Trigger actions, a Suggestions field will appear on the right-hand side. This is not a parameter for the trigger action. It is a container that lists all of the Trigger variables available to the action by the event and by preceding trigger actions. The contents of this list will vary depending on the event and trigger actions selected.
The Event variables and Action variables are shown in the Suggestions field can be used as the parameters for the current and subsequent actions. For example, if a trigger action uses Thing key as a parameter (e.g., alarm.publish action requires a Thing key parameter), and the Trigger variable $(event.thing.key) is available (e.g., from the property.change event), it can be used instead of a static Thing key.
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.
Copy and Paste Actions
It is possible to copy and paste a set of
trigger actions to reduce the effort while defining
the triggers. The following video explains the
steps to copy and paste trigger actions.
Following are the global variables used in any trigger action:
|$(trigger.exec_time)||Used to show the time of a trigger execution.|
|$(trigger.lastErrorMsg)||Used to show the last failed trigger action's error message and is overwritten by the next failed action (Failure route only).|
|$(trigger.lastErrorCode)||Used to show the last failed trigger action's error code and is overwritten by the next failed action.|
|$(time.now)||Used to set the current time to the trigger/campaign field.|
Additional trigger actions
There are three additional actions available:
- A Comment action is a note that can be placed on the canvas. It takes no inputs and has no outputs. It is used to display a comment to future viewers of the trigger.
- The Success and Failure actions are used to indicate whether the trigger terminated successfully or unsuccessfully. Failure actions are optional. There must be at least one Success action. Any branch that does not terminate at a Success action is considered a failure.
Following are the various trigger actions available in the IoT Portal: