The trigger type, Trigger by Variable allows you to execute your Actions when a variable meets certain conditions. If your device has sent data and the variables are meeting those conditions, this action will be triggered.
There are 2 (two) categories inside of this trigger type:
- Single device: Allows you to watch a specific device in your list. Any data that is sent by that device will be tested against your conditions to decide if this action should be triggered or not.
- Multiple devices: Allows you to watch multiple devices. Any data that is sent by those devices will be tested against your conditions to decide if this action should be triggered or not. For this type, you must supply the tag key and tag value of the devices you want to watch.
It's important to note that only the Single device category allows you to set Trigger Unlock conditions. To learn more about Trigger Unlock.
Trigger Conditions
After setting up the device, you should set a condition for your action to be executed. To do so, you must head over to the Trigger section.
You can set multiple conditions in an action, if at least one of them results in a match, the action will be executed.
Notice that setting up multiple conditions will execute the action only once if any of the conditions are matched. This means that if you send two variables that would trigger the action at same time, it will only trigger one action.
- Select a variable: Select a variable to be tested. This will be one of the variables that will be compared against the data from the device.
Condition: The type of condition to test the variable. The available test conditions are:
- Less than: condition is true when the value of the variable is less than the value defined;
- Greater than: condition is true when the value of the variable is greater than the value defined;
- Equal to: condition is true when the value of the variable is equal to the value defined;
- Different from: condition is true when the value of the variable is different from the value defined;
- Any: condition is true whenever a new value of the variable is sent to the device;
- Between: condition is true when the new value is between a fixed value range;
- Value: The value to complement the condition. In the example above, the value for the condition is 15.
- Field type: The field type to use in the comparison. The system will force this field type when comparing the values from the device and the value defined in the condition (15). You could, for example, set the value to 0x1 and set this field to string in order to compare the number as a string.
The example above means that the action will be triggered when my_variable is less than 15.
Looking to create more complex logic statements? You can use the
Action to trigger an
Analysis, and then manually create a custom logic inside of the code.
Preventing action from running every time the conditions are met
To prevent your action from activating every time the conditions are met, you can lock it by defining Trigger Unlock conditions. Note that only the Single device type allows you to set Trigger Unlock conditions.