Skip to content

Improve Supervisor update entity progress and data refresh#168712

Merged
MartinHjelmare merged 3 commits into
devfrom
improve-supervisor-update-entity
Apr 21, 2026
Merged

Improve Supervisor update entity progress and data refresh#168712
MartinHjelmare merged 3 commits into
devfrom
improve-supervisor-update-entity

Conversation

@agners
Copy link
Copy Markdown
Member

@agners agners commented Apr 21, 2026

Breaking change

Proposed change

After a Supervisor update completes, the Supervisor restarts. However, the hassio coordinator still serves stale version data until its next 5-minute scheduled refresh. During that window the Supervisor update entity reports the just-installed version as an available update, and pressing Update again triggers an install against a restarting Supervisor which fails with a confusing error.

Listen for the Supervisor STARTUP_COMPLETE event on the coordinator and trigger a debounced refresh, so all entities reflect the real state within seconds of Supervisor coming back online.

Also add progress tracking for Supervisor updates, which previously showed no download progress or installing state (unlike Core and add-on updates). Subscribe to the supervisor_update job to surface download progress. The Supervisor update HTTP call returns after the container download completes but while Supervisor is still restarting; the base UpdateEntity resets _attr_in_progress at that point. A separate _update_ongoing flag - cleared once the coordinator observes a changed installed version - keeps the installing state visible across the restart.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

agners and others added 2 commits April 21, 2026 14:10
After a Supervisor update completes, the Supervisor restarts. However,
the hassio coordinator still serves stale version data until its next
5-minute scheduled refresh. During that window the Supervisor update
entity reports the just-installed version as an available update, and
pressing Update again triggers an install against a restarting or
already updated Supervisor which fails with a confusing error.

Listen for the Supervisor STARTUP_COMPLETE event on the coordinator and
trigger a debounced refresh, so all entities reflect the real state
within seconds of Supervisor coming back online.

Also add progress tracking for Supervisor updates, which previously
showed no download progress or installing state (unlike Core and add-on
updates). Subscribe to the supervisor_update job to surface download
progress. The Supervisor update HTTP call returns after the container
download completes but while Supervisor is still restarting; the base
UpdateEntity resets _attr_in_progress at that point. A separate
_update_ongoing flag - cleared once the coordinator observes a changed
installed version - keeps the installing state visible across the
restart.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Covers the three new behaviors:

- Progress events from the supervisor_update job update in_progress and
  update_percentage on the Supervisor update entity.
- After install returns, in_progress stays True until Supervisor fires
  STARTUP_COMPLETE and the coordinator picks up a new installed version.
- Completion is detected by a change from the pre-install installed
  version, not by matching latest_version, so a concurrent upstream bump
  does not leave the entity stuck in progress.
@home-assistant
Copy link
Copy Markdown
Contributor

Hey there @home-assistant/supervisor, mind taking a look at this pull request as it has been labeled with an integration (hassio) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of hassio can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign hassio Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the hassio integration’s Supervisor update UX by (1) surfacing download progress via Supervisor job events and (2) triggering a debounced coordinator refresh after the Supervisor restarts, avoiding stale version/update state for several minutes after an update.

Changes:

  • Add progress reporting to the Supervisor update entity by subscribing to the supervisor_update job and exposing UpdateEntityFeature.PROGRESS.
  • Keep the Supervisor update entity in an installing state across the Supervisor restart using an _update_ongoing flag that clears once the installed version changes.
  • Refresh the Hass.io main coordinator (debounced) on Supervisor STARTUP_COMPLETE after a Supervisor update, and add tests covering progress + restart behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
homeassistant/components/hassio/update.py Adds Supervisor update progress support and preserves “in progress” across Supervisor restart until the coordinator observes a version change.
homeassistant/components/hassio/coordinator.py Listens for Supervisor STARTUP_COMPLETE (Supervisor update) events and requests a debounced coordinator refresh to avoid stale version/update info.
tests/components/hassio/test_update.py Adds tests for Supervisor update progress reporting and ensuring in_progress remains true until post-restart refresh/version change.

Supervisor updates can be triggered outside the UI (CLI, Supervisor
self-update). Those paths never call async_install on the entity, so the
_update_ongoing flag added for the user-initiated flow was never set.
The entity would show download progress from the supervisor_update job
subscription, then flip to "update available" for the few seconds
between the job completing and the coordinator refresh observing the
new installed version.

Capture the baseline version and set _update_ongoing the first time
_update_job_changed sees a running job, so the installing state is held
across the restart phase regardless of who initiated the update.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@mdegat01 mdegat01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one, LGTM 👍

@MartinHjelmare MartinHjelmare merged commit 79f12f6 into dev Apr 21, 2026
85 of 86 checks passed
@MartinHjelmare MartinHjelmare deleted the improve-supervisor-update-entity branch April 21, 2026 19:01
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants