Drop usage of entity_registry in favor of list_for_display + drop friendly_name usage#4734
Merged
Conversation
Contributor
|
Found 13 unused localization strings in the codebase. Click to see detailsTo clean up these strings, manually remove them from the |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the app’s entity registry handling to rely on Home Assistant’s config/entity_registry/list_for_display payload, removing the legacy full entity-registry model/table and updating UI + widget/AppIntent name resolution to prefer registry-provided display names over live-state friendly_name.
Changes:
- Replace the former
config/entity_registry/listmodel + GRDB tables with a single persisteddisplayEntityRegistrytable backed byEntityRegistryListForDisplay.Entity. - Update entity display-name selection across pickers, widgets/AppIntents, and related providers to use
displayRegistryName/ registry-backed naming. - Update GRDB initialization/schema tests and remove obsolete entity-registry test fixtures.
Reviewed changes
Copilot reviewed 47 out of 48 changed files in this pull request and generated 21 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/Shared/Models/EntityRegistry.test.swift | Updates model tests to match the new list_for_display entity model. |
| Tests/Shared/Database/TableSchemaTests.test.swift | Updates schema validation to the new displayEntityRegistry table and new table count. |
| Tests/Shared/Database/GRDB+Initialization.test.swift | Updates expected table list/count after removing legacy registry tables. |
| Tests/Shared/Database/DatabaseTableProtocol.test.swift | Updates table protocol conformance checks for the new registry table and new table count. |
| Tests/App/Area/AreasService.test.swift | Updates test helpers to construct registry entities via EntityRegistryListForDisplay.Entity. |
| Sources/Shared/Models/EntityRegistryListForDisplay.swift | Expands the entity model to include all list_for_display fields and makes it the persisted GRDB record. |
| Sources/Shared/MagicItem/MagicItemProvider.swift | Switches magic-item naming to use registry-preferred display naming. |
| Sources/Shared/HATypedRequest+App.swift | Removes the typed request for the legacy full entity-registry endpoint. |
| Sources/Shared/HAAppEntity.swift | Makes live friendly_name file-scoped and adds registry-preferred naming utilities and hidden filtering changes. |
| Sources/Shared/Environment/EntityRegistry.swift | Deletes the legacy full entity registry types and GRDB model. |
| Sources/Shared/Environment/AppDatabaseUpdater.swift | Removes the full registry fetch + persistence; persists only list_for_display into displayEntityRegistry. |
| Sources/Shared/Database/Tables/AppEntityRegistryListForDisplayTable.swift | Removes the legacy list-for-display table schema. |
| Sources/Shared/Database/GRDB+Initialization.swift | Registers DisplayEntityRegistryTable and drops obsolete registry tables on startup. |
| Sources/Shared/Database/DisplayEntityRegistryTable.swift | Adds the new table schema for persisted list_for_display entities. |
| Sources/Shared/Database/DatabaseTables.swift | Replaces legacy registry column enums with DisplayEntityRegistry columns and adds new GRDB table case. |
| Sources/Shared/Database/AppEntityRegistryTable.swift | Removes the legacy full-registry table schema. |
| Sources/Shared/ControlEntityProvider.swift | Updates search to use registry-preferred names when matching. |
| Sources/Shared/AreasService.swift | Switches area/entity mapping to use EntityRegistryListForDisplay.Entity data. |
| Sources/Extensions/Widgets/TodoList/WidgetTodoListProvider.swift | Uses registry-preferred naming when deriving selected list display strings. |
| Sources/Extensions/Widgets/TodoList/TodoListAppEntity.swift | Uses registry-preferred naming for todo list app entities. |
| Sources/Extensions/Widgets/Scene/Control/IntentSceneEntity.swift | Uses registry-preferred naming for scene AppEntity suggestions. |
| Sources/Extensions/Widgets/OpenEntity/ControlOpenSwitch/ControlOpenSwitchValueProvider.swift | Uses registry-preferred naming for control widget dynamic options. |
| Sources/Extensions/Widgets/OpenEntity/ControlOpenSensor/ControlOpenSensorValueProvider.swift | Uses registry-preferred naming for control widget dynamic options. |
| Sources/Extensions/Widgets/OpenEntity/ControlOpenLock/ControlOpenLockValueProvider.swift | Uses registry-preferred naming for control widget dynamic options. |
| Sources/Extensions/Widgets/OpenEntity/ControlOpenLight/ControlOpenLightValueProvider.swift | Uses registry-preferred naming for control widget dynamic options. |
| Sources/Extensions/Widgets/OpenEntity/ControlOpenInputBoolean/ControlOpenInputBooleanValueProvider.swift | Uses registry-preferred naming for control widget dynamic options. |
| Sources/Extensions/Widgets/OpenEntity/ControlOpenCoverEntity/ControlOpenCoverEntityValueProvider.swift | Uses registry-preferred naming for control widget dynamic options. |
| Sources/Extensions/Widgets/OpenEntity/ControlOpenCamera/ControlOpenCameraValueProvider.swift | Uses registry-preferred naming for control widget dynamic options. |
| Sources/Extensions/Widgets/HAAppEntityAppIntentEntity.swift | Updates intent entity building to use bulk display-name resolution for performance. |
| Sources/Extensions/Widgets/Controls/Switch/IntentSwitchEntity.swift | Uses registry-preferred naming for switch AppEntity suggestions. |
| Sources/Extensions/Widgets/Controls/Light/IntentLightEntity.swift | Uses registry-preferred naming for light AppEntity suggestions. |
| Sources/Extensions/Widgets/Controls/Fan/IntentFanEntity.swift | Uses registry-preferred naming for fan AppEntity suggestions. |
| Sources/Extensions/Widgets/Controls/Cover/IntentCoverEntity.swift | Uses registry-preferred naming for cover AppEntity suggestions. |
| Sources/Extensions/Widgets/Controls/Button/IntentButtonEntity.swift | Uses registry-preferred naming for button AppEntity suggestions. |
| Sources/Extensions/Widgets/Controls/Automation/IntentAutomationEntity.swift | Uses registry-preferred naming for automation AppEntity suggestions. |
| Sources/Extensions/EntityProvider+Details.swift | Updates device/area resolution paths to read from the new registry table. |
| Sources/Extensions/AppIntents/Widget/StatePrecision.swift | Reads decimal precision from displayEntityRegistry instead of the old list-for-display table. |
| Sources/Extensions/AppIntents/Widget/Sensor/WidgetSensorsAppIntentTimelineProvider.swift | Uses registry-preferred naming for sensor widget suggestions. |
| Sources/Extensions/AppIntents/Widget/Script/WidgetScriptsAppIntentTimelineProvider.swift | Uses registry-preferred naming for scripts widget suggestions. |
| Sources/Extensions/AppIntents/Sensor/IntentSensorsAppEntity.swift | Uses registry-preferred naming for sensor AppEntity suggestions. |
| Sources/Extensions/AppIntents/Script/ScriptAppIntent.swift | Uses registry-preferred naming for script AppEntity suggestions. |
| Sources/CarPlay/Templates/Entities/CarPlayEntitiesListViewModel.swift | Updates excluded-entity logic to use the new registry model. |
| Sources/App/Settings/EntityPicker/EntityRowView.swift | Uses registry-preferred naming in entity picker rows. |
| Sources/App/Settings/EntityPicker/EntityPickerViewModel.swift | Removes legacy registry caches and uses bulk display-name resolution for search. |
| Sources/App/Settings/EntityPicker/EntityPicker.swift | Uses registry-preferred naming for selected entity presentation. |
| Sources/App/Cameras/CameraPlayer/CameraPlayerView.swift | Uses registry-preferred naming for camera title fallback. |
| HomeAssistant.xcodeproj/project.pbxproj | Removes deleted files/resources and adds the new registry table file to the project. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Screenshots
Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#
Any other notes