Skip to content

OTA Management

The OTA Manager component provides 3 tools for creating OTA update packages, deploying them to devices over HTTP, and rolling back to previous firmware versions. These tools work with any ESP device that has an OTA-capable partition layout (see Partition Management).


Create a self-contained OTA update package as a ZIP archive. The package contains the firmware binary and a JSON manifest with version, checksum, and timestamp metadata.

NameTypeDefaultDescription
firmware_pathstr(required)Path to the firmware binary (.bin) to package.
versionstr(required)Version string for the update (e.g., "1.2.0", "2026.02.23").
output_pathstr(required)Path for the output ZIP package.
FileDescription
firmware.binThe raw application binary.
manifest.jsonMetadata: version, filename, size, SHA-256 hash, creation timestamp.
result = await client.call_tool("esp_ota_package_create", {
"firmware_path": "/build/app.bin",
"version": "2026.02.23",
"output_path": "/releases/ota-2026.02.23.zip"
})
{
"success": true,
"output_path": "/releases/ota-2026.02.23.zip",
"package_size_bytes": 312456,
"manifest": {
"version": "2026.02.23",
"firmware_name": "app.bin",
"firmware_size": 524288,
"firmware_sha256": "a1b2c3d4e5f6...64 hex chars...",
"created_at": "2026-02-23T12:00:00Z"
}
}

Deploy an OTA update package to a device over HTTP. Extracts firmware.bin from the ZIP package and POSTs it to the device’s OTA endpoint.

The target device must be running an HTTP OTA server — for example, the esp_https_ota component from ESP-IDF or a custom HTTP handler.

NameTypeDefaultDescription
package_pathstr(required)Path to the OTA ZIP package created by esp_ota_package_create.
target_urlstr(required)Device OTA endpoint URL (e.g., http://192.168.1.100/ota/update).
result = await client.call_tool("esp_ota_deploy", {
"package_path": "/releases/ota-2026.02.23.zip",
"target_url": "http://192.168.1.100/ota/update"
})

On success (HTTP 2xx):

{
"success": true,
"target_url": "http://192.168.1.100/ota/update",
"http_status": "200",
"firmware_size_bytes": 524288,
"version": "2026.02.23"
}

On HTTP error:

{
"success": false,
"target_url": "http://192.168.1.100/ota/update",
"http_status": "500",
"firmware_size_bytes": 524288,
"error": "Device returned HTTP 500"
}

Roll back to the previous firmware version by erasing the otadata partition. When otadata is erased (all 0xFF), the bootloader falls back to the factory app or ota_0 slot on the next boot.

The tool reads the device’s partition table to locate the otadata partition automatically, then erases that region.

NameTypeDefaultDescription
portstr | NoneNoneSerial port or socket:// URI. Required.
result = await client.call_tool("esp_ota_rollback", {
"port": "/dev/ttyUSB0"
})
{
"success": true,
"port": "/dev/ttyUSB0",
"otadata_offset": "0xf000",
"otadata_size": "0x2000",
"message": "OTA data partition erased. On next boot, the device will fall back to the factory app or ota_0 slot."
}

If the device does not have an OTA partition layout:

{
"success": false,
"error": "No otadata partition found -- device may not use OTA layout",
"port": "/dev/ttyUSB0"
}