Skip to content

Vistapool: Add reconfiguration flow#172836

Open
fdebrus wants to merge 2 commits into
home-assistant:devfrom
fdebrus:vistapool-reconfigure
Open

Vistapool: Add reconfiguration flow#172836
fdebrus wants to merge 2 commits into
home-assistant:devfrom
fdebrus:vistapool-reconfigure

Conversation

@fdebrus
Copy link
Copy Markdown
Contributor

@fdebrus fdebrus commented Jun 2, 2026

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_reconfigure shows 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).
  • On successful authentication, _abort_if_unique_id_mismatch(reason="account_mismatch") refuses credentials that resolve to a different Hayward user_id, so the user can't accidentally swap the entry to a different account and orphan their existing devices and entities.
  • On success, async_update_reload_and_abort writes the new password into entry.data and reloads the entry.
  • Mirrors the established async_step_reauth_confirm shape from the reauth PR — same AquariteAuth(...) outside the try: block per @joostlek's earlier feedback, same except AuthenticationError / AquariteError / Exception triplet, same _LOGGER.exception pattern.

Tests

tests/components/vistapool/test_config_flow.py gains three tests:

  • test_reconfigure_flow — happy path; entry's password is updated and reload triggered.
  • test_reconfigure_invalid_auth — surfaces invalid_auth and recovers on retry.
  • test_reconfigure_account_mismatch — different user_id aborts with account_mismatch.

Flips the Gold-tier reconfiguration-flow quality-scale rule from todo to done.

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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

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:

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.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_reconfigure to 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-flow quality 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.

Comment thread tests/components/vistapool/test_config_flow.py
Comment thread tests/components/vistapool/test_config_flow.py
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.
@fdebrus fdebrus marked this pull request as ready for review June 2, 2026 13:53
Copilot AI review requested due to automatic review settings June 2, 2026 13:53
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants