Repository navigation
Show firmware updates in the official app and install them from its Update button (install is opt-in) - #255
virtitnerd wants to merge 64 commits into
Conversation
|
Hey @virtitnerd, is there a way to downgrade the robot firmware if needed? |
ROBOROCK_SERVER_OTA_ENABLE_INSTALL already updates the key in an existing config.toml; a freshly generated file now carries the [ota] section too, off unless the variable turns it on. The installation guide lists the variable with the other commonly set ones. The section is read by the firmware install change (Python-roborock#255); without that change the key is ignored. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
791a7ac to
c4e26ec
Compare
|
Good question, so I tested it. The robot does accept an older firmware as long as it is a real signed Roborock package. On a Qrevo Curv 2 Flow (a245) I installed 02.33.48 over 02.35.52 through the server. The cloud still hands out the package for an older release if you ask for that exact version ( The catch is that there is no cloud route that lists old versions, so you have to already know the version number. I'm adding to this PR a record the server keeps of every firmware it sees per model (version, package URL and md5, never pruned), so a user can pick an earlier version to reinstall later. Downgrading will be opt-in and off by default. So far this was tested on one robot model only. |
c4e26ec to
a06f6d7
Compare
Lash-L
left a comment
There was a problem hiding this comment.
Automated review: changes requested
This review covers the 11 commits unique to this PR (47243da727 to a06f6d7af6); #251 and #253 have their own reviews. The design matches the app and installs are opt-in, but two reproduced bugs affect how an install's result is reported, and the downgrade path needs tighter guards. 598 tests pass.
Confirmed:
- Endpoints match
IotApi.java:GET ota/firmware/{duid}/updatev2,GET ota/firmware/{duid}/upgrade/statusandPOST ota/device/{duid}/upgrade. The personal_center bundle usesupdatev2?lang&duidsand/upgrade/latest-stable. - The check response matches
OtaInfoBean(currentVersion, desc, releaseTime, updatable, version). There's no url or md5, and you only override currentVersion and updatable. - The install RPC matches the bundle's
otaMiIot:miIO.ota {app_url, file_md5, proc, mode, install}. The package URL comes fromuser/devices/{duid}/fw?version=, as in the app. - Opt-in and safeguards:
enable_installdefaults to false (returning 501), and downgrade also needsallow_downgrade.- The package is downloaded from the cloud, MD5-checked and served unmodified.
- It only installs when the robot is docked, idle, error-free and at 80% battery or more.
Unverifiable: that the robot verifies the package signature itself (our firmware dump only shows the Q7's boot-time check), and protocol 203's mqttOtaFirmwareVersion.
Blocking:
- Two presses both start an install (
ota_install.pystart()/_launch, ~215)._runningis set only after waiting on the cloud and a download of up to 30 minutes. Two concurrentstart()calls both returnedstarted: True.- The second task then sets the app's status to FAILED while the real install runs.
- With two robots,
clean_package_cachedeletes the other robot's package mid-download, and the singleOtaDryRun._activeslot makes the first robot's URL return 404. - Fix: take a lock, or set a "starting" marker before the first await.
- A brief disconnect counts as success (
ota_install.py:284). The states idle, idle, offline, idle were reported as success withfile_fetched=False. Require that the package was fully fetched and that the reported version equals the target. - The downgrade path skips the per-robot checks.
start_versionpassesknown_urland so skips the version gate (ota_dry_run.py:359). The catalog is keyed only by model, so a URL learned from another robot of the same model is sent without asking the cloud for this robot. There's no hardware or region check. - Any app session can install, including downgrades. Any Hawk-signed session can POST
/upgradeand/upgrade/versionfor any duid, with no ownership check. Make downgrade admin-only, or require a confirmation.
Should fix:
allow_replaydrops nonce checks for all firmware GETs (protocol_auth.py:618).- The "one-time" URL is reusable until its TTL, so the docs need correcting.
- The path-form status poll isn't forwarded to the cloud.
- There's no host allowlist in
package_md5. - Install state is lost on a mid-install restart.
- Please update the PR body: it says 550 tests and that the dry-run tools aren't included, but there are 598 and
ota_dry_run.pyships. - Rebase once #251 and #253 are reworked: the branch currently merges #251 without its last commit.
I've converted this PR to draft while these are addressed. Mark it ready for review again once they're fixed and it will go through another review.
This is an automated review by Claude Code, checked against the decompiled Roborock app (APK + device plugin bundles), python-roborock and a vacuum firmware dump. It can be incorrect, so please reply if any finding looks wrong.
The snapshot keeps the cloud login and the plugin catalogs fetched at sign-in, and the plugin routes serve those. Newer robots can need newer plugins than the snapshot holds, so CloudImportManager.refresh_plugin_catalogs asks the cloud again with the stored login and replaces only the catalogs. The sign-in now also stores the device identifier the cloud ties the login to. A rejected login or an empty answer leaves the snapshot as it was. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The last status, battery and error a robot sent, its last position and the map it was on, and when it last spoke or went offline, written under device_snapshots/ so it survives a restart. A robot that dies or loses Wi-Fi stops answering; this is what is left to say where it was. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
POST /admin/api/cloud/refresh-plugins re-reads them with the stored login, taking an optional platform type. GET /admin/api/cloud/plugins shows what is stored without a cloud request. Both return each plugin's version, API level and download URL. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Robot-originated frames update the store: status pushes (dps 120/121/122), get_status answers, and the map reply, which is decrypted with the nonce of whichever client's request asked for it. A closing robot connection marks the device offline at once. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Returns status, position, last_seen_at and offline_at; ?map=1 adds the last map the robot sent so a client can draw it while the robot cannot be asked. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A robot that went quiet before the store existed still has its last status, battery and map in the decoded MQTT log. On startup, in a background thread, devices the store has no snapshot for are filled in from that log: last time heard, last status, and the last map decoded with the nonce of the request that asked for it. Devices that already have a snapshot are left alone. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…h it The snapshot had the last map but not which segment is which room, so an offline map could only show generic labels. The proxy now records each get_room_mapping answer, the startup seed reads it from the MQTT log, and /last_known adds each room's name from the home data. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both calls return the same status object, so either one now updates the stored state. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… safely A refresh where one catalog errored replaced the good stored entry with the error, and the fallback then served iOS the Android zips. Merge catalog by catalog and keep the previous entry wherever the new one has an error. The snapshot holds the only stored login and is read on every request, so write it with atomic_write_inventory (also in submit_code). The refresh now re-reads the snapshot under a lock after the cloud wait, so a sign-in that finished meanwhile is not reverted; if the login changed, the refresh stops and asks to run again. The result gains kept_previous when entries were kept. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Every exception was reported as a rejected login with advice to sign in again, including timeouts, an unreachable cloud and RoborockRateLimit, which made users re-run the rate-limited code login. Only RoborockInvalidCredentials and RoborockAccountDoesNotExist now say to sign in again; rate limit, timeout and connection errors get their own text, and anything else says the stored catalogs were kept. The home-data helper now chains its RuntimeError to the last error so the original type is visible to the classifier. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…fline The regex needed endpoint before nonce and an all-word endpoint, but endpoints are base64 (they can hold + and /) and the app may send the keys in either order, so those robots never got maps or positions. Read the JSON instead. Robots rebuilt from the MQTT log now get offline_at set to when they last spoke, since nothing is connected right after a start; a long-dead robot no longer shows as online. Flushes write files after releasing the store lock. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… the trace worker Any rr/d/i publish used to count as the robot speaking, but app and bootstrap logins can publish on any topic; use the connection's device topic binding. The offline mark moves into the trace worker's close handler so queued packets cannot call mark_seen after mark_offline, and a close is ignored when the robot has already spoken on a newer connection. Mower pushes are skipped because their dps 121/122 are not state and battery. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The seed trusted any rr/d/i/ client-to-broker line. It now requires the topic's username to be the one the device with that id logs in with. The log does not record which login sent a frame, so this is weaker than the live bound-topic check, and the docs say so. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
package_family only read /rriotpkg/<hw>/, so an address without that folder skipped the hardware check. Both addresses must now name a hardware folder (also the regional <hw>/ form) and a file-name prefix, and both must match. The catalog test fixtures use the real address shape. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…kage If _RoutineMqttClient raised, the finally that releases the package was never reached and the package stayed pinned against clean-up. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
stop() waits only 2 seconds for the worker, and updates traced while it drained came after the server's own shutdown flush. The proxy now flushes after the join. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Plain == and != treated 2.35.52 and 02.35.52 as different in the version list, the previous-version hint, the pre-install learn step and the post-install memory. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A robot that reconnected but had not published yet showed offline until its first message. Its own-credential login now clears the offline mark and registers the connection, so closing it marks the robot offline again. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The status was written before the fetch and the app reads a status older than 30 minutes as FAILED, while the fetch itself may take up to 30 minutes. A slow fetch could show FAILED just as the install was starting. A fetch that really times out still ends as FAILED. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Resolves the conflicts left by the squash merges of Python-roborock#251 and Python-roborock#253: keeps the firmware routes, store and admin endpoints from this branch, keeps main's schedule create/update/delete routes, and checks the OTA routes before the schedule update in the HTTP handler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lash-L
left a comment
There was a problem hiding this comment.
Automated review: passed (nits) (re-review at 904965a)
Now that this has passed the automated review, I'll do a human review and then either request changes or merge it.
#251 and #253 were squash-merged into main on 2026-11-22, and this branch now has main merged in. git diff origin/main... shows only this PR's own changes (33 files, about 4,100 lines), and it merges cleanly. The commits that came from those branches (stored-login refresh message, plugin catalog age, B01 status, own-topic seeding, snapshot flush, online on own login) are already in main through #251/#253. This review covers the commits unique to this PR: b69eee5, 89e7a2d, 2715366, 70cfd88, plus the protocol 203 hook and the firmware routes.
Since the last review (c61c1fa → 904965a)
| Earlier item | Status |
|---|---|
Should fix: the hardware check fails open (ota_install.py:252) |
Fixed in b69eee5. ota_install.py:253-256 now refuses unless both addresses name a hardware folder and a file-name prefix, and both have to match. package_family returns "" for unknown path shapes (ota_dry_run.py:408-413), so these cases fail closed. Tests cover the folder-less and mismatched cases (tests/test_ota_install_safety.py:237-241). |
Minor: the MQTT client was built outside the try |
Fixed in 89e7a2d (ota_install.py:432-447). The package is now released if building the client raises. |
Minor: == where firmware_versions.same should be used |
Mostly fixed in 2715366 (ota_install.py:217, 267-274, 292, 464). One is left, see the nits. |
| Minor: a slow download used up the 30-minute status window | Fixed in 70cfd88. ota_install.py:295 resets START once the fetch finishes. |
Rechecked
- Wrong-firmware risk.
- The offered-update path (
start) only installs the package address the cloud gives for this duid (/user/devices/<duid>/fw?version=,ota_dry_run.py:468). Its MD5 has to match the file name, and the host has to be on the allowlist, including every redirect hop. - The other-version path (
start_version) does the same per-robot lookup. It also requires the catalog MD5 and the hardware folder and file-name prefix of the running package to match.
- The offered-update path (
- Reported version. It is taken from protocol 203 only when the robot publishes on its own device topic, and never from B01 (
mqtt_tls_proxy_server/server.py:653-663). An app session cannot fake the version that drives the downgrade decision. - Concurrency.
_claimis set before the first await (ota_install.py:146-152, 187-193), installs run one at a time, and packages in use are pinned. - Auth.
/ota/firmware/*and/ota/device/*need Hawk. The replay allowance covers only the four read-only GETs (server.py,allow_replay=).- Both upgrade routes check that the duid is in the inventory.
- A downgrade needs
confirm_downgradewith the same version in the signed body.
- B01 and older robots.
_RoutineMqttClientspeaks V1 only. A B01 robot does not answerget_status, so_refusalstops with "Could not read the robot's status" beforemiIO.otais sent (ota_dry_run.py:239-243). This fails closed.
Nits
ota_dry_run.py:467still comparescurrent != versionandoffered == versionwith plain string equality. If the cloud and the robot pad the version differently, the update is refused. That is safe but confusing. Usefirmware_versions.same.- For B01 and other non-V1 robots, an explicit refusal before the cloud lookup and package download (for example on the inventory's
pv) would give a clearer reason. It would also avoid downloading a package of a few hundred MB that can never be installed.
Unverifiable: whether the robot checks the package signature itself, the protocol 203 mqttOtaFirmwareVersion report, and the robot-side OTA download. These are not in the decompiled sources. The two package-address shapes the hardware check expects (/rriotpkg/<hw>/ and rrpkg-*/<hw>/) come from the author's hardware testing and do not appear in the references. If the real addresses differ, installs will be refused rather than mis-flashed.
Checks: 947 passed (full suite on 904965a), and it merges cleanly with main.
This is an automated review by Claude Code, checked against the decompiled Roborock app (APK + device plugin bundles), python-roborock and a vacuum firmware dump. It can be incorrect, so please reply if any finding looks wrong.
…same The gate used plain string equality, so a cloud that says 2.35.52 and a robot that reports 02.35.52 made the update refuse. The other version comparisons in ota_install already use same(). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ROBOROCK_SERVER_OTA_ENABLE_INSTALL already updates the key in an existing config.toml; a freshly generated file now carries the [ota] section too, off unless the variable turns it on. The installation guide lists the variable with the other commonly set ones. The section is read by the firmware install change (Python-roborock#255); without that change the key is ignored. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nload A B01 (or A01/L01) robot cannot be installed on by this code, which speaks the V1 protocol, but it only failed later with 'Could not read the robot's status' after the package of a few hundred MB had been fetched. The inventory already holds each robot's pv from the account's home data; carry it into the vacuum rows and refuse when it is set and not 1.0. A missing pv is treated as V1, so existing behaviour is unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Lash-L
left a comment
There was a problem hiding this comment.
Automated review: passed (re-review at 5e5def3)
Now that this has passed the automated review, I'll do a human review and then either request changes or merge it.
This re-review covers the two commits added since the last review at 904965a: 927fffb and 5e5def3. Together they change 5 files (+81/−1). #251 and #253 (which sat on #224) are all merged into main, so git diff origin/main... still contains only this PR's own work (34 files, about 4,200 lines). It merges cleanly with main.
Since the last review
| Earlier nit | Status |
|---|---|
ota_dry_run.py:467 compared versions as plain strings |
Fixed in 927fffb. Both the current-version check and the offered-version check now use firmware_versions.same (ota_dry_run.py:467). Two new tests cover the cloud and the robot writing a version with different padding (tests/test_ota_package_dry_run.py:233-245). |
| Non-V1 robots should be refused before any cloud call or download | Fixed in 5e5def3. The inventory now keeps pv (inventory.py:78, 184, 220). _unsupported_protocol (ota_install.py:180-186) refuses any robot whose pv is not 1.0. Both _start and _start_version call it right after the inventory lookup, which comes before firmware_update_info, resolve_package or any download (ota_install.py:159, 216). |
Rechecked
pvvalues: confirmed. python-roborock'sDeviceVersionusesV1 = "1.0",A01andB01(python-roborock/roborock/devices/device_manager.py:48-54), and it reads them from the home-data device'spv(roborock/data/containers.py:312). So checking for"1.0"is correct.- Claim release: confirmed. The new early returns sit inside the
try/finallythat sets and clears_claim(ota_install.py:148-152, 200-204). A refused robot therefore never blocks the next install. The testtest_a_non_v1_robot_is_refused_before_any_cloud_callchecks that no cloud call is made and no live status is left behind, for B01, A01 and L01. - Fail-safe when
pvis missing. If a robot has nopv(for example a local inventory without home data), the new check lets it through. The existingget_statusrefusal still stops it beforemiIO.ota(ota_dry_run.py:239-243), so it still fails closed. The only cost is a wasted download. - Nothing else changed. The opt-in gates, the MD5, host and hardware checks, Hawk auth, the inventory ownership check, the downgrade confirmation and the protocol-203 own-topic rule are the same as at
904965a. The findings from the last review still apply.
Nit (optional): A robot with an empty pv could be refused too once home data is known. That would save the download. It is not a safety issue.
Merge interactions: #261 merges cleanly with this branch. #252 conflicts in config.example.toml, mkdocs.yml, config.py and server.py. #176 conflicts in config.py and server.py. Both merge cleanly with main on their own, so whichever lands second will need a rebase. The conflicts look like neighbouring config and route additions.
Unverifiable: whether the robot checks the package signature itself, the robot-side OTA download (fwapi), protocol 203 mqttOtaFirmwareVersion, iOS behaviour, and the /api/v1/appplugin caller. None of these appear in the decompiled sources or the firmware dump. Only one model (a245) has been tested on hardware.
Checks: 954 passed (full suite at 5e5def3, up from 947), and the branch merges cleanly with main.
This is an automated review by Claude Code, checked against the decompiled Roborock app (APK + device plugin bundles), python-roborock and a vacuum firmware dump. It can be incorrect, so please reply if any finding looks wrong.
|
Two new commits on pr/firmware-install, on top of the merge from main (no history rewritten). Review items
The full suite passes (954 passed). I will add the early refusal and the padding-tolerant version check to the description. |
|
Okay @virtitnerd - this one needs the conflicts fixed as well! |
ROBOROCK_SERVER_OTA_ENABLE_INSTALL already updates the key in an existing config.toml; a freshly generated file now carries the [ota] section too, off unless the variable turns it on. The installation guide lists the variable with the other commonly set ones. The section is read by the firmware install change (Python-roborock#255); without that change the key is ignored. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested on a second model: Qrevo Edge 2 Pro (a226), EU region, 02.43.62 → 02.45.78, iOS app Update button, head
Smaller: during the install the app's progress jumps between 0 % and the real value. The server's own Update: fixes for all three, with tests, are in virtitnerd/local_roborock_server#2 against |
…version Found installing 02.45.78 on a Qrevo Edge 2 Pro (a226, EU region): - The EU cloud serves packages from cdn.awsde0.fds.api.mi-img.com, which was not in PACKAGE_HOSTS, so the install stopped with "The cloud's package address is not in the expected form". - A refusal before the robot was told anything stayed in the live status for 30 minutes and across restarts. The app's status poll got it back on every visit to the firmware page, showed "network unavailable" and offered no Update button. Such a refusal is now answered for 60 seconds only. - The a226 fetches the package in ranges and skips 3384 bytes (0-4095, 4096-54715079, 54718464-291835495), then installs it and reports the new version, yet the install was recorded as FAILED. The success rule now needs the robot to have fetched the package from this server at all; the version it reports afterwards already decides whether it installed.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks @AlexanderBabel, this was a very useful test on a second model. I reviewed your PR and merged it into this branch (29e9d53, your commit is kept as a parent). It covers the three things you found:
One trade-off: a robot that fetches a single range and then reports the target version after rebooting now counts as success. The exact-version and offline-then-idle checks are what guard that. I have not looked at the progress jumping between 0% and the real value yet. @Lash-L the conflicts are fixed, and the branch merges cleanly with current |
Replaces #254. This PR now carries both the update check (from #254) and the install.
Depends on: #251 (last-known state) and #253 (plugin catalog refresh, which itself sits on #224). The branch is
built on those and contains both, so until they land the diff also shows their commits. Merge #251 and #253 first;
after that the diff shrinks to this PR's own commits.
Why
A robot paired to the local server never talks to Roborock's cloud, so it never learns about new firmware and the
official app cannot install it. The server also answered the app's firmware calls with a generic success, so the app
could never even see that an update existed. Keeping a robot out of the cloud should not mean never updating it.
People in #158, #150 and #36 describe updating before moving to the local server for this reason.
What
Update check
The routes the app really uses are
GET /ota/firmware/<duid>/updatev2,GET /ota/firmware/updatev2?duids=...andGET /ota/firmware/upgrade/status?duids=...(the path form of the status poll is forwarded too). The server reads theupdate information from Roborock's cloud with the login it stored at sign-in and returns it, so the app shows the real
version and release notes. These routes require the app's signature. The four read-only check and status paths accept
a repeated signature (the app sends the check and the progress read with the same timestamp and nonce); the upgrade
routes do not.
GET /admin/api/cloud/firmwarelists every robot's status on the account for scripts. Without thestored cloud login the check is reported as unavailable.
Install (off by default)
Turn it on with
[ota] enable_install = trueorROBOROCK_SERVER_OTA_ENABLE_INSTALL=true(the variable wins). Withit off, the upgrade call is refused with an error instead of pretending to start.
With it on, the Update button (
POST /ota/device/<duid>/upgrade):/user/devices/<duid>/fw?version=...;the file name carries the MD5);
URL that is reusable until it expires (30 minutes) or the install ends;
more, which is the official app's own gate;
miIO.ota, download and install) and follows it through the reboot.The install counts as successful only when the robot fetched the whole package from this server, went offline and came
back idle, and then reports the target version. Otherwise the status is FAILED with the reason. The live status is
saved to
runtime/ota_live.json; after a server restart an install that was running is answered as FAILED, since theserver no longer watches the robot (the install is not resumed).
Other versions (opt-in)
The server keeps a catalog of every firmware package it learns of per model (version, address, MD5, released date,
size), and the admin routes
learn-versionsandscan-versionsadd cloud-confirmed versions to it. Withallow_downgradeon,POST /ota/device/<duid>/upgrade/versioninstalls another catalog version. For a version olderthan the one the robot reports, the JSON body must be
{"version": "<target>", "confirm_downgrade": true}naming thesame version; otherwise the answer is 409 with
needs_confirmation: trueand nothing starts. The package for anotherversion is always asked from the cloud for this robot, and refused when its checksum differs from the catalog's or its
hardware folder differs from the running version's. Package addresses must be https on the Roborock package hosts.
Two things that were not obvious and are handled:
Content-Length). Starlette lowercases them, sopackages are served with the names kept as written.
from that poll as a failed update, and polls it whenever the robot is silent for 90 seconds, which the reboot
causes. While an install runs the server answers that poll itself from the robot's real state (and
IDLE, whichthe app reads as success, only after the robot is back).
Reported version
The robot reports its version (protocol 203) on every connect. The server keeps it in the last-known state store and
uses it for the update check and the device list, because the cloud never learns the new version and would keep
offering the same update.
Security
Installs are opt-in, and downgrades need a second opt-in plus a confirmation in the request. Only a duid in the
inventory can be installed to. The server holds one account, so any signed app session can still start an upgrade to
the offered version when installs are enabled. The package is checked against the MD5 in the address the cloud returns.
I could not verify that the robot checks the package signature itself. The
latest-stablecall stays refused.Testing
tests/test_ota_firmware.py,tests/test_ota_install.py,tests/test_ota_install_safety.pyandtests/test_ota_install_state.pycover both URL styles,the signature requirement and the replay case with a fake cloud, the one-install-at-a-time claim, the success rule,
the per-robot package checks, the downgrade confirmation, the host allowlist and the saved status.
app's Update button (283 MB downloaded in 1m24s, installed in 2m15s, offline for 52s, robot reported 02.35.52 on
reconnect, app showed success). After the hardening, the flow was run again end to end on the same robot through the
server: a downgrade from 02.35.52 to 02.33.48 and the upgrade back, each about 4 minutes. An earlier install of a
Qrevo Pro's current package confirmed the delivery path. Other models are untested.
Not included
The admin debug endpoints that drove the robot's OTA command by hand and the cloud path explorer are not part of this
PR.
ota_dry_run.pydoes ship, since it is the download and watch engine the installer runs. Seedocs/firmware_updates.md.Related
#158, #150, #36 (context). There is no open issue for firmware updates; happy to open one if you prefer.