The remote configuration feature allows you to update the configurations, such as the system parameters and network parameters, of remote devices without the need to restart or stop the devices.

Prerequisites

  • The remote configuration feature is enabled in the IoT Platform console. If the feature is not enabled, log on to the IoT Platform console.In the left-side navigation pane, choose Maintenance > Remote Config. On the Remote Config page, you can enable this feature.
  • The remote configuration feature is supported in the device SDK. Add the FEATURE_SERVICE_OTA_ENABLED = y configuration item to the device SDK. The SDK provides the linkkit_cota_init operation for you to initialize remote configurations.

Introduction to the remote configuration feature

In many scenarios, developers need to update the device configurations, such as the system parameters, network parameters, and security policies of the devices. In most cases, you can update configurations by pushing an update package to devices. For more information, see Overview. However, this approach requires more work for firmware version maintenance, and the devices must stop running to implement an update. To fix these issues, IoT Platform provides the remote configuration feature. This feature allows you to update configurations without the need to restart or stop devices.

You can perform the following operations by using the remote configuration feature of IoT Platform:

  • Enable or disable the remote configuration feature.
  • Edit configuration files and manage their versions in the IoT Platform console.
  • Push configuration files from the cloud to devices to update the configurations of multiple devices at a time.
  • Enable devices to send requests for configuration updates.

The remote configuration feature is designed for the following two scenarios:

  • Push configurations from the cloud to devices: You can push configurations to multiple devices at a time in the IoT Platform console. After devices receive the configuration update, they modify on-premises configuration files.
  • Enable devices to send requests for configuration updates: A device can request new configurations from IoT Platform and perform updates.

The following two sections describe how to use the remote configuration feature in two scenarios.

Scenario 1: Push configurations from the cloud to devices

In the IoT Platform console, you can push a configuration file to all devices of a product at a time.

Remote configuration
  1. Connect devices to IoT Platform.
    Note When you develop the devices, configure the devices to subscribe to the following topic that pushes configurations: /sys/${productKey}/${deviceName}/thing/config/push.
  2. In the IoT Platform console, edit a configuration file.
    1. Log on to the IoT Platform console.
    2. In the left-side navigation pane, choose Maintenance > Remote Config.
    3. Select a product, turn on the remote configuration switch, and then click Edit.
      Remote configuration
    4. In the code editor of the Configure Template section, write or paste the configurations in the JSON format.
      Note The configuration template is applied to all devices of a product. You cannot push a configuration file to a single device in the IoT Platform console.
    5. After you write the configurations, click Save. The configuration file is generated. IoT Platform allows devices to send requests for the configuration file.
  3. Click Batch Update. In the message that appears, click Confirm Update. Then, IoT Platform pushes the configuration file to all devices of the product.

    If the system considers that the operation is not performed in a trusted environment after you click Batch Update, the system sends you a text message for verification. The system pushes the configuration file to the devices only after you pass the verification.

    Note
    • Operation frequency limit: You can perform a batch update only once per hour.
    • If you want to stop pushing configuration updates, disable the remote configuration feature for the product. Then, the system stops pushing configuration files and denies update requests from devices.
  4. Devices automatically update the configurations after they receive the download address of the configuration file from IoT Platform.
    Note The download address issued by IoT Platform is valid for 30 minutes. Devices must download the configuration file within the validity period.
  5. Optional. View and manage the versions of configuration files.

    By default, the latest five configuration files are saved in the IoT Platform console. After you edit and save a new version of the configuration file, the previous version is automatically displayed in the Configuration Version Record section. You can view the update time and content of the configuration files.

    Click View. In the dialog box that appears, you can view the content. Click Recover to This Version to restore the content of the selected version to the code editor. Then, you can edit the restored content and update the configurations to multiple devices at a time.

Scenario 2: Enable devices to send requests for configuration updates

In specific scenarios, devices need to request configuration updates.

Remote configuration
  1. Connect devices to IoT Platform.
    Note When you develop the devices, configure the devices to subscribe to the following topic that responds to update requests: /sys/${productKey}/${deviceName}/thing/config/get_reply.
  2. In the IoT Platform console, enable the remote configuration feature and edit configurations. For more information, see the steps in Scenario 1.
  3. Configure the devices to call the linkkit_invoke_cota_get_config operation to trigger the requests for configuration updates.
  4. Configure the devices to send requests for the latest configuration updates by using the following topic: /sys/${productKey}/${deviceName}/thing/config/get.
  5. IoT Platform returns the latest configurations to the following topic after it receives the requests: /sys/${productKey}/${deviceName}/thing/config/get_reply.
  6. The devices use the cota_callback callback function to process the download address of the configuration file that is sent from IoT Platform.
    Note The download address issued by IoT Platform is valid for 30 minutes. Devices must download the configuration file within the validity period.