Vistapool: Add reconfiguration flow#172836
Open
fdebrus wants to merge 2 commits into
Open
Conversation
Lets the user proactively update the stored Vistapool password from Settings -> Devices & services without removing and re-adding the integration. Mirrors the reauthentication flow's UX (password-only form, username displayed in the description, account-mismatch check against the cloud user_id) but is user-initiated rather than HA-triggered. Flips the Gold-tier reconfiguration-flow rule from todo to done.
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a reconfiguration flow for the Vistapool integration so users can update the stored account password, with UI strings and quality-scale status updated accordingly.
Changes:
- Add
async_step_reconfigureto validate new credentials and update+reload the existing config entry. - Add translations for the new reconfigure step and abort reasons.
- Mark the integration’s
reconfiguration-flowquality scale rule as done.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/components/vistapool/test_config_flow.py | Adds tests covering reconfigure success, invalid auth retry, and account mismatch abort. |
| homeassistant/components/vistapool/config_flow.py | Implements the reconfigure step that validates credentials and updates/reloads the config entry. |
| homeassistant/components/vistapool/strings.json | Adds UI strings for the reconfigure form and new abort reasons. |
| homeassistant/components/vistapool/quality_scale.yaml | Updates quality scale to mark reconfiguration flow as complete. |
async_update_reload_and_abort triggers async_setup_entry via the config entry reload. Asserting on mock_setup_entry.call_count pins that the reload actually happens (1) on the happy path and the invalid-auth recovery, and that it does NOT happen (0) on the account-mismatch abort — so the abort cleanly refuses to swap the entry to a different cloud account rather than silently re-setting it up with the new credentials.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Comment on lines
+324
to
+331
| result = await hass.config_entries.flow.async_configure( | ||
| result["flow_id"], {CONF_PASSWORD: _NEW_PASSWORD} | ||
| ) | ||
|
|
||
| assert result["type"] is FlowResultType.ABORT | ||
| assert result["reason"] == "reconfigure_successful" | ||
| assert mock_config_entry.data[CONF_PASSWORD] == _NEW_PASSWORD | ||
| assert mock_setup_entry.call_count == 1 |
Comment on lines
+358
to
+361
| assert result["type"] is FlowResultType.ABORT | ||
| assert result["reason"] == "reconfigure_successful" | ||
| assert mock_config_entry.data[CONF_PASSWORD] == _NEW_PASSWORD | ||
| assert mock_setup_entry.call_count == 1 |
Comment on lines
+380
to
+382
| assert result["type"] is FlowResultType.ABORT | ||
| assert result["reason"] == "account_mismatch" | ||
| assert mock_setup_entry.call_count == 0 |
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.
Breaking change
Proposed change
Adds a reconfiguration flow to the Vistapool integration so users can proactively update their stored Vistapool password without removing and re-adding the integration. Triggered from Settings > Devices & services > Vistapool > Reconfigure.
Follow-up to the reauthentication-flow PR per @zweckj's feedback on the docs/quality-scale PR: reauth only handles the reactive case (HA-detected auth failure); a user wanting to proactively rotate their password before HA notices a failure needs this flow.
Implementation notes
async_step_reconfigureshows a password-only form. The username is displayed in the description text but cannot be edited from here — changing it would mean switching cloud accounts, which we reject (see below)._abort_if_unique_id_mismatch(reason="account_mismatch")refuses credentials that resolve to a different Haywarduser_id, so the user can't accidentally swap the entry to a different account and orphan their existing devices and entities.async_update_reload_and_abortwrites the new password intoentry.dataand reloads the entry.async_step_reauth_confirmshape from the reauth PR — sameAquariteAuth(...)outside thetry:block per @joostlek's earlier feedback, sameexcept AuthenticationError/AquariteError/Exceptiontriplet, same_LOGGER.exceptionpattern.Tests
tests/components/vistapool/test_config_flow.pygains three tests:test_reconfigure_flow— happy path; entry's password is updated and reload triggered.test_reconfigure_invalid_auth— surfacesinvalid_authand recovers on retry.test_reconfigure_account_mismatch— differentuser_idaborts withaccount_mismatch.Flips the Gold-tier
reconfiguration-flowquality-scale rule fromtodotodone.Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: