Repository navigation
Conversation
Adds a shared hmi_version_supports_v2() helper (threshold 0x4B00, accepts either the raw Modbus register or the SolisCloud hex string). The Modbus config-flow path reads register 33002 right after its existing connectivity probe and overrides has_v2 in place; the cloud path adds one async_inverter_detail call to fetch hmiVersionAll and returns it alongside the existing detected_model. Both follow the same silent-override-after-validation pattern already used for model detection, and never block setup if the read fails or is unparseable - the user's form choice survives untouched. Fixes #20
Contributor
|
Failed to generate code suggestions for PR |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Stops asking the installer to manually toggle
has_v2; detects it automatically from the inverter's HMI firmware version, on both protocols, following the same silent-override-after-validation pattern already used for automatic model detection.hmi_version_supports_v2()(helpers.py): threshold0x4B00, accepts either the raw Modbus register integer or the SolisCloud hex string, returnsNone(undeterminable) rather than raising._validate_configreads register33002right after its existing connectivity probe (in its own try/except, so a flaky read never blocks/retries the connect attempt) and overrideshas_v2in place when determinate._validate_cloud_confignow also callsasync_inverter_detailto fetchhmiVersionAll, returning it as an added tuple element; all three call sites (cloud-only, dual-mode, reconfigure) apply the override the same waymodelalready does.has_v2toggle visible, silently overridden after validation (matchesmodel's existing precedent).Test plan
tests/test_hmi_version_detection.py: pure helper (threshold boundary, hex/int input, undeterminable cases)tests/test_config_flow.py: Modbus-path override + read-failure fallbacktests/test_cloud_integration.py: cloud-only, dual-mode, and reconfigure override paths (also added missingasync_inverter_detailmocks to existing tests that now exercise this call)ruff check/ruff format --checkcleanCloses #20