Skip to content

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.

TriggerInput SourceCheck TimingSuitable ScenariosCommon Risks
Platform TriggerMQTT platform commandMatch fields immediately upon message arrivalRemote on/off, parameter delivery, linkage controlInconsistent field names, duplicate messageId, insufficient permissions
Timer TriggerLocal clock / cron / intervalExecute when time point is reachedPeriodic reporting, scheduled on/off, night modeNTP not synced, first trigger semantics unclear
Event TriggerButton, sensor, system eventsMatch eventId when event is publishedButton control, threshold alarm, state changeDebouncing, event name spelling, cached value expiry
Poll TriggerActively read peripheral or protocol dataCheck conditions every pollIntervalModbus collection, analog threshold, distance alarmToo 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 ​

  1. Periodically triggers at intervalSec intervals
  2. Executes data collection actions in the action list (e.g., MODBUS_POLL, SENSOR_READ)
  3. Collected data is evaluated against the trigger's compareValue condition
  4. If conditions are met, the trigger is completed and data is reported

Field Description ​

FieldTypeDescription
triggerType5Poll trigger
timerMode0Interval mode (poll trigger only supports interval)
intervalSecuint32Poll interval in seconds
pollResponseTimeoutuint16Modbus response timeout (ms), default 1000
pollMaxRetriesuint8Maximum retry count, default 2
pollInterPollDelayuint16Minimum interval between two requests (ms), default 100

Difference from Timer Trigger ​

FeatureTIMER_TRIGGERPOLL_TRIGGER
triggerType15
Condition EvaluationDoes not evaluate conditionsCan evaluate collected data
Communication ParametersNoneTimeout/retry/interval
Use CaseSimple timingModbus/sensor polling

Configuration Examples ​

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:

  1. Click Peripheral Execution in the left menu

  2. Click the Add Rule button

  3. Fill in basic configuration:

    • Rule Name: Modbus Environment Data Collection
    • Report Data: ✅ Enabled (auto-report collection results)
    • Enable: ✅ Enabled
  4. 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)
  5. Configure action:

    • Action Type: Select Modbus Poll
    • Target Peripheral: Select the corresponding Modbus task
  6. Click the Save button


Example 2: Polling with Condition Evaluation ​

Scenario: Only report when polled data > 500

Configuration Steps:

  1. Create rule, name: Smoke Exceedance Alarm
  2. 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)
  3. Configure actions:
    • Action 1: Select Sensor Read, target smoke_sensor
    • Action 2: Select alarm-related actions
  4. 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 ​

json
{
  "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 ​

ScenariopollResponseTimeoutpollMaxRetriespollInterPollDelay
Short-range RS485500150
Long-range RS48520003200
Multi-device bus10002150

Precautions ​

  1. Modbus Availability: Poll trigger checks if Modbus is available; skips if unavailable
  2. Running Protection: Skips current trigger if previous poll has not completed
  3. Failure Backoff: After execution failure, enters 30-second backoff period to avoid frequent retries
  4. Resource Protection: Heavy-resource rules (scripts/Modbus/multi-action) are skipped rather than degraded to sync when system resources are low
  5. Data Reporting: When reportAfterExec: true, MODBUS_POLL and SENSOR_READ results are automatically reported via MQTT

FastBee | fastbee.cn