Migrate ZHA to SerialPortSelector#169099
Conversation
|
Hey there @dmulcahey, @Adminiuga, @TheJulianJES, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
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
SerialPortSelectorand 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. |
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? |
|
No, nothing changes. You just can't select the multiprotocol app when setting ZHA up. You can still manually enter the URL. |
TheJulianJES
left a comment
There was a problem hiding this comment.
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.
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:
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: