Table of Contents
Trigger Basics
To create a trigger, you first need an action to execute. There are three types of triggers:
- Triggered by events identified by sensor data
- Triggered by time
- Triggered by conditions of variables and properties
Sensor Event Triggers
To create a sensor-based trigger, click the icon with a plus sign in a square in the top right corner of the screen.
Trigger Settings
- Give the trigger a clear name (recommended to base it on the trigger conditions)
- Assign it to the appropriate area
- There are three tabs:
- When: When the trigger will execute
- Conditions: Conditions under which the trigger will execute
- Action: The action to be executed and its parameters
When Tab
- Calendar: Feature for enterprise customers, allows creating detailed calendars in Gravio Coordinator
- Active Time: When checked, the trigger is only active during specified time periods
- Interval: Waiting time (in seconds) before the trigger can execute again
- Use Threshold: Only execute the trigger when sensor data threshold changes
- Skip still running: Only execute the trigger if the related action has finished
Conditions Tab
You can set conditions based on the sensor layer type:
- For door sensors: “open” or “close”
- For temperature sensors: temperature values and conditions like “more”, “less”, “equal”
- You can also combine multiple conditions using “and” or “or”
Action Tab
- Set the action to be executed
- You can also pass parameters and values to the action
- You can pass trigger properties as parameters
After creating the trigger, don’t forget to turn on the switch on the right to enable it. This connects the sensor and action.
Trigger Parameter Examples
Setting Trigger Active Time
- Device triggers execute when data matching the set conditions arrives
- By specifying an interval, you can prevent the next execution until a certain time has passed since the last execution
Threshold
This parameter applies to sensors that constantly send state data (temperature sensors, door open/close sensors, wireless switches, etc.).
Example 1: Temperature Sensor
If a threshold trigger is set and the trigger is set to above 20°:
- After the temperature exceeds 20° and the sensor sends data, the trigger executes, and won’t execute again until the temperature drops below 20° and then exceeds it again
- If the sensor sends data for 21°, 22°, 18°, 23°:
- With threshold trigger set: executes at 21° and 23°
- Without threshold trigger: executes at 21°, 22°, 23°
Example 2: Door/Window Sensor
If a door/window sensor’s threshold trigger is set to “close”:
- The trigger won’t execute again until the sensor sends “close” data and then opens once
- Without threshold set: executes every time “close” data is sent
Setting Trigger Execution Conditions
Key Layer and Layer
The key layer needs conditions specified. When conditions are met, the corresponding action executes.
Complex Condition Example
Example: Want to execute trigger only when CO2 exceeds 1000ppm AND motion sensor detects people in the room
- Specify condition in key layer for CO2 layer value exceeding 1000ppm
- Add motion sensor layer
- Motion sensor doesn’t send data when no people are present, so need to limit validity period of last value (e.g., 60,000 milliseconds = 1 minute)
- This way, if no motion detected in past minute, trigger won’t execute even if CO2 exceeds 1000ppm
Time-based Triggers
You can create triggers based on time and time-related parameters (intervals, days of week, days of month, etc.).
Schedule Types
- None: No schedule
- Interval: Execute trigger at regular intervals (e.g., every 10 minutes)
- Hourly: Execute trigger at specific minutes/seconds of each hour
- Daily: Execute trigger on specific days of week and times
- Monthly: Execute trigger on specific days of month and times
- Custom: Execute trigger at specific times using crontab-like syntax
Custom Trigger Syntax
| Unit | Required | Allowed Values | Available Special Characters |
|——|———-|—————-|—————————–|
| Seconds | Required | 0-59 | ・/,- |
| Minutes | Required | 0-59 | ・/,- |
| Hours | Required | 0-23 | ・/,- |
| Days | Required | 1-31 | ・/,-? |
| Months | Required | 1-12 or JAN-DEC | ・/,- |
| Days of Week | Required | 0-6 or SUN-SAT | ・/,-? |
Example: Execute once a year on February 4th at 14:23:51 → “51 23 14 4 2 *”
Trigger Variables and Properties
In device/timer triggers, you can pass trigger properties and trigger variables as arguments when executing actions.
Trigger Variables
Trigger variables are tv.
and are passed to actions as tv.
. Used in event-driven triggers that receive sensor data.
Trigger Properties
Trigger properties tp.
can be defined in the trigger settings dialog, and even when the same action is called, you can change behavior through conditional branching based on tp.
values.
Trigger properties can be set to these three predefined properties and any property name:
tp.KeyAreaName
: Sets the selected area name
tp.KeyLayerName
: Sets the name of the first key layer specified in conditions
tp.TriggerName
: Sets the name of the trigger being executed