feat: Improve config flow validation, error handling, and reconfigure UX - #142
Open
davidnoyes wants to merge 1 commit into
Open
feat: Improve config flow validation, error handling, and reconfigure UX#142davidnoyes wants to merge 1 commit into
davidnoyes wants to merge 1 commit into
Conversation
- Validate and normalise the host field before connecting: strip whitespace, reject URLs containing :// or / - Map connection errors to granular user-visible error keys (invalid_host / cannot_connect / invalid_inverter) with translated messages in strings.json and translations/en.json - Move serial number read inside the try block so client.close() always runs on failure - Set a unique ID from the inverter serial number on first setup so HA can detect duplicate entries - Add async_step_reconfigure so users can update the inverter host in-place without removing and re-adding the integration
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
://or/before attempting a connection, giving immediate feedback rather than a confusing timeoutinvalid_host/cannot_connect/invalid_inverter) with user-friendly translated messagestryblock soclient.close()is guaranteed to run even when detection failsasync_step_reconfigureso users can update the inverter host in-place (e.g. after a DHCP change) without removing and re-adding the integrationnum_batteriestranslation key left behind when the field was removed from the config flow schema in Write settings using services #4Test plan
http://192.168.1.1) — should showinvalid_hosterror immediatelycannot_connectinvalid_inverteralready_configured