Trigger by Variable
The trigger type, Actions, Trigger by Variable, allows you to execute an action when a variable meets specified conditions. If a device sends data and the variables meet those conditions, the action will be triggered.
There are 2 categories inside this trigger type:
1. Single device
Allows you to watch a specific device from your device list. Any data sent by that device will be tested against your conditions to determine whether the action should be triggered.
2. Multiple devices
Allows you to watch multiple devices. Any data sent by those devices will be tested against your conditions to determine whether the action should be triggered. 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, see Trigger Unlock.
Trigger Conditions
After setting up the device, you should set a condition for your action to be executed. To do so, 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 the same time, it will only trigger one action.
- Select a variable: Choose 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 – true when the value of the variable is less than the defined value;
- Greater than – true when the value of the variable is greater than the defined value;
- Equal to – true when the value of the variable equals the defined value;
- Different from – true when the value of the variable differs from the defined value;
- Any – true whenever a new value of the variable is sent to the device;
- Between – true when the new value falls between a fixed range.
- Value: The value that complements the condition. In the example above, the value for the condition is
15
. - Field type: The field type used in the comparison. The system will enforce this field type when comparing the device’s data with the defined value (
15
). For instance, you could set the value to0x1
and set this field tostring
to compare the number as a string.
The example above means that the action will be triggered when my_variable is less than 15.
Preventing the 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.