ESP RainMaker Neo OTA Status Details JSON Formats
This document describes the JSON formats used for status details in ESP RainMaker Neo OTA job executions. These formats are used when devices report progress and status information back to AWS IoT Jobs.
Overview
Status details provide additional context about the current state of an OTA update. The ESP RainMaker Neo SDK converts internal status structures to JSON format before reporting to AWS IoT. The JSON format varies depending on the status type.
Four status types produce status details: IN_PROGRESS, SUCCEEDED, FAILED and REJECTED. The SDK also tracks two internal types, STARTING and DELAYED, that carry no JSON — a job update for those reports the AWS status with no statusDetails.
Status Types and JSON Formats
IN_PROGRESS Status
Reports download progress during firmware transfer. The progress percentage can be derived by (downloaded_bytes / total_bytes * 100)%.
JSON Format:
{
"downloaded_bytes": <bytes already downloaded by firmware>,
"total_bytes": <total byte size of firmware>
}
Fields:
downloaded_bytes(number): Number of bytes downloaded so fartotal_bytes(number): Total size of the firmware file in bytes
Example:
{
"downloaded_bytes": 262144,
"total_bytes": 1048576
}
SUCCEEDED Status
Reports successful completion of the OTA update.
JSON Format:
{
"fw_version": <firmware version of successful update>
}
Fields:
fw_version(string): The firmware version that was successfully installed
Example:
{
"fw_version": "2.1.0"
}
FAILED Status
Reports failure of the OTA update with reason.
JSON Format:
{
"reason": <reason for failure>
}
Fields:
reason(string): Description of why the update failed
The complete set of SDK-generated failure reasons:
Reason |
Meaning |
|---|---|
|
The transport-specific downloader could not be initialized |
|
Could not subscribe to the AWS IoT stream topics (MQTT transport) |
|
The binary’s embedded project name / firmware version did not match |
|
The downloaded image’s MD5 did not match the |
|
Signature verification failed (only reachable when
|
|
A post-download check other than the ones above failed, e.g. the filetype handler’s integration check |
|
The post-reboot validation of the new image failed |
|
The filetype handler did not call |
|
The handler requested a reboot but provides no |
|
The custom job-document callback reported failure (requires
|
|
Fallback when no more specific reason is available |
Applications may also report their own reason strings via esp_rmaker_ota_report_final_status().
Example:
{
"reason": "Image signature invalid"
}
REJECTED Status
Reports rejection of the OTA update with reason.
JSON Format:
{
"reason": <reason for rejection>
}
Fields:
reason(string): Description of why the update was rejected
Rejection Reasons:
Reason |
Meaning |
|---|---|
|
The running firmware is below the job’s |
|
The job’s |
|
The selected filetype handler tracks versions, but the job did not declare
|
|
No |
|
The |
|
Signature verification is enabled but no |
|
The |
|
The |
|
The |
|
The job declared a |
|
The lookup function returned no handler for that |
|
The handler context is missing a required callback, or implements only one of
the |
|
The custom job-document callback rejected the document (requires
|
Example:
{
"reason": "Firmware version too low"
}
Implementation Details
AWS IoT Job Execution Status Details
When reported to AWS IoT, these JSON strings are included in the job execution’s statusDetails.detailsMap field. This information can be retrieved using the AWS IoT Jobs API DescribeJobExecution operation.
API Details
API Operation: DescribeJobExecution
Parameters:
jobId(string): The unique identifier you assigned to this job when it was createdthingName(string): The name of the thing, or * if the job was not created with a thing name
Response Structure:
{
"execution": {
"jobId": "string",
"thingName": "string",
"status": "IN_PROGRESS | SUCCEEDED | FAILED | REJECTED | CANCELED | TIMED_OUT | REMOVED",
"statusDetails": {
// <status details are as per JSON formats described above>
"detailsMap": <status details>
},
"queuedAt": "timestamp",
"startedAt": "timestamp",
"lastUpdatedAt": "timestamp",
"executionNumber": number
}
}
Example API Call (AWS CLI):
aws iot describe-job-execution --job-id "AFR_OTA-custom-1704067200-abc123" --thing-name "my-device"
Example API Call (Python boto3):
import boto3
iot_client = boto3.client('iot')
response = iot_client.describe_job_execution(
jobId='AFR_OTA-custom-1704067200-abc123',
thingName='my-device'
)
execution = response.get('execution', {})
status_details = execution.get('statusDetails', {}).get('detailsMap', {})
Note: AWS IoT stores all values in the detailsMap as strings, regardless of their original JSON type.