Skip to content

feat(solax-integration): Persist discovery result and lets the user be the tie breaker instead of asyncio scheduler - #176275

Merged
joostlek merged 14 commits into
home-assistant:devfrom
kdehairy:feat/solax-integration-manual-inverter-select
Aug 11, 2026
Merged

feat(solax-integration): Persist discovery result and lets the user be the tie breaker instead of asyncio scheduler#176275
joostlek merged 14 commits into
home-assistant:devfrom
kdehairy:feat/solax-integration-manual-inverter-select

Conversation

@kdehairy

@kdehairy kdehairy commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Proposed change

In Solax integration, the current auto-discovery behavior often results in multiple "valid" inverters, and it just picks one, effectively, at random. Which means one inverter could be detected as a different one, rendering the integration effectively exporting the wrong sensors (correct for the detected, but non-existing for the actual real one).

This patch allows the user to hand pick the model. If they did so, the auto-discovery is disabled and the hand picked model is chosen.

If left empty, the current auto-discovery behavior is picked up. making this backward compatible (UX wise).

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • 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

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • 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:

@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 manual inverter model selection to SolaX setup while retaining automatic detection.

Changes:

  • Adds an inverter-model selector.
  • Applies the selected model during validation and startup.
  • Parameterizes config-flow tests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
homeassistant/components/solax/__init__.py Applies the saved model during setup.
homeassistant/components/solax/config_flow.py Adds model selection and validation.
homeassistant/components/solax/const.py Defines the inverter entry-point group.
homeassistant/components/solax/strings.json Adds selector text and guidance.
tests/components/solax/test_config_flow.py Covers automatic and manual inputs.

Comment thread homeassistant/components/solax/config_flow.py Outdated
Copilot AI review requested due to automatic review settings July 11, 2026 14:03

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 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread homeassistant/components/solax/config_flow.py Outdated
Comment thread homeassistant/components/solax/__init__.py Outdated
Comment thread homeassistant/components/solax/strings.json Outdated

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 5 out of 5 changed files in this pull request and generated no new comments.

kdehairy added a commit to kdehairy/home-assistant.io that referenced this pull request Jul 11, 2026
Copilot AI review requested due to automatic review settings July 11, 2026 15:15

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.

@kdehairy

Copy link
Copy Markdown
Contributor Author

@squishykid can you please review? latest release is broken for most of users (including me) due to malfunctioning auto-discovery. Please don't make us wait for long :)
many thanks

@joostlek joostlek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why can't we automatically select the model and just store that?

@home-assistant
home-assistant Bot marked this pull request as draft July 12, 2026 13:44
@home-assistant

Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@kdehairy

kdehairy commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

Why can't we automatically select the model and just store that?

The automatic selection (auto discovery) is heuristic by nature. One inverter can end up being auto discovered as another one, which will "technically" work (no errors, warnings, etc...), but it will expose garbage values to a non-existing (in reality), yet declared, sensors.

for more information take a look at this issue in the underlying lib squishykid/solax#212

(another issue for assurance squishykid/solax#185)

The only deterministic way of correctly picking the right inverter, is the user selecting what they already see on the physical device on their wall.

@kdehairy
kdehairy marked this pull request as ready for review July 12, 2026 13:51
@home-assistant
home-assistant Bot requested a review from joostlek July 12, 2026 13:51
Copilot AI review requested due to automatic review settings July 12, 2026 14:03
Copilot AI review requested due to automatic review settings July 25, 2026 07:46

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 9 out of 9 changed files in this pull request and generated no new comments.

kdehairy and others added 14 commits July 25, 2026 10:21
The current auto-discovery behaviour often results in multiple "valid"
inveters, and it just picks one, effectively, at random.

This patch allows the user to hand pick the model. If they did so, the
auto-discovery is disabled and the hand picked model is chosen.

If left empty, the current auto-discovery behaviour is picked up. making
this backward compatible (UX wise).
Instead of blocking everytime we need to access the list.
instead of loading them all at import time.
Do the auto-discovery first, which will return "compatible" inverters.
Using whose to populate the model selection dropdown.

This avoids frustration when the user choses a non-compatible inverter,
thinking that this would work, when it won't.
The semantics behind the var is that it holds potentially correct types
for the single inverter discovered, not a list of more than one inverter
discovered.
avoid repetitive boilerplat. Less error pron later when/if changes
happen.
Moves tests to more relevant test file.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 25, 2026 08:21
@kdehairy
kdehairy force-pushed the feat/solax-integration-manual-inverter-select branch from eee58f0 to df9c674 Compare July 25, 2026 08:21

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 9 out of 9 changed files in this pull request and generated no new comments.

@kdehairy

Copy link
Copy Markdown
Contributor Author

@joostlek can you please re-review?

@brew-your-own

Copy link
Copy Markdown

Any update on this PR? the latest commits look good, and the requested change has been implemented.

@nenone78

Copy link
Copy Markdown

what's the problem with this PR? can someone approve it?

@joostlek
joostlek merged commit 5a413c9 into home-assistant:dev Aug 11, 2026
33 checks passed
@nenone78

Copy link
Copy Markdown

THANK YOU!!! @joostlek

@github-actions github-actions Bot locked and limited conversation to collaborators Aug 12, 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.

7 participants