Skip to content

Add inverter model selector to solax config flow - #176278

Closed
brew-your-own wants to merge 3 commits into
home-assistant:devfrom
brew-your-own:solax-inverter-selector-clean
Closed

Add inverter model selector to solax config flow#176278
brew-your-own wants to merge 3 commits into
home-assistant:devfrom
brew-your-own:solax-inverter-selector-clean

Conversation

@brew-your-own

@brew-your-own brew-your-own commented Jul 11, 2026

Copy link
Copy Markdown

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

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • [x ] New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • [ x] I understand the code I am submitting and can explain how it works.
  • [ x] The code change is tested and works locally.
  • [ x] Local tests pass. Your PR cannot be merged unless tests pass
  • [ x] There is no commented out code in this PR.
  • [ x] I have followed the development checklist
  • [ x] I have followed the perfect PR recommendations
  • [x ] The code has been formatted using Ruff (ruff format homeassistant tests)
  • [ x] Tests have been added to verify that the new code works.
  • [ x] Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

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
@home-assistant

Copy link
Copy Markdown
Contributor

Hey there @squishykid, @Darsstar, mind taking a look at this pull request as it has been labeled with an integration (solax) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of solax can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign solax Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/components/solax/test_config_flow.py Outdated
Comment thread tests/components/solax/test_config_flow.py Outdated
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>
Copilot AI review requested due to automatic review settings July 12, 2026 17:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread homeassistant/components/solax/config_flow.py
Comment thread homeassistant/components/solax/config_flow.py
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>
Copilot AI review requested due to automatic review settings July 12, 2026 17:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@brew-your-own

Copy link
Copy Markdown
Author

#176275 is a better starting point.
closing this PR.

@github-actions github-actions Bot locked and limited conversation to collaborators Jul 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Solax integration isn't working after upgrade to Core 2026.7.0

3 participants