Skip to content

Make via-manager updates channel-aware and settle offline badges - #84

Merged
jfmlima merged 1 commit into
mainfrom
fix/via-manager-channel-and-status
Aug 7, 2026
Merged

Make via-manager updates channel-aware and settle offline badges#84
jfmlima merged 1 commit into
mainfrom
fix/via-manager-channel-and-status

Conversation

@jfmlima

@jfmlima jfmlima commented Aug 5, 2026

Copy link
Copy Markdown
Owner

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-releases endpoint previews the per-channel versions from the manager's index — an offline device cannot report what is available, so the device-reported available_updates the 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-side Shelly.CheckForUpdate response; if it ever differs, the parser yields None and the UI degrades to "no update on this channel" rather than installing anything.

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
jfmlima force-pushed the fix/via-manager-channel-and-status branch from dbd55bc to 3c87044 Compare August 6, 2026 00:09
@jfmlima
jfmlima merged commit 4af39bc into main Aug 7, 2026
24 of 26 checks passed
@jfmlima
jfmlima deleted the fix/via-manager-channel-and-status branch August 7, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Firmware Update via manager - Update channel [Bug]: (Firmware) Status detected - no update available

1 participant