-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
Do not auto-set up ZHA zeroconf discoveries during onboarding #153914
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
Do not auto-set up ZHA zeroconf discoveries during onboarding #153914
Conversation
|
Hey there @dmulcahey, @Adminiuga, @puddly, 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 prevents ZHA from automatically setting up network coordinators discovered via Zeroconf during Home Assistant onboarding, addressing an issue where network coordinators already in use by other HA instances could be automatically configured and have their settings wiped.
- Modifies the confirmation logic to exclude Zeroconf discoveries during onboarding
- Preserves automatic setup for USB and hardware discoveries during onboarding
- Adds test coverage for the new behavior when not onboarded
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| homeassistant/components/zha/config_flow.py | Adds condition to exclude Zeroconf source from automatic setup during onboarding |
| tests/components/zha/test_config_flow.py | Adds test to verify Zeroconf discoveries require confirmation when not onboarded |
|
If we do this, we should add a clear pointer in the documentation, that it needs to be done manually for network attached coordinators. |
|
AFAIK, we do not mention anywhere that we even automatically configure coordinators during onboarding. We certainly didn't document this auto-setup as intended for network coordinators, as we didn't intend it either, from what I can see. Just to clarify, the steps for configuring a coordinator on an existing HA instance stay the same.
If we wanted to add anything about this in the documentation, I'm not sure what it would be. The steps for configuring ZHA already point you to the correct place. I'd expect all users that buy a network-connected coordinator in the first place, possibly even with PoE, to be able to make a couple of clicks to get to the integrations page and confirm setup, where the network coordinator is still automatically discovered. |
|
I think the original intent for this change was to have the Yellow radio be usable upon installation. Maybe we can restrict auto setup to just hardware integration discovery? I guess it would be nice to have USB coordinators auto setup but there will be future config flow steps that will make this infeasible (e.g. confirmation step before wiping old settings from a coordinator). |
|
Maybe you're right. I'm coming from the perspective that if some things behave differently then others, then that should be documented in case someone is wondering "why is this not working as I'm expecting it to" 🤷♂️ |
Proposed change
This PR changes ZHA's behavior to only automatically set up USB and hardware discovered coordinators (e.g. Yellow) when onboarding a new Home Assistant instance.
Zeroconf discovered network coordinators will no longer be set up without any confirmation before/during onboarding, instead requiring you to click on "Add" on the integrations page for the network coordinator you want to add.
Keeping original intent
USB and hardware discoveries, for which this was originally added (included in #76795), are unaffected by this change and will still be set up without any confirmation before/during onboarding. So, setting up a new HA Yellow or HA Green with a USB coordinator attached will still automatically configure ZHA.
Reasons behind this change
#153883 reported that before onboarding a new HA Blue, ZHA automatically discovered and configured a network coordinator that was already in use, wiping its settings in the progress, and breaking the main HA instance that was using this coordinator.
It's fine to keep the automatic setup for USB and hardware discoveries, as you have to make an explicit choice to plug in a USB coordinator before/during onboarding. With network coordinators, you do not have that choice, unless you want to fully disconnect your HA system before/during onboarding, but that's not ideal due to a lot of other reasons.
Since it's still easily possible to add network coordinators via the integrations page, we don't really add additional friction for first time users with network coordinators .
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: