Skip to content

Timer Trigger (TIMER_TRIGGER) ​

Overview ​

Timer trigger (triggerType = 1) is used to automatically execute rules at fixed time intervals or at a specific time of day. Suitable for periodic collection, scheduled control, and other scenarios.

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

Timer trigger is suitable for "execute when it's time" rules, and is not appropriate for directly expressing "a collected value exceeds a threshold". If the action needs to collect first and then compare, consider using event trigger or poll trigger instead.

Trigger Modes ​

ModetimerModeDescription
Interval Mode0Trigger every N seconds
Daily Time Point1Trigger daily at specified HH:MM

Field Description ​

FieldTypeDescription
triggerType1Timer trigger
timerModeuint80=Interval mode, 1=Daily time point
intervalSecuint32Interval in seconds (effective when timerMode=0)
timePointString"HH:MM" format time point (effective when timerMode=1)

Configuration Examples ​

The peripheral execution page is shown below. When configuring timer trigger, verify whether the rule is enabled, the trigger interval or daily time point, and whether the actions are suitable for periodic execution.

Example 1: Interval Trigger (Every 60 Seconds) ​

Scenario: Execute a rule every 60 seconds

Configuration Steps:

  1. Click Peripheral Execution in the left menu

  2. Click the Add Rule button

  3. Fill in basic configuration:

    • Rule Name: Timed Data Collection
    • Report Data: ✅ Enabled (when results need to be reported)
    • Enable: ✅ Enabled
  4. Configure trigger:

    • Trigger Type: Select Timer Trigger
    • Timer Mode: Select Fixed Interval
    • Interval Time: Enter 60 (60 seconds)
  5. Configure actions: Add actions to execute

  6. Click the Save button


Example 2: Daily Time Point Trigger (Every Day at 08:00) ​

Scenario: Automatically execute every day at 8 AM

Configuration Steps:

  1. Create rule, name: Turn On Light on Schedule
  2. Trigger configuration:
    • Trigger Type: Select Timer Trigger
    • Timer Mode: Select Daily Time Point
    • Time Point: Enter 08:00 (format: HH:MM)
  3. Configure actions: Add light-on related actions
  4. Click Save

💡 Tip: Daily time point mode requires successful NTP time sync, otherwise it will not trigger


Method 2: JSON Configuration File Import ​

Complete Rule Example ​

Collect Temperature and Humidity Every 5 Minutes ​

json
{
  "id": "exec_dht_poll",
  "name": "Timed Temp/Humidity Collection",
  "enabled": false,
  "execMode": 0,
  "triggers": [
    {
      "triggerType": 1,
      "triggerPeriphId": "",
      "operatorType": 0,
      "compareValue": "",
      "timerMode": 0,
      "intervalSec": 300,
      "timePoint": "",
      "eventId": "",
      "pollResponseTimeout": 1000,
      "pollMaxRetries": 2,
      "pollInterPollDelay": 100
    }
  ],
  "actions": [
    {
      "targetPeriphId": "dht1",
      "actionType": 19,
      "actionValue": "",
      "useReceivedValue": false,
      "syncDelayMs": 0,
      "execMode": 0
    }
  ],
  "protocolType": 0,
  "scriptContent": "",
  "reportAfterExec": true
}

Turn Off Lights Every Day at 22:00 ​

json
{
  "id": "exec_night_off",
  "name": "Nightly Auto Light Off",
  "enabled": false,
  "execMode": 0,
  "triggers": [
    {
      "triggerType": 1,
      "triggerPeriphId": "",
      "operatorType": 0,
      "compareValue": "",
      "timerMode": 1,
      "intervalSec": 60,
      "timePoint": "22:00",
      "eventId": "",
      "pollResponseTimeout": 1000,
      "pollMaxRetries": 2,
      "pollInterPollDelay": 100
    }
  ],
  "actions": [
    {
      "targetPeriphId": "relay1",
      "actionType": 1,
      "actionValue": "",
      "useReceivedValue": false,
      "syncDelayMs": 0,
      "execMode": 0
    }
  ],
  "protocolType": 0,
  "scriptContent": "",
  "reportAfterExec": false
}

Precautions ​

  1. Minimum Interval: intervalSec can be set to 1 second minimum, but ≥ 5 seconds is recommended to avoid frequent execution
  2. NTP Dependency: Daily time point mode requires successful NTP sync (tm_year >= 100), otherwise it is skipped
  3. Time Window: Daily trigger fires only once within the specified minute (60-second deduplication window)
  4. First Trigger: Interval mode triggers immediately on start (lastTriggerTime is initially 0)
  5. Running Protection: If the previous execution has not completed, the current timer trigger is skipped

FastBee | fastbee.cn