Issue OTA Command
- Topic:
- User-defined MQTT:
v1/watt/${PRODUCT_KEY}/${DEVICE}/ota/upgrade/command - Platform Default MQTT:
v1/user/${TENANT}/${DEVICE}/ota/upgrade/command
- User-defined MQTT:
- Permissions: Subscribe
- Payload Main Structure
| Parameter | Type | Required | Description | Range | Example |
|---|---|---|---|---|---|
| mid | UUID | true | Message ID | - | 3e681859-6917-4b9a-9afd-3f162cd185bd |
| type | str | true | Message type | ota_upgrade | ota_upgrade |
| data | data | true | Message content | - | See Payload - data |
| sub_device_uid | str | true | Primary device UID, only needed if a secondary device reports on behalf of a primary device | - | jHODSda39 |
| device_uid | str | true | Device UID | - | iYRkfVpi77 |
| timestamp | int | true | Message timestamp (ms) | (0, ∞) | 1696837112000 |
Payload - data
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| source | string | yes | Update target | ems_II |
| download_url | string | yes | Download link | http://example.com/ems\\_II |
| md5_code | string | yes | MD5 code | 50a2811e047dd49ace3801685eedb732 |
Payload Example
{
"trace_id": "577f5df0-65d6-432d-8aac-06hjkgfg2",
"mid": "ee2e8f09-b280-4e4d-bcb9-1529b703cfed",
"type": "ota_upgrade",
"device_uid": "test",
"timestamp": 1697789021000,
"data":{
"source": "ems_II",
"download_url": "http://example.com/ems_II",
"md5_code": "50a2811e047dd49ace3801685eedb732"
}
}
Synchronize OTA Result Response
Notes: The result will have two stages, meaning two different responses. Different stages correspond to different states.
-
First stage:
This is the preparation stage. After the file is downloaded and verified, the status is 2 - File is prepared.
Status codes: 1 - Update forbidden, 2 - Update prepared, 3 - Update preparation failed
-
Second stage:
This is the final result. If the update is successful, the status is 4 - Update successful.
Status codes: 4 - Update successful, 5 - Rollback successful, 6 - Rollback failed
-
Topic:
- User-defined MQTT:
v1/watt/${PRODUCT_KEY}/${DEVICE}/ota/upgrade/result - Platform Default MQTT:
v1/user/${TENANT}/${DEVICE}/ota/upgrade/result
- User-defined MQTT:
-
Permissions: Subscribe
-
Payload Main Structure
| Parameter | Type | Required | Description | Range | Example |
|---|---|---|---|---|---|
| mid | UUID | true | Message ID | - | 3e681859-6917-4b9a-9afd-3f162cd185bd |
| type | str | true | Message type | ota_upgrade | ota_upgrade |
| data | data | true | Message content | - | See Payload - data |
| sub_device_uid | str | true | Primary device UID, only needed if a secondary device reports on behalf of a primary device | - | jHODSda39 |
| device_uid | str | true | Device UID | - | iYRkfVpi77 |
| timestamp | int | true | Message timestamp (ms) | (0, ∞) | 1696837112000 |
Payload - data
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| source | string | no | Source | ems_II |
| version | string | no | Current version | v1.0.0 |
| target_commit_sha | string | no | Target commit SHA | 6f7g8h9i0j1k |
| target_version | string | no | Target version | v1.1.0 |
| final_commit_sha | string | no | Final commit SHA | 6f7g8h9i0j1k |
| final_version | string | no | Final version | v1.1.0 |
| status | int | no | Update status 1-Update forbidden 2-Update prepared 3-Update preparation failed 4-Update successful 5-Rollback successful 6-Rollback failed | 4 |
Payload Example
{
"trace_id": "577f5df0-65d6-432d-8aac-011789wfg2",
"mid": "389d9ac9-c660-4459-b9d5-f43160183552",
"type": "ota_upgrade",
"device_uid": "test",
"timestamp": 1725615497191,
"data": {
"source": "ems_II",
"target_commit_sha": "6a2bbabde8d42abc6f8fef7b31f60c5e69045245",
"target_version": "0.9.1",
"final_commit_sha": "6a2bbabde8d42abc6f8fef7b31f60c5e69045245",
"final_version": "0.9.1",
"status": 4
}
}
