A trigger contains a set of conditions or thresholds that take system readings and activates if the threshold have been met. Typically a sensor reading or control input will cause a trigger. Triggers are used to set parameters for the system to respond to with actions. You can read more about the concepts of triggers here.
Below is an example of a trigger configuration.
{
"triggers": [{
"type": "sensor",
"source": "soil_1",
"key": "soil_dry",
"name": "Soil is Dry",
"actions": ["turn_on_pump"],
"frequency":"once",
"thresholds": [
{
"comparison":"gt",
"value":490
}
]
}]
}
The configuration above will listen for a sensor reading with the key soil_1
. If the value is > 490
the turn_on_pump
action will be triggered.
Option | Type | Required | Description |
type | [String] | Yes | Type of trigger. Options: sensor , control , time |
key | [String] | Yes | A unique slug to identify the trigger. Name will be slugged if key not set. |
name | [String] | No | Friendly display name of the trigger. Useful for UI. |
actions | [Array] | No | List of action keys to be triggered. |
sequences | [Array] | No | List of sequence keys to be triggered. |
Option | Type | Required | Description |
schedule | [String] | Yes | Cron like schedule string. Default: * * * * * See supported formats. |
Option | Type | Required | Description |
source | [String] | Yes | Key of sensor or control to listen for. sensor , control |
frequency | [String] | Yes | Number of times to trigger actions once trigger is active. Options: once , many |
thresholds | [Array] | Yes | Array of threshold configuration objects to evaluate the reading data to. See thresholds below. |
Option | Type | Required | Description |
source | [String] | Yes | Key of sensor or control to listen for. sensor , control |
nested_source | [String] | No | Key of nested data to check for if sensor returns object. |
frequency | [String] | Yes | Number of times to trigger actions once trigger is active. Options: once , many |
thresholds | [Array] | Yes | Array of threshold configuration objects to evaluate the reading data to. See thresholds below. |
Thresholds are conditions to check trigger values against and determine if the trigger should fire. Here are the threshold configuration options below.
Option | Type | Required | Description |
comparison | [String] | Yes | Comparison to run against value. Options: eq , ne , gt , gte , lt , lte |
value | [Integer] | Yes | Value to run trigger value comparison against. |
Learn more about triggers under the trigger docs.