Make via-manager updates channel-aware and settle offline badges - #84
Merged
Conversation
A device without internet access fails its own Shelly.CheckForUpdate, so scans left it stuck at Detected while a via-manager update for the same device reported it already latest. Scans now settle those devices against the manager's own index lookup, the same source local updates install from, so the badge and the via-manager path cannot disagree. The local source also silently forced the stable channel. The update dialog now offers the channel choice for both sources, backed by a new firmware-releases endpoint that answers from the manager's index, since an offline device cannot report what is available on either channel.
jfmlima
force-pushed
the
fix/via-manager-channel-and-status
branch
from
August 6, 2026 00:09
dbd55bc to
3c87044
Compare
This was referenced Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Make the firmware status badge and the via-manager update path agree on offline devices, and let via-manager updates install from the beta channel.
Fixes #81, fixes #82.
Context
A device without internet access fails its own
Shelly.CheckForUpdate, so scans left it stuck at "Detected" — which reads as an update available — while a via-manager update for the same device reported it already latest (#81). The two paths used different sources: the badge trusted the device's own cloud check, the local update path queried Shelly's index from the manager host. Scans now settle those stalled devices against the manager's own index lookup — the same source local updates install from — comparing exact build ids, so the badge reflects what the manager can actually serve. One index query per distinct app per scan, run concurrently; an unreachable index leaves the status as it was.The local source also silently forced the stable channel (#82). The channel selector now shows for both sources, the API accepts local + beta, and a new
GET /devices/{ip}/firmware-releasesendpoint previews the per-channel versions from the manager's index — an offline device cannot report what is available, so the device-reportedavailable_updatesthe internet source uses are empty for exactly the fleets that need this.Notes
The badge fallback checks the stable channel only: it is what an unqualified "update available" means everywhere else in the app; beta lives in the update dialog.
The dialog keeps showing a previously fetched release while a background refetch is in flight (standard stale-while-revalidate). The window is seconds, and the backend re-validates availability at submit time, so a vanished release fails with a clear error rather than installing something stale.
Bulk updates are untouched — adding a via-manager source there (#83) builds on this channel plumbing.
Validated read-only against real hardware (Gen4 Shelly 1PM, app
S1PMG4ZB): the scan badge, the device's own report, and the new firmware-releases preview all agree — installed 1.7.1 build differs from the index's stable 2.0.0 build, update offered on both paths. The index settling stayed correctly dormant for an online device. Not exercised: an actual via-manager install (mutating) and the offline settling path on hardware (unit-tested).Empirically validated against the live index: stable resolves correctly for every app checked, and no app publishes a beta entry today (the 2.0.0 beta cycle just closed), so the beta path currently reports "nothing published" end to end. The assumed
{version, build_id, url}shape of a future beta entry mirrors the documented device-sideShelly.CheckForUpdateresponse; if it ever differs, the parser yieldsNoneand the UI degrades to "no update on this channel" rather than installing anything.