In device use cases, if system parameters need to be updated for devices, such as device IP, port number, and serial port parameter, the remote configuration feature can be used to this end.
Remote device configuration supports two configuration update methods: active distribution by IoT Hub and active request by device. For scenarios where all devices under the same product need to update their configurations, the former can be used to distribute the configuration information to all devices through the remote configuration topic. For scenarios where certain devices need to update their configurations, the latter can be used.
$config/operation/${productid}/${devicename}
$config/operation/result/${productid}/${devicename}
Note:
${productID}
: product ID${deviceName}
: device name
{"type":"push",
"result":0,
"payload":{yourConfigurationMessage}
}
Parameter description:Parameter | Type | Description |
---|---|---|
type | string | The value is `push` for active distribution by IoT Hub.
|
result | int | Error code.
|
payload | string | Configuration information details |
After the device successfully receives the configuration information distributed by IoT Hub, it will get the configuration information by calling the callback function provided in the SDK and update the information into its system parameters. The logic of updating configuration parameters in this part should be customized by yourself.
{"type":"get"}
Parameter description:Parameter | Type | Description |
---|---|---|
type | string | The value is `get` for active request by device |
{"type":"reply",
"result":0,
"payload":{yourConfigurationMessage}
}
Parameter description:
Parameter | Type | Description |
---|---|---|
type | string | The value is `reply` for active request by device.
|
result | int | Error code.
|
payload | string | Configuration information details |
IoT Hub provides the configuration information management feature, and you can query the last five configuration information records in the console. After you edit and save the configuration information again, the last configuration information will be displayed in the configuration information record. You can view the number, update time, and configuration content for easy management.
Was this page helpful?