-
-
Notifications
You must be signed in to change notification settings - Fork 36.3k
Fix ZHA network formation #157769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ZHA network formation #157769
Conversation
|
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
|
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
|
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.
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 fixes ZHA network formation by removing manual TX power configuration, as zigpy now handles TX power internally based on the Home Assistant country setting. It reverts PR #155855 which previously added TX power configuration logic.
Key changes:
- Removed
configparameter fromasync_form_network()method since TX power is now handled by zigpy - Eliminated TX power constants and country-to-power mapping from homeassistant_connect_zbt2
- Improved test mocking to use
create_autospecinstead of genericAsyncMockfor better type safety
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/components/zha/test_config_flow.py | Enhanced mock to use create_autospec(ControllerApplication) for more accurate testing |
| tests/components/homeassistant_connect_zbt2/test_config_flow.py | Removed parametrized TX power tests and assertions |
| homeassistant/components/zha/radio_manager.py | Removed config parameter from async_form_network() method |
| homeassistant/components/zha/config_flow.py | Removed _extra_network_config instance variable and TX power handling logic |
| homeassistant/components/homeassistant_hardware/firmware_config_flow.py | Removed _extra_zha_hardware_options() method that provided TX power |
| homeassistant/components/homeassistant_connect_zbt2/const.py | Removed TX power constants and country mapping dictionary |
| homeassistant/components/homeassistant_connect_zbt2/config_flow.py | Removed _extra_zha_hardware_options() override that calculated TX power from country |
TheJulianJES
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Looks good.
- Tested new network formation with ZBT-2 and a third-party adapter: it works correctly again
- Revert for the ZBT-2 integration specific TX power changes is also good, since the firmware that includes the country <> TX power mapping is already released as a stable version, so everyone will get that before setting up ZHA.
- The test change is also a nice improvement.
Proposed change
Zigpy now sets the TX power itself based on the passed through HA
country. This PR fixes unit tests to use less mocks (which masked the issue) and reverts #155855, since it is no longer necessary.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: