Skip to content

System Management Actions ​

Action Types ​

ActionactionTypeDescription
ACTION_SYS_RESTART6System restart
ACTION_SYS_FACTORY_RESET7Factory reset
ACTION_SYS_NTP_SYNC8NTP time synchronization
ACTION_SYS_OTA9OTA upgrade

Configuration Examples ​

The peripheral execution page is shown below. System actions affect device state; verify trigger conditions carefully before saving to avoid accidental restart, factory reset, or OTA trigger.

Example 1: System Restart ​

Scenario: Restart the device 500ms after platform sends restart command

Configuration Steps:

  1. Edit the rule in the Peripheral Execution Management page

  2. Click the Add Action button

  3. Fill in the action configuration:

    FieldValueDescription
    Action TypeSelect System RestartRestart device
    Execution Delay500Delay 500ms to let preceding actions complete
  4. Click the Save button

💡 Tip: System restart is forced synchronous execution; it is recommended to set a 500ms delay to allow MQTT messages to be sent


Example 2: Factory Reset ​

Scenario: Factory reset after button long-press for 10 seconds

Configuration Steps:

  1. Edit the rule, add an action

  2. Fill in:

    • Action Type: Select Factory Reset
    • Execution Delay: 0
  3. Click Save

⚠️ Warning: Factory reset will reset all configuration files to default values (device.json, network.json, protocol.json, users.json, peripherals.json, periph_exec.json, rule_scripts.json). WiFi credentials will be erased. After restart, the device enters AP mode. This operation is irreversible!


Example 3: NTP Time Synchronization ​

Scenario: Timer-triggered NTP time sync

Configuration Steps:

  1. Edit the rule, add an action

  2. Fill in:

    • Action Type: Select NTP Time Sync
  3. Click Save

💡 Tip: Daily time point trigger mode requires successful NTP sync to take effect


Example 4: OTA Upgrade ​

Scenario: Trigger OTA after platform sends upgrade command

Configuration Steps:

  1. Edit the rule, add an action

  2. Fill in:

    • Action Type: Select OTA Upgrade
  3. Click Save

💡 Tip: OTA upgrade requires network connection and pre-configured OTA server address


Method 2: JSON Configuration File Import ​

Complete Rule Example ​

Button Long-press 10 Seconds Factory Reset ​

json
{
  "id": "exec_factory_reset",
  "name": "Long Press Factory Reset",
  "enabled": false,
  "execMode": 0,
  "triggers": [
    {
      "triggerType": 4,
      "triggerPeriphId": "btn1",
      "operatorType": 0,
      "compareValue": "",
      "timerMode": 0,
      "intervalSec": 60,
      "timePoint": "",
      "eventId": "button_long_press_10s",
      "pollResponseTimeout": 1000,
      "pollMaxRetries": 2,
      "pollInterPollDelay": 100
    }
  ],
  "actions": [
    {
      "targetPeriphId": "",
      "actionType": 7,
      "actionValue": "",
      "useReceivedValue": false,
      "syncDelayMs": 0,
      "execMode": 0
    }
  ],
  "protocolType": 0,
  "scriptContent": "",
  "reportAfterExec": false
}

Precautions ​

  1. Synchronous Enforcement: System restart and factory reset actions are forced synchronous execution, not entering the async queue
  2. Irreversible: Factory reset will reset all user configurations to default values; use with caution
  3. Reset Content:
    • device.json - Restore default device name and NTP configuration
    • network.json - Clear WiFi credentials, restore AP mode (SSID: fastbee-ap, password: admin123)
    • users.json - Restore default admin account
    • protocol.json - All protocols disabled
    • peripherals.json - Clear peripheral configuration
    • periph_exec.json - Clear execution rules
  4. Pre-restart Delay: Recommended to set syncDelayMs to allow MQTT messages to be sent before restart
  5. OTA Prerequisites: OTA requires network connection and a valid upgrade server

FastBee | fastbee.cn