The remote configuration feature allows you to update the configurations of remote devices without the need to restart or stop the devices. The configurations include the system parameters and network parameters.
The remote configuration feature is supported in the device SDK. You must define
FEATURE_SERVICE_OTA_ENABLED = y in the device SDK. The SDK provides the linkkit_cota_init operation to initialize remote configurations. For more information, see Remote configuration.
You can update device configurations such as the system parameters, network parameters, and security policies by pushing an update package to a device. However, this method increases the workloads of firmware version maintenance, and the device 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 the device.
You can perform the following operations that are related to the remote configuration feature:
- Enable or disable the remote configuration feature.
- Edit configuration files and manage their versions in the IoT Platform console.
- Push configuration files from IoT Platform to multiple devices at a time to update the configurations.
- Enable devices to request configuration files.
The remote configuration feature is applied to the following scenarios:
- IoT Platform pushes configuration information to multiple devices at a time. Each device receives the information and modify the local configuration file.
- A device requests a configuration file from IoT Platform and performs an update.
The following sections describe the procedures in the preceding scenarios.
Scenario 1: IoT Platform pushes configuration information to devices
In the IoT Platform console, you can push a configuration file to all devices of a product at a time.
- Connect devices to IoT Platform.
For more information about how to develop devices by using the sample code, see theLink SDK documentation.Notice When you develop the devices, subscribe to the following topic that is used to push configuration information:
- In the IoT Platform console, edit a configuration file.
- Log on to the IoT Platform console.
- In the left-side navigation pane, choose .
- Select a product, turn on the Remote Configuration switch, and then click Edit.
- In the code editor of the Configure Template section, write or paste the configuration information 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.
- Click Save, and then click OK. You can push a configuration file to all devices of a product at a time. You can also enable a device to request a configuration file.
- Click Batch Update, and then click Confirm Update. Then, IoT Platform pushes the configuration file to all devices of the product.
If IoT Platform considers that the operation is not performed in a trusted environment after you click Batch Update, IoT Platform sends you an SMS message for verification. IoT Platform sends the configuration file to the devices only after the verification is completed.Note
- Operation frequency limit: You can perform a batch update only once per hour.
- To stop batch updates, you can turn off the Remote Configuration switch for the product. Then, IoT Platform stops pushing configuration files and denies update requests from devices.
- Devices automatically update the configurations after they receive the download URL
of the configuration file from IoT Platform. Note The download URL is valid for 30 minutes. Devices must download the configuration file within the validity period.
- 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 a configuration file. Find the configuration file and click View in the Actions column. In the dialog box that appears, you can view the content. You can also click Restore to This Version to restore the content of the selected version to the code editor. Then, you can edit the content and update the configurations of multiple devices at a time.
Scenario 2: Enable a device to request a configuration file
The following figure shows the process.
- Connect a device to IoT Platform.
For more information about how to develop the device by using the sample code, see theLink SDK documentation.Note When you develop the device, subscribe to the following topic that is used to send responds to update requests:
- In the IoT Platform console, enable remote configuration and edit a configuration file. For more information, see Step 2 in Scenario 1.
- Call the linkkit_invoke_cota_get_config operation to generate a request for remote configuration.
- Send the request to the following topic to query the latest configuration information:
- IoT Platform receives the request and returns the information to the following topic:
- The device downloads the configuration file by using the URL that is sent from IoT
Platform. For example, the device SDK for C 3.x provides the cota_callback callback function to process the download URL of the configuration file and perform an update.Note The download URL is valid for 30 minutes. Devices must download the configuration file within the validity period.