Setting the valid time period for triggers
Device triggers execute when data arrives, that matches the set conditions. You can specify an interval so that the next execution will not take place until this interval has elapsed from the previous execution time.
This is useful for example, if data arrives from the device once every 2 seconds, but you want the trigger to run every 10 seconds. In this case specify 9000ms (about 10% lower than 10 seconds) as the interval.
By doing so, the received being received every 2 seconds will be triggered at the following timings:
- Received data 1 (trigger execution)
- Received data 2 (no action)
- Received data 3 (no action)
- Received data 4 (no action)
- Received data 5 (no action)
- Received data 6 (trigger execution)
- Received data 7 (no action)
- …
Threshold
This parameter accommodates sensors that constantly transmit state data (e.g., temperature sensors, door/window open/close sensors, wireless switches).
Example 1: If a temperature sensor is set to trigger by threshold and the trigger is set to >20°
, then after the sensor sends data above 20° and the trigger is executed, it will not be executed until the temperature drops below 20° and then above 20° again. If threshold triggering is off, the trigger will always be executed when the sensor sends data above 20°.
If the sensor sends data at 21°, 22°, 18°, and 23°:
- Threshold trigger is set, it will be executed at: 21° and 23°
- If threshold trigger is not set, it will executed at: 21°, 22°, and 23°
Example 2: If the threshold triggering setting is on for a door/window sensor and the trigger is set to close
, the sensor will send close data and the trigger will not be executed until it is opened once. If threshold is set to off, the trigger will always be executed when the sensor sends close data.
If the sensor sends close, close, open, close:
- Threshold trigger is set, it will be executed at: close, close
- If threshold trigger is not set, it will executed at: close, close, close
Example 3: If threshold triggering is on for a wireless button, and the trigger is set to click
, the trigger will only be executed if the state changes. If the threshold is set to off, the trigger will always execute upon a receipt of a click.
If the sensor sends click, click, double click, click:
- Threshold trigger is set, it will be executed at: click, click
- If threshold trigger is not set, it will executed at: click, click, click
Setting trigger execution conditions
Key Layer and Layers
The condition in a Key Layer needs to be specified. When the condition is met, the respective action is executed. You can have additional layers and conditions that can be connected via AND or OR condition.
Example 1: When the trigger condition of the door/window sensor is set to close
in the key layer
- Receive data
open
from door/window sensor. - Receive the data
close
of the door/window sensor << Trigger is executed here - Receive data
open
of the door/window sensor - Receive data
close
from door/window sensor << Trigger is executed here
Example 2: When the key layer is set to close
for the door/window sensor and the layer is set to 20° or higher
for the temperature sensor (if you have selected to use threshold triggering):
- Receive data
open
from door/window open/close sensor - When the temperature sensor condition is set to
20°
or higher (when trigger by threshold is selected) - Temperature sensor data
20.0°
received - Receive door/window sensor data
open
- Receive data
19.8°
from temperature sensor - Receive data
close
from door/window sensor (trigger not executed) - Receive data
open
from door/window sensor - Temperature sensor data
20.1°
received - Receive data
close
of door/window sensor << Trigger is executed here - Receive temperature sensor data
20.2°
Important Note: the two sensor data packets need to be received within the set interval time
Example 3: If the key layer is set to close
for the door/window sensor and the layer is set to 20° or higher
for the temperature sensor (if you have not selected to use threshold triggering)
- Door/window sensor data
open
is received - Door/window sensor data
close
is received (trigger is not executed) - Temperature sensor data
20.0°
received - Receive data
open
from door/window sensor - Receive data
20.1°
from temperature sensor - Receive data
close
from door/window sensor << Trigger is executed here - Receive data
open
from door/window sensor - Temperature sensor data
20.2°
received - Receive data
close
from door/window sensor << Trigger is executed here - Temperature sensor data
20.1°
received
Example 4: If the door/window sensor condition is set to close
in the key layer, the temperature sensor condition is set to 20° or higher
in the layer, and the humidity sensor condition is set to 30% or higher
in the layer
(When AND is selected):
- Receive data
open
from door/window sensor. - Receive data
close
from door/window open/close sensor (trigger is not executed) - Temperature sensor data
20.0°
received - Receive data
open
from door/window sensor - Receive data
20.1°
from temperature sensor - Receive data
close
from door/window sensor (no trigger is executed) - Receive data
open
from door/window sensor - Humidity sensor data
35%
received - Receive data
close
of door/window sensor << Trigger is executed here - Receive data
20.1°
from temperature sensor
Example 5: If the door/window sensor condition is set to close
in the key layer, the temperature sensor condition is set to 20° or higher
in the layer, and the humidity sensor condition is set to 30% or higher
in the layer
(When OR is selected)
- Receive data
open
from door/window sensor - Receive data
close
from door/window sensor (trigger is not executed) - Temperature sensor data
20.0°
received - Receive data
open
from door/window sensor - Receive data
20.1°
from temperature sensor - Receive data
close
from door/window sensor << Trigger is executed here - Receive data
open
from door/window sensor - Humidity sensor data
35%
received (no trigger is executed as door/window, the key layer, is stillopen
) - Receive data
close
from door/window sensor << Trigger is executed here - Temperature sensor data
20.1°
received
Example Equations
You can also set an expression which has to be met in order to execute the trigger.
Example 1: When the temperature of the temperature sensor is greater than 25°.
Expression: tv.Data >= 25
Example 2: When the temperature of the temperature sensor is between 20 and 25 degrees Celsius
Expression: tv.Data >= 20 && tv.Data <= 25
Example 3: IVAR face recognition receives FR_UNKNOWN (For Gorilla Face Recognition module)
Event type: Any event
Expression: tv.Data.common.type == "FR_UNKNOWN"
Example 4: IVAR face recognition receives unmasked data
Event type: Any event
Expression: tv.Data.iod.mask == "NONE"
Example 5: If you have arbitrary data coming from MQTT (e.g. “aircon=off”), you can have that as a matching condition:
Event type: Any event
Expression: tv.Data.aircon == "off"
In this case, the trigger gets executed if the aircon data from MQTT is off
and the temperature is higher than 25 degrees celsius.
Example 6: You have an EnOcean EEP D2-32-02 Current Sensor that will send you a JSON document like this: {"Current1":2.5,"Current2":0,"Current3":0}
You can trigger an action by using the following JSONPath as Expression: JSONPath("$.Current3", tv.Data) > 2
Example of trigger conditions for key layers and layers with additions
Example: If you want to trigger only when CO2 exceeds 1000ppm and when there is a person in the room using the motion sensor.
- In the key layer, specify the condition when the CO2 layer value exceeds 1000ppm
- Add the motion sensor layer
- Since the motion sensor does not send any data when nobody is present, we need to limit the validity of the last value. In this example we set the “Validity Period” to 60,000 milliseconds (1 minute).
- This results in the trigger not being executed, even if CO2 exceeds 1000ppm, if no motion has been detected within the last minute.
The “Validity Period” can also be set to 0
. In this case, the conditional judgement will be made based on the most recent value of the sensor.
Need more help with this?
Join our slack community for help