Poll Trigger (POLL_TRIGGER)
Poll Trigger (POLL_TRIGGER)
Overview
Poll trigger (triggerType = 5) is used for periodic condition evaluation of local data sources. Primarily applied to Modbus slave sensor data collection, it also supports condition evaluation of local sensor cache data.
| Trigger | Input Source | Check Timing | Suitable Scenarios | Common Risks |
|---|---|---|---|---|
| Platform Trigger | MQTT / HTTP / Cloud commands | Match fields immediately upon message arrival | Remote on/off, parameter delivery, linkage control | Inconsistent field names, duplicate messageId, insufficient permissions |
| Timer Trigger | Local clock / cron / interval | Execute when time point is reached | Periodic reporting, scheduled on/off, night mode | NTP not synced, first trigger semantics unclear |
| Event Trigger | Button, sensor, system events | Match eventId when event is published | Button control, threshold alarm, state change | Debouncing, event name spelling, cached value expiry |
| Poll Trigger | Actively read peripheral or protocol data | Check conditions every pollInterval | Modbus collection, analog threshold, distance alarm | Too frequent, serial port busy, low memory frequency reduction |
Poll trigger actively consumes peripheral, serial port, or bus resources. Before configuring, confirm whether an event source is already available; only use poll trigger when there is no event source or periodic sampling is required.
Trigger Mechanism
- Periodically triggers at
intervalSecintervals - Executes data collection actions in the action list (e.g., MODBUS_POLL, SENSOR_READ)
- Collected data is evaluated against the trigger's
compareValuecondition - If conditions are met, the trigger is completed and data is reported
Field Description
| Field | Type | Description |
|---|---|---|
| triggerType | 5 | Poll trigger |
| timerMode | 0 | Interval mode (poll trigger only supports interval) |
| intervalSec | uint32 | Poll interval in seconds |
| pollResponseTimeout | uint16 | Modbus response timeout (ms), default 1000 |
| pollMaxRetries | uint8 | Maximum retry count, default 2 |
| pollInterPollDelay | uint16 | Minimum interval between two requests (ms), default 100 |
Difference from Timer Trigger
| Feature | TIMER_TRIGGER | POLL_TRIGGER |
|---|---|---|
| triggerType | 1 | 5 |
| Condition Evaluation | Does not evaluate conditions | Can evaluate collected data |
| Communication Parameters | None | Timeout/retry/interval |
| Use Case | Simple timing | Modbus/sensor polling |
Configuration Examples
Method 1: Web Interface Configuration (Recommended)
The peripheral execution page is shown below. When configuring poll trigger, verify the target data source, comparison value, poll interval, and execution action duration.
Example 1: Modbus Sensor Polling (Every 5 Minutes)
Scenario: Collect Modbus sensor data every 5 minutes
Configuration Steps:
Click left menu Peripheral Configuration → Switch to Peripheral Execution Management tab
Click the Add Rule button
Fill in basic configuration:
- Rule Name:
Modbus Environment Data Collection - Report Data: ✅ Enabled (auto-report collection results)
- Enable: ✅ Enabled
- Rule Name:
Configure trigger:
- Trigger Type: Select Poll Trigger
- Poll Interval: Enter
300(300 seconds = 5 minutes) - Response Timeout: Enter
1000(1000ms, default) - Max Retries: Enter
2(default) - Request Interval: Enter
100(100ms, default)
Configure action:
- Action Type: Select Modbus Poll
- Target Peripheral: Select the corresponding Modbus task
Click the Save button
Example 2: Polling with Condition Evaluation
Scenario: Only report when polled data > 500
Configuration Steps:
- Create rule, name:
Smoke Exceedance Alarm - Trigger configuration:
- Trigger Type: Select Poll Trigger
- Target Peripheral ID: Enter
smoke_sensor - Operator: Select
Greater Than (>) - Threshold: Enter
500 - Poll Interval: Enter
60(60 seconds)
- Configure actions:
- Action 1: Select Sensor Read, target
smoke_sensor - Action 2: Select alarm-related actions
- Action 1: Select Sensor Read, target
- Click Save
💡 Tip: Condition evaluation is automatically performed after data collection; subsequent actions only execute when conditions are met
Method 2: JSON Configuration File Import
Complete Rule Example
Modbus Environment Data Collection
{
"id": "exec_env_poll",
"name": "Collect Environment Quality",
"enabled": false,
"execMode": 0,
"triggers": [
{
"triggerType": 5,
"triggerPeriphId": "",
"operatorType": 0,
"compareValue": "",
"timerMode": 0,
"intervalSec": 300,
"timePoint": "",
"eventId": "",
"pollResponseTimeout": 1000,
"pollMaxRetries": 2,
"pollInterPollDelay": 100
}
],
"actions": [
{
"targetPeriphId": "modbus-task:0",
"actionType": 18,
"actionValue": "{\"poll\":[0]}",
"useReceivedValue": false,
"syncDelayMs": 0,
"execMode": 0
},
{
"targetPeriphId": "modbus-task:1",
"actionType": 18,
"actionValue": "{\"poll\":[1]}",
"useReceivedValue": false,
"syncDelayMs": 200,
"execMode": 0
}
],
"protocolType": 0,
"scriptContent": "",
"reportAfterExec": true
}Communication Parameter Tuning
| Scenario | pollResponseTimeout | pollMaxRetries | pollInterPollDelay |
|---|---|---|---|
| Short-range RS485 | 500 | 1 | 50 |
| Long-range RS485 | 2000 | 3 | 200 |
| Multi-device bus | 1000 | 2 | 150 |
Precautions
- Modbus Availability: Poll trigger checks if Modbus is available; skips if unavailable
- Running Protection: Skips current trigger if previous poll has not completed
- Failure Backoff: After execution failure, enters 30-second backoff period to avoid frequent retries
- Resource Protection: Heavy-resource rules (scripts/Modbus/multi-action) are skipped rather than degraded to sync when system resources are low
- Data Reporting: When
reportAfterExec: true, MODBUS_POLL and SENSOR_READ results are automatically reported via MQTT
