Skip to content

Migrate ZHA to SerialPortSelector#169099

Merged
puddly merged 7 commits into
home-assistant:devfrom
puddly:puddly/zha-migrate-serial-port-selector
Apr 27, 2026
Merged

Migrate ZHA to SerialPortSelector#169099
puddly merged 7 commits into
home-assistant:devfrom
puddly:puddly/zha-migrate-serial-port-selector

Conversation

@puddly
Copy link
Copy Markdown
Contributor

@puddly puddly commented Apr 24, 2026

Proposed change

This PR migrates ZHA from its custom serial port selection config flow to our new frontend-enhanced serial port selector. Since we no longer are concerned with individual serial port objects, formatting them for display, etc. a lot of tests can be dropped. I've also removed setting the integration title from the serial port info, since it no longer makes sense to do so.

Note: this migration removes two things:

  • The multiprotocol integration has been removed from the serial port selector.
  • The ZWA-2 removal has been removed. It will be re-added in a slightly different form in an upcoming PR.

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 April 24, 2026 19:53
@home-assistant home-assistant Bot added cla-signed has-tests integration: zha new-feature Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage Top 50 Integration is ranked within the top 50 by usage labels Apr 24, 2026
@home-assistant
Copy link
Copy Markdown
Contributor

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

Code owner commands

Code owners of zha 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 zha 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 migrates ZHA’s config flow from a custom serial-port picker to Home Assistant’s frontend SerialPortSelector, simplifying port selection and removing now-unneeded serial-port formatting/listing logic.

Changes:

  • Replace the custom “choose serial port” options with SerialPortSelector and adjust flow handling accordingly.
  • Remove custom serial port discovery/formatting helpers (including Yellow/multiprotocol/ZWA-2 specific handling that lived in list_serial_ports).
  • Update ZHA config flow tests to reflect the new selector input and resulting entry title behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
homeassistant/components/zha/config_flow.py Switches serial port selection to SerialPortSelector, removes legacy port listing/formatting logic, and updates how titles/placeholders are derived.
tests/components/zha/test_config_flow.py Updates config flow tests to pass raw device paths and reflects the changed behavior around entry titles and selector defaults.

Comment thread homeassistant/components/zha/config_flow.py Outdated
@puddly puddly marked this pull request as ready for review April 24, 2026 23:59
@puddly puddly requested a review from dmulcahey as a code owner April 24, 2026 23:59
Copilot AI review requested due to automatic review settings April 24, 2026 23:59
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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread homeassistant/components/zha/config_flow.py
@Hedda
Copy link
Copy Markdown
Contributor

Hedda commented Apr 25, 2026

Note: this migration removes two things:

  • The multiprotocol integration has been removed from the serial port selector.

Does this it is kind of tied to #168431 so users who use the Silicon Labs Multiprotocol app (add-on) must first migrate away from it before they migrate to ZHA to SerialPortSelector or else it will break their Zigbee adapter config?

@puddly
Copy link
Copy Markdown
Contributor Author

puddly commented Apr 25, 2026

No, nothing changes. You just can't select the multiprotocol app when setting ZHA up. You can still manually enter the URL.

Copy link
Copy Markdown
Member

@TheJulianJES TheJulianJES left a comment

Choose a reason for hiding this comment

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

I gave this a try and didn't observe any issues. Much better experience with the (auto-refreshing!) serial port picker 😄

Removing the multi-protocol selection and ZWA-2 hide is completely fine.

The config entry name change does feel a bit odd, but us using the device name for that (or trying to) caused issues in the past, mostly around us then not really being allowed to change it during a migration because it could contain user-data. That cause{s/d} people to delete their "Conbee II" ZHA entry, even though it was now a ZBT-2...
This won't solve that for existing users, but with that and how ports are handled differently now, I think it's fine to not use the device name as the entry name by default. We don't support multiple config entries anyway.

I guess it's fine to drop for now, but we'll likely have to revisit that for Z-Wave, and eventually also ZHA if/when multi-instance support is added.

Comment thread homeassistant/components/zha/config_flow.py
Comment thread tests/components/zha/test_config_flow.py
Copy link
Copy Markdown
Member

@TheJulianJES TheJulianJES left a comment

Choose a reason for hiding this comment

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

Still good

@puddly puddly merged commit 53e4d6c into home-assistant:dev Apr 27, 2026
33 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

by-code-owner cla-signed has-tests integration: zha new-feature Quality Scale: No score Top 50 Integration is ranked within the top 50 by usage 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.

7 participants