Skip to content

Support custom upgrade for custom repo in WLED - #172914

Closed
mik-laj wants to merge 1 commit into
home-assistant:devfrom
mik-laj:wled-repos
Closed

Support custom upgrade for custom repo in WLED#172914
mik-laj wants to merge 1 commit into
home-assistant:devfrom
mik-laj:wled-repos

Conversation

@mik-laj

@mik-laj mik-laj commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Breaking change

Proposed change

Alternative PR for: #172481
Related to: frenck/python-wled#2078 (Add the repo field in the Info object and the repo parameter in the .upgrade method)

I'm opening a PR here to show how we can implement support for updating multiple repositories in a single coordinator. This is still a draft, but I want to show my idea. If we agree on the implementation, we can close this PR and continue with the previous one.

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:

Copilot AI review requested due to automatic review settings June 3, 2026 13:32
@home-assistant home-assistant Bot added cla-signed integration: wled Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage labels Jun 3, 2026
@home-assistant

home-assistant Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Hey there @frenck, mind taking a look at this pull request as it has been labeled with an integration (wled) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of wled 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 wled 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds per-device repository support for WLED firmware updates, so that devices using custom WLED forks receive the correct release information and upgrade paths.

Changes:

  • The releases coordinator now tracks multiple repos (one per config entry) and fetches releases for each distinct repo.
  • The update entity registers/unregisters its repo with the releases coordinator and uses repo-specific release info and release URLs.
  • The wled dependency is temporarily changed to a git branch.

Reviewed changes

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

File Description
homeassistant/components/wled/coordinator.py Refactors WLEDReleasesDataUpdateCoordinator to manage a dict of per-repo releases instead of a single Releases object.
homeassistant/components/wled/update.py Adds repo registration lifecycle, overrides _handle_coordinator_update, and uses per-repo release info/URLs.
homeassistant/components/wled/manifest.json Changes wled package requirement to a git branch URL.

Comment on lines +10 to +12
"requirements": [
"wled @ git+https://github.com/LordMike/python-wled@codex/use-device-repo-upgrade"
],
Comment on lines +202 to +203
if self.repos.get(entry_id) != repo:
self.repos[entry_id] = repo.lower()

def unregister_repo(self, entry_id: str) -> None:
"""Unregister a repo."""
del self.repos[entry_id]
Comment on lines +212 to +219
result = {}
repos = set(self.repos.values())
for repo in repos:
try:
update = await WLEDReleases(
repo=repo,
session=async_get_clientsession(self.hass),
).releases()
Comment on lines +72 to +81
@callback
def _handle_coordinator_update(self) -> None:
"""Handle updated data from the coordinator."""
self.hass.async_create_task(
self.releases_coordinator.register_repo(
entry_id=self.coordinator.config_entry.entry_id,
repo=self._repo,
)
)
super()._handle_coordinator_update()
@mik-laj mik-laj closed this Jun 3, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

by-code-owner cla-signed integration: wled Quality Scale: platinum Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants