Over-the-Air Technology (OTA) is a basic feature of IoT Platform. OTA allows you to update the firmware of IoT devices worldwide. This chapter uses an example to describe the OTA update process. Sample codes are also provided for configuring OTA updates on devices.
OTA update process for device firmware
- (Optional) The device reports the current firmware version to the topic:
/ota/device/inform/${YourProductKey}/${YourDeviceName}
.{ "id": 1, "params": { "version": "1-0-0" } }
- The device subscribes to the topic:
/ota/device/upgrade/${YourProductKey}/${YourDeviceName}
where IoT Platform pushes OTA notifications.The format of update notifications:
{ "code":"1000", "data":{ "size":11472299, "sign":"83254ac96e141affb8aa42cbfec9****", "version":"2-0-0", "url":"https://iotx-ota.oss-cn-shanghai.aliyuncs.com/ota/dbab6f742ae389b40db88fc2500b****/ck0q5lyav00003i7hezxe****.zip?Expires=1568951190&OSSAccessKeyId=cS8uRRy54Rsz****&Signature=nk0sogaxtyp7dYvKZnjNQ%2BZ8Q9****", "signMethod":"Md5", "md5":"83254ac96e141affb8aa42cbfec9****" }, "id":1568864790381, "message":"success" }
- The device downloads the firmware package from the URL that is provided in the update notification and performs a local update.
- The device reports the update progress to the topic:
/ota/device/progress/${YourProductKey}/${YourDeviceName}
.The format of report messages:
{ "id": 1, "params": { "step":"1", "desc":" xxxxxxxx " } }
- The device reports the updated firmware version to the topic:
/ota/device/inform/${YourProductKey}/${YourDeviceName}
.The format of report messages:
{ "id": 1, "params": { "version": "2-0-0" } }