Sub Entries#114
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for Dock Sub Entries and implements a configuration subentry flow for managing dock configurations. The changes modernize the dock management system by using Home Assistant's subentry functionality instead of storing dock data directly in the main config entry.
- Refactors dock configuration to use Home Assistant's subentry system for better organization
- Implements a new DockSubentryFlowHandler for managing dock addition and configuration
- Performs data migration from the old dock storage format to the new subentry system
Reviewed Changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| hacs.json | Updates minimum Home Assistant version requirement to 2025.7 |
| custom_components/unfoldedcircle/config_flow.py | Adds DockSubentryFlowHandler class and removes old dock flow logic |
| custom_components/unfoldedcircle/init.py | Implements migration logic from old dock format to subentries |
| custom_components/unfoldedcircle/translations/en.json | Moves dock translations to config_subentries section |
| custom_components/unfoldedcircle/coordinator.py | Adds UnfoldedCircleRuntimeData dataclass and updates coordinators |
| custom_components/unfoldedcircle/entity.py | Updates dock entity initialization to accept subentry parameters |
| Multiple platform files | Updates dock entity creation to use subentry parameters |
| pyUnfoldedCircleRemote/* | Various cleanup and simplification changes |
| manifest.json | Updates version and pyUnfoldedCircleRemote dependency |
|
|
||
| def get_dock_name(dock_coordinator: UnfoldedCircleDockCoordinator): | ||
| return dock_coordinator.api.name | ||
| return dock_coordinator[1].api.name |
There was a problem hiding this comment.
This line appears to have incorrect tuple indexing. The function expects a UnfoldedCircleDockCoordinator but is trying to access index [1] on it. Based on the context, this should likely be dock_coordinator.api.name since dock_coordinator is already the coordinator object, not a tuple.
| return dock_coordinator[1].api.name | |
| return dock_coordinator.api.name |
| if is_valid or dock_data["password"] != "0000": | ||
| create_subentry(hass, entry, dock_data) | ||
|
|
||
| hass.add_job(async_remove_device(hass, dock)) |
There was a problem hiding this comment.
This line is calling async_remove_device as a coroutine function but wrapping it in hass.add_job(). Since async_remove_device is an async function, it should be awaited or scheduled properly. The correct approach would be hass.async_create_task(async_remove_device(hass, dock)) or await it directly.
| hass.add_job(async_remove_device(hass, dock)) | |
| hass.async_create_task(async_remove_device(hass, dock)) |
Adds support for Dock Sub Entries and the subentry flow
General code cleanup