Reduce GoodWe connect retries to avoid blocking startup#170964
Merged
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Hey there @mletenay, @starkillerOG, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces GoodWe inverter connection retry counts to avoid long Home Assistant startup delays when an inverter is unreachable.
Changes:
- Lowers setup-time GoodWe
connectretries from 10 to 3. - Lowers config-flow port detection retries from 10 to 3 for UDP and TCP attempts.
- Adds a setup retry test for unreachable inverter handling.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
homeassistant/components/goodwe/__init__.py |
Reduces setup connection retries. |
homeassistant/components/goodwe/config_flow.py |
Reduces port-detection connection retries. |
tests/components/goodwe/test_init.py |
Adds test coverage for setup retry behavior when connection fails. |
Comment on lines
+60
to
+63
| patch( | ||
| "homeassistant.components.goodwe.config_flow.connect", | ||
| side_effect=InverterError, | ||
| ), |
| await hass.async_block_till_done() | ||
|
|
||
| assert config_entry.state is ConfigEntryState.SETUP_RETRY | ||
| # Verify connect is called with limited retries to avoid blocking startup |
starkillerOG
approved these changes
May 17, 2026
Contributor
starkillerOG
left a comment
There was a problem hiding this comment.
LGTM, thank you.
In the past when this was build the ConfigEntryNotReady was not yet properly used.
Indeed HA should just handle the retries.
Copilot AI
pushed a commit
to AlCalzone/homeassistant-core
that referenced
this pull request
May 17, 2026
…nt#170964) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: AlCalzone <17641229+AlCalzone@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change
Proposed change
The GoodWe integration uses
retries=10when connecting to the inverter during setup and port detection. With a 1-second timeout per attempt, this means setup blocks for 30-80+ seconds when the inverter is unreachable (common at night for solar inverters). This delays the entire HA startup, including add-ons like Zigbee2MQTT.This reduces
retriesto 3 (the library default) in bothasync_setup_entryandasync_detect_inverter_port. When the inverter is offline, setup now fails quickly and raisesConfigEntryNotReady, which lets HA's built-in retry mechanism handle reconnection without blocking startup.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: