Skip to content

Add reconfigure flow to config entry - #332

Open
ludeeus with Copilot wants to merge 6 commits into
mainfrom
copilot/adjust-blog-posts-2025-2026
Open

Add reconfigure flow to config entry#332
ludeeus with Copilot wants to merge 6 commits into
mainfrom
copilot/adjust-blog-posts-2025-2026

Conversation

Copilot AI commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Per the 2025-03-01 config flow unique ID guidelines, integrations with unique IDs should offer a reconfigure flow so users can update credentials without deleting and re-adding the entry.

Changes

  • Adds async_step_reconfigure to config_flow.py — pre-fills username from the existing entry, validates new credentials, then calls async_update_reload_and_abort on success
  • Adds reconfigure step translations and reconfigure_successful abort string to translations/en.json

⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

Copilot AI and others added 2 commits March 20, 2026 10:33
Co-authored-by: ludeeus <15093472+ludeeus@users.noreply.github.com>
Co-authored-by: ludeeus <15093472+ludeeus@users.noreply.github.com>
Copilot AI changed the title [WIP] Update blog posts for 2025 and 2026 Fix vulnerable homeassistant dev dependency & add reconfigure flow Mar 20, 2026
Copilot AI requested a review from ludeeus March 20, 2026 10:36
@ludeeus

ludeeus commented Mar 20, 2026

Copy link
Copy Markdown
Owner

@copilot the min version is already 2026.3.2

Co-authored-by: ludeeus <15093472+ludeeus@users.noreply.github.com>

Copilot AI commented Mar 20, 2026

Copy link
Copy Markdown
Contributor Author

@copilot the min version is already 2026.3.2

Updated both requirements.txt and hacs.json to 2026.3.2 in 851c0ab.

@ludeeus
ludeeus marked this pull request as ready for review March 20, 2026 10:54
Copilot AI review requested due to automatic review settings March 20, 2026 10:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the integration blueprint to use a patched Home Assistant baseline (addressing the cited stored XSS in older cores) and adds a config-entry reconfigure flow so existing entries can update credentials without deletion.

Changes:

  • Bump homeassistant minimum/dev dependency from 2025.2.4 to 2026.3.2 in requirements.txt and hacs.json.
  • Add async_step_reconfigure to the integration config flow to validate and persist updated credentials.
  • Add reconfigure step + abort translation strings in translations/en.json.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
requirements.txt Raises the Home Assistant dependency version to a patched/minimum baseline.
hacs.json Aligns HACS minimum Home Assistant version with the bumped baseline.
custom_components/integration_blueprint/config_flow.py Introduces a reconfigure step that validates credentials and updates the existing entry.
custom_components/integration_blueprint/translations/en.json Adds UI strings for the new reconfigure step and success abort reason.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +123 to +127
vol.Required(
CONF_USERNAME,
default=reconfigure_entry.data.get(
CONF_USERNAME, vol.UNDEFINED
),

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

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

The reconfigure form allows changing CONF_USERNAME, but the config entry’s title and unique_id are originally derived from the username in async_step_user and are not updated here. If the user changes the username during reconfigure, the entry will keep the old title/unique_id while storing new credentials, and it may also bypass the duplicate-prevention logic tied to the unique_id. Consider either making username non-editable for reconfigure (only update password), or explicitly updating title/unique_id and handling collisions when the username changes.

Copilot uses AI. Check for mistakes.
Comment on lines +114 to +118
self._get_reconfigure_entry(),
data_updates=user_input,
)

reconfigure_entry = self._get_reconfigure_entry()

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

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

self._get_reconfigure_entry() is called twice in the same execution path (once for async_update_reload_and_abort, and again for building the form). Store it in a local variable once to avoid repeated lookups and keep the control flow simpler.

Copilot uses AI. Check for mistakes.
Co-authored-by: ludeeus <15093472+ludeeus@users.noreply.github.com>
Copilot AI changed the title Fix vulnerable homeassistant dev dependency & add reconfigure flow Fix PR title and description to match actual changes after rebase Mar 20, 2026
@ludeeus

ludeeus commented Mar 20, 2026

Copy link
Copy Markdown
Owner

@copilot adjust the or title and description to reflect the changes

Copilot AI commented Mar 20, 2026

Copy link
Copy Markdown
Contributor Author

@copilot adjust the or title and description to reflect the changes

Updated the PR title to "Add reconfigure flow to config entry" and the description now only covers the reconfigure flow changes (the version bump was already merged to main in #331).

Copilot AI changed the title Fix PR title and description to match actual changes after rebase Add reconfigure flow to config entry Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants