Add reconfiguration flow to Duco integration#168652
Add reconfiguration flow to Duco integration#168652ronaldvdmeer wants to merge 11 commits intohome-assistant:devfrom
Conversation
- Implement async_step_reconfigure method in config flow - Allow users to change IP address of Duco device - Validate device identity via MAC address to prevent configuration mixups - Add comprehensive test coverage for success, error, and wrong device scenarios - Update strings.json with reconfigure flow translations - Mark reconfiguration-flow quality scale rule as done
There was a problem hiding this comment.
Pull request overview
Adds a reconfiguration flow to the Duco integration so an existing config entry’s host (IP/hostname) can be updated in-place while preventing accidental reassignment to a different device.
Changes:
- Implement
async_step_reconfigurein the Duco config flow, validating the target device via MAC and aborting on mismatch. - Add translation strings for the reconfigure step and new abort reasons (
reconfigure_successful,wrong_device). - Add tests covering successful reconfigure, wrong-device abort, and connection/unknown error handling; update quality scale to mark reconfiguration-flow as done.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
homeassistant/components/duco/config_flow.py |
Adds reconfigure step to validate new host and update+reload entry, aborting if the MAC differs. |
homeassistant/components/duco/strings.json |
Adds translations for reconfigure step and abort reasons. |
homeassistant/components/duco/quality_scale.yaml |
Marks reconfiguration-flow as done. |
tests/components/duco/test_config_flow.py |
Adds tests for the new reconfiguration behavior. |
Prevents async_update_reload_and_abort from triggering the real async_setup_entry during config flow tests via the scheduled reload.
Replace custom wrong_device abort reason with the standard unique_id_mismatch by calling _abort_if_unique_id_mismatch() without an explicit reason argument. Update strings.json and test assertions accordingly.
Test that the flow correctly recovers from a connection error and completes successfully on the next attempt.
There was a problem hiding this comment.
Pull request overview
Adds a reconfiguration flow to the Duco integration so an existing config entry’s host can be updated (with unique-id/mismatch protection), along with translations, tests, and quality scale updates.
Changes:
- Implement
async_step_reconfigureto updateCONF_HOSTand reload the config entry after validating the device identity. - Add config-flow translations for the reconfigure step and new abort reasons.
- Add config-flow tests covering success, connection/unknown errors, and unique-id mismatch cases; update quality scale status.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
homeassistant/components/duco/config_flow.py |
Adds async_step_reconfigure that validates the new host, aborts on unique-id mismatch, and updates/reloads the entry. |
homeassistant/components/duco/strings.json |
Adds translations for the reconfigure step and abort reasons used by the new flow. |
tests/components/duco/test_config_flow.py |
Adds test coverage for the reconfiguration flow success and failure paths. |
homeassistant/components/duco/quality_scale.yaml |
Marks reconfiguration-flow as done and sets repair-issues to exempt. |
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Replace inline vol.Schema with default= with the standard add_suggested_values_to_schema pattern, reusing the existing STEP_USER_SCHEMA constant.
There was a problem hiding this comment.
Pull request overview
This PR adds a reconfiguration flow to the Duco integration so an existing config entry’s host (IP/hostname) can be updated in-place while ensuring the user doesn’t accidentally point the entry at a different device.
Changes:
- Add
async_step_reconfiguretoDucoConfigFlowthat validates the new host and updates + reloads the config entry, aborting on unique-id mismatch. - Add config-flow translations for the new reconfigure step and abort reasons.
- Add config flow tests for reconfigure success, unique-id mismatch, and error handling; update the integration quality scale status.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
homeassistant/components/duco/config_flow.py |
Implements the reconfigure step that validates the device MAC and updates/reloads the entry host. |
homeassistant/components/duco/strings.json |
Adds UI strings for the reconfigure step and abort reasons used by the new flow. |
homeassistant/components/duco/quality_scale.yaml |
Marks reconfiguration-flow as done and notes repair issues as exempt. |
tests/components/duco/test_config_flow.py |
Adds tests covering the reconfigure flow paths (success, mismatch, errors). |
The error and success steps previously both used '192.168.1.200', making the test misleading. Using '192.168.1.50' for the failing attempt makes it immediately clear that '192.168.1.200' is the actual new host being configured on success.
Add async_block_till_done() after the final async_configure call so the scheduled config entry reload triggered by async_update_reload_and_abort is flushed before the assertions run.
Add async_block_till_done() after the final async_configure call so the scheduled config entry reload triggered by async_update_reload_and_abort is flushed before the assertions run.
There was a problem hiding this comment.
Pull request overview
This PR adds a reconfiguration flow to the Duco integration, allowing users to change the configured host (IP/hostname) for an existing entry while ensuring the target device matches the existing entry’s unique ID (MAC).
Changes:
- Add
async_step_reconfigureto the Duco config flow, validating the new host and aborting on unique-id (MAC) mismatch. - Add UI strings for the reconfigure step and new abort reasons (
reconfigure_successful,unique_id_mismatch). - Add tests for successful reconfigure, unique-id mismatch, and error paths; mark reconfiguration as done in the integration quality scale.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
homeassistant/components/duco/config_flow.py |
Implements the new reconfigure step, including host validation and unique-id mismatch abort handling. |
homeassistant/components/duco/strings.json |
Adds translations for the reconfigure step and abort reasons used by the new flow. |
homeassistant/components/duco/quality_scale.yaml |
Updates the integration quality scale to indicate reconfiguration support is complete. |
tests/components/duco/test_config_flow.py |
Adds tests for reconfigure success, mismatch, and error paths. |
Without a follow-up assertion that a reload actually occurred, the call adds no value. The flow result assertions are sufficient.
Proposed change
Add a reconfiguration flow to the Duco integration so users can update the IP address or hostname of an already-configured Duco ventilation box without removing and re-adding the integration.
Changes:
async_step_reconfigurein the config flowunique_id_mismatchif the new host responds with a different MAC addressreconfigure_successfulandunique_id_mismatchabort reasons and thereconfigurestepquality_scale.yaml:reconfiguration-flow: done,repair-issues: exemptType 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: