Add inverter model selector to solax config flow - #176278
Closed
brew-your-own wants to merge 3 commits into
Closed
Conversation
solax 3.2.4 introduced a bug in the auto discovery process (see home-assistant#175394), so users can now optionally pick their inverter model explicitly during setup instead of relying solely on auto-detection. The detected model is also now shown in the device info panel
Contributor
|
Hey there @squishykid, @Darsstar, 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
Adds optional SolaX inverter model selection to avoid unreliable auto-discovery and displays the detected model in device information.
Changes:
- Adds an optional inverter-model selector.
- Uses the selected model during validation and setup.
- Adds device model metadata and updates config-flow tests.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
homeassistant/components/solax/__init__.py |
Applies model selection during setup. |
homeassistant/components/solax/config_flow.py |
Adds model selection and discovery filtering. |
homeassistant/components/solax/const.py |
Defines model-selection constants. |
homeassistant/components/solax/sensor.py |
Exposes the detected model in device information. |
homeassistant/components/solax/strings.json |
Labels the new selector. |
tests/components/solax/test_config_flow.py |
Updates config-flow tests for discovery. |
Mock discover() to return a spec'd Inverter instance instead of the bare inverter class, and assert it is called with only the selected model as candidate, so the test fails if inverter selection is silently ignored Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Parametrize the success test over explicit inverter selection and the omitted case, so the auto-discovery fallback across all registered inverter models is verified alongside explicit selection Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Author
|
#176275 is a better starting point. |
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.
solax 3.2.4 introduced a bug in the auto discovery process (see #175394), so users can now optionally pick their inverter model explicitly during setup instead of relying solely on auto-detection. The detected model is also now shown in the device info panel
Proposed change
The Solax integration relies on the solax python library, which supports many types of Solax inverters.
The library uses parallel auto-discovery code to test all the inverter types against the inverter being
configured, and selects the one that "matches".
Release 3.2.4 of the library introduced a new inverter type which matches against the wrong types of inverters (for example X1 hybrid G4, which has its own inverter type). This results in HA selecting the wrong inverter type randomly
(this is sensitive to timing). This breaks the solax integration config randomly.
This is not the first time this has happened. The auto-discovery code is handy, but fragile.
This change modifies the config flow to add the possibility to select an inverter type and bypass the auto-discovery code. The choice is optional, and the code reverts to the old behavior if no inverter type is selected.
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: