Repository navigation
Conversation
Registers 33004-33019 already held the ASCII serial (used by the "Serial Number" sensor and the migrate-to-serial-id logic) but nothing read them during initial config-flow validation. _validate_config now reads them after the HMI-version check, for hybrid models only (grid/string inverters don't expose this range), and silently corrects a mistyped serial the same way model/has_v2 detection already work - never blocking setup if the read fails. Filed model auto-detection (register 33003) as a separate issue since it needs a new byte-code-to-model mapping table with no live data to seed it yet, unlike this and the already-shipped has_v2 detection.
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
Follow-up to issue #20 (HMI-version auto-detection), prompted by the question: why do we still ask for serial/model/firmware when they can be read from the device?
33004-33019already hold the ASCII serial (used by the existing "Serial Number" sensor and the migrate-to-serial-id logic), but nothing read them during config-flow validation._validate_confignow reads them right after the HMI-version check and silently corrects a mistyped serial — hybrid models only, since grid/string inverters don't expose this register range. Never blocks setup if the read fails.33003only decodes to a generic protocol/family description, not a precise match to aSOLIS_INVERTERScatalog entry. Needs a new mapping table seeded from live user reports (same constraint as the existing SolisCloud product-code table). Filed as Auto-detect inverter model from Modbus register 33003 (no mapping table exists yet) #25.Test plan
tests/test_config_flow.py: newtest_flow_user_device_serial_overrides_typed_serialandtest_flow_user_grid_model_skips_serial_detection; updated the two HMI-version tests to also assert the serial stays untouched when no serial data is availabletests/test_cloud_integration.py: fixed a blanketasync_read_input_registermock that was incidentally feeding the new serial read garbage data (return_value=[1]decodes to a stray control character)ruff check/ruff format --checkclean