Skip to content

Add reconfigure flow to Hot Spring - #179116

Merged
erwindouna merged 11 commits into
home-assistant:devfrom
Moustachauve:hotspring-reconfigure
Aug 17, 2026
Merged

Add reconfigure flow to Hot Spring#179116
erwindouna merged 11 commits into
home-assistant:devfrom
Moustachauve:hotspring-reconfigure

Conversation

@Moustachauve

Copy link
Copy Markdown
Contributor

Proposed change

Add reconfigure flow to Hot Spring integration

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:

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

Adds a reconfiguration flow for updating a Hot Spring spa’s network address while verifying device identity.

Changes:

  • Adds host reconfiguration with MAC validation and reload.
  • Adds user-facing flow messages.
  • Adds success and device-mismatch tests.

Reviewed changes

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

File Description
homeassistant/components/hotspring/config_flow.py Implements reconfiguration.
homeassistant/components/hotspring/strings.json Adds reconfiguration messages.
homeassistant/components/hotspring/quality_scale.yaml Marks reconfiguration complete.
tests/components/hotspring/test_config_flow.py Tests reconfiguration outcomes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI review requested due to automatic review settings August 14, 2026 04:19
@Moustachauve
Moustachauve marked this pull request as ready for review August 14, 2026 04:21

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (1)

homeassistant/components/hotspring/config_flow.py:82

  • Preserve the submitted host when redisplaying a failed reconfiguration. This always repopulates the form from the existing entry, so a cannot_connect response replaces the attempted address with the old host instead of leaving it available for correction.
            data_schema = self.add_suggested_values_to_schema(
                data_schema,
                self._get_reconfigure_entry().data,

Copilot AI review requested due to automatic review settings August 14, 2026 04:29

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Comment thread homeassistant/components/hotspring/config_flow.py Outdated
@home-assistant
home-assistant Bot marked this pull request as draft August 14, 2026 09:56
@home-assistant

Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Copilot AI review requested due to automatic review settings August 16, 2026 00:44

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Suppressed comments (3)

homeassistant/components/hotspring/strings.json:7

  • The string contains a literal \n\n with a leading space before the newline escape. That will render an extra space before the line break in the UI. Consider removing the space before \n\n to avoid odd formatting, and keep the line breaks consistent with other HA translations.
      "unique_id_mismatch": "MAC address does not match the configured device. Expected to connect to device with MAC: `{expected_mac}`, but connected to device with MAC: `{actual_mac}`. \n\nPlease ensure you reconfigure against the same device."

tests/components/hotspring/test_config_flow.py:100

  • This test now mutates device_fixture.info in-place instead of swapping the whole SpaInfo object and restoring it. If the device_fixture is shared (fixture scope > function) or reused in other tests, this can introduce cross-test coupling. Prefer restoring the original root_topic (store/restore the old value) or reassigning a fresh SpaInfo copy to keep the test isolated.
    device_fixture.info.root_topic = "unknownTopic123"

tests/components/hotspring/test_config_flow.py:113

  • This test now mutates device_fixture.info in-place instead of swapping the whole SpaInfo object and restoring it. If the device_fixture is shared (fixture scope > function) or reused in other tests, this can introduce cross-test coupling. Prefer restoring the original root_topic (store/restore the old value) or reassigning a fresh SpaInfo copy to keep the test isolated.
    device_fixture.info.root_topic = "mySpaAABBCCDDEEFF"

Comment thread homeassistant/components/hotspring/config_flow.py Outdated
Copilot AI review requested due to automatic review settings August 16, 2026 00:56
@Moustachauve
Moustachauve force-pushed the hotspring-reconfigure branch from b8d0690 to a88734a Compare August 16, 2026 00:56
@Moustachauve
Moustachauve marked this pull request as ready for review August 16, 2026 00:56
@home-assistant
home-assistant Bot requested a review from erwindouna August 16, 2026 00:56

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Suppressed comments (4)

homeassistant/components/hotspring/strings.json:7

  • The message includes an extra space before the newline sequence (. \n\n), which will render as a trailing space in some contexts. Remove the space so it’s .\n\n... to avoid awkward formatting.
      "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
      "reconfigure_successful": "[%key:common::config_flow::abort::reconfigure_successful%]",
      "unique_id_mismatch": "MAC address does not match the configured device. Expected to connect to device with MAC: `{expected_mac}`, but connected to device with MAC: `{actual_mac}`. \n\nPlease ensure you reconfigure against the same device."

tests/components/hotspring/test_config_flow.py:185

  • Setting side_effect to an exception class can fail if the exception requires constructor args (it will be instantiated when raised). Prefer providing an instance (e.g., HotSpringConnectionError(...)) to make the test robust to exception signature changes.
    mock_hotspring.update.side_effect = HotSpringConnectionError

tests/components/hotspring/test_config_flow.py:100

  • This test mutates device_fixture state in-place. If the fixture scope is broader than function (or the same object is reused), this can leak state into other tests. Consider capturing the original root_topic and restoring it in a try/finally to keep the test isolated.
    device_fixture.info.root_topic = "unknownTopic123"

tests/components/hotspring/test_config_flow.py:113

  • This test mutates device_fixture state in-place. If the fixture scope is broader than function (or the same object is reused), this can leak state into other tests. Consider capturing the original root_topic and restoring it in a try/finally to keep the test isolated.
    device_fixture.info.root_topic = "mySpaAABBCCDDEEFF"

Comment thread homeassistant/components/hotspring/config_flow.py Outdated
Copilot AI review requested due to automatic review settings August 16, 2026 00:57

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Suppressed comments (3)

homeassistant/components/hotspring/strings.json:7

  • In translation strings, including literal \n\n inside a JSON string tends to be error-prone for formatting and consistency across frontends. Prefer using actual newlines in the JSON value (or keep it as a single paragraph) to match how other HA integrations structure multi-line abort messages, and avoid trailing whitespace before the newline escape.
      "unique_id_mismatch": "MAC address does not match the configured device. Expected to connect to device with MAC: `{expected_mac}`, but connected to device with MAC: `{actual_mac}`. \n\nPlease ensure you reconfigure against the same device."

tests/components/hotspring/test_config_flow.py:100

  • This test now mutates device_fixture.info in-place rather than swapping the entire SpaInfo. If device_fixture (or device_fixture.info) is shared across tests via fixture scope, in-place mutation can leak state between tests. To keep tests isolated, consider cloning/copying the SpaInfo instance (or setting the fixture scope to function) and restoring it afterward.
    device_fixture.info.root_topic = "unknownTopic123"

tests/components/hotspring/test_config_flow.py:113

  • This test now mutates device_fixture.info in-place rather than swapping the entire SpaInfo. If device_fixture (or device_fixture.info) is shared across tests via fixture scope, in-place mutation can leak state between tests. To keep tests isolated, consider cloning/copying the SpaInfo instance (or setting the fixture scope to function) and restoring it afterward.
    device_fixture.info.root_topic = "mySpaAABBCCDDEEFF"

Comment thread homeassistant/components/hotspring/config_flow.py Outdated
Comment thread homeassistant/components/hotspring/config_flow.py Outdated
Comment thread homeassistant/components/hotspring/config_flow.py
@home-assistant
home-assistant Bot marked this pull request as draft August 16, 2026 07:22
Copilot AI review requested due to automatic review settings August 17, 2026 02:51
@Moustachauve
Moustachauve marked this pull request as ready for review August 17, 2026 02:52
@home-assistant
home-assistant Bot requested a review from erwindouna August 17, 2026 02:52

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (3)

tests/components/hotspring/test_config_flow.py:100

  • This test now mutates device_fixture.info.root_topic without restoring the original value at the end. If device_fixture (or its info) is shared beyond function scope, this can leak state into other tests and cause order-dependent failures. Suggestion: store the original root_topic (or original info) at the start of the test and restore it in a finally block (or at least before returning) to keep the test isolated.
    device_fixture.info.root_topic = "unknownTopic123"

tests/components/hotspring/test_config_flow.py:113

  • This test now mutates device_fixture.info.root_topic without restoring the original value at the end. If device_fixture (or its info) is shared beyond function scope, this can leak state into other tests and cause order-dependent failures. Suggestion: store the original root_topic (or original info) at the start of the test and restore it in a finally block (or at least before returning) to keep the test isolated.
    device_fixture.info.root_topic = "mySpaAABBCCDDEEFF"

homeassistant/components/hotspring/config_flow.py:88

  • async_step_user is annotated with @override, but async_step_reconfigure (a framework entrypoint method) is not. Adding @override here improves consistency and helps static checking catch signature mismatches during future refactors.
    async def async_step_reconfigure(
        self, user_input: dict[str, Any] | None = None
    ) -> ConfigFlowResult:
        """Handle reconfiguration of the Hot Spring spa."""
        return await self.async_step_user(user_input)

Copilot AI review requested due to automatic review settings August 17, 2026 02:53

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (5)

tests/components/hotspring/test_config_flow.py:100

  • This test mutates the shared device_fixture.info.root_topic in-place without restoring the original value. If device_fixture has a broader fixture scope than function-level, this can leak state into other tests and cause order-dependent failures. Consider saving the original root_topic at the start of the test and restoring it in a finally block (or recreating/replacing the info object as was done previously).
    device_fixture.info.root_topic = "unknownTopic123"

tests/components/hotspring/test_config_flow.py:113

  • This test mutates the shared device_fixture.info.root_topic in-place without restoring the original value. If device_fixture has a broader fixture scope than function-level, this can leak state into other tests and cause order-dependent failures. Consider saving the original root_topic at the start of the test and restoring it in a finally block (or recreating/replacing the info object as was done previously).
    device_fixture.info.root_topic = "mySpaAABBCCDDEEFF"

homeassistant/components/hotspring/config_flow.py:60

  • self._get_reconfigure_entry() is called multiple times in the same step. It would be clearer and less error-prone to fetch it once into a local variable (e.g., entry = self._get_reconfigure_entry()) and reuse it both for async_update_reload_and_abort(...) and for suggested values. This also avoids any chance of inconsistency if the underlying entry reference changes between calls.
                if self.source == SOURCE_RECONFIGURE:
                    self._abort_if_unique_id_mismatch()
                    return self.async_update_reload_and_abort(
                        self._get_reconfigure_entry(),
                        data_updates={CONF_HOST: user_input[CONF_HOST]},
                    )

homeassistant/components/hotspring/config_flow.py:73

  • self._get_reconfigure_entry() is called multiple times in the same step. It would be clearer and less error-prone to fetch it once into a local variable (e.g., entry = self._get_reconfigure_entry()) and reuse it both for async_update_reload_and_abort(...) and for suggested values. This also avoids any chance of inconsistency if the underlying entry reference changes between calls.
        if suggested_values is None and self.source == SOURCE_RECONFIGURE:
            suggested_values = self._get_reconfigure_entry().data

homeassistant/components/hotspring/strings.json:7

  • The unique_id_mismatch abort message is somewhat ambiguous about what specifically mismatched (detected device vs configured entry). Consider tightening the wording to explicitly state that the discovered spa’s MAC/unique_id differs from the existing entry’s MAC/unique_id, and (if the flow has access) include the configured identifier to make troubleshooting easier.
      "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
      "reconfigure_successful": "[%key:common::config_flow::abort::reconfigure_successful%]",
      "unique_id_mismatch": "The MAC address does not match the configured device. Please ensure you reconfigure against the same device."

@erwindouna erwindouna left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, thanks @Moustachauve!

@erwindouna
erwindouna merged commit a6b8a03 into home-assistant:dev Aug 17, 2026
33 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants