Skip to content

Drop usage of entity_registry in favor of list_for_display + drop friendly_name usage#4734

Merged
bgoncal merged 2 commits into
mainfrom
list-for-display
Jun 11, 2026
Merged

Drop usage of entity_registry in favor of list_for_display + drop friendly_name usage#4734
bgoncal merged 2 commits into
mainfrom
list-for-display

Conversation

@bgoncal

@bgoncal bgoncal commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

Screenshots

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

@bgoncal bgoncal self-assigned this Jun 11, 2026
Copilot AI review requested due to automatic review settings June 11, 2026 13:37
@bgoncal bgoncal added watch The Apple Watch app and complications CarPlay widgets shortcuts database labels Jun 11, 2026
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

⚠️ Unused L10n strings detected

Found 13 unused localization strings in the codebase.

Click to see details
Parsing Strings.swift...
Found 1636 L10n strings

Reading all Swift source code...
Read 5688984 characters of Swift code

Checking for unused strings...
Checked 100/1636 strings...
Checked 200/1636 strings...
Checked 300/1636 strings...
Checked 400/1636 strings...
Checked 500/1636 strings...
Checked 600/1636 strings...
Checked 700/1636 strings...
Checked 800/1636 strings...
Checked 900/1636 strings...
Checked 1000/1636 strings...
Checked 1100/1636 strings...
Checked 1200/1636 strings...
Checked 1300/1636 strings...
Checked 1400/1636 strings...
Checked 1500/1636 strings...
Checked 1600/1636 strings...

================================================================================
UNUSED STRINGS REPORT
================================================================================

Found 13 unused strings:


ACTIONSCONFIGURATOR:
  - L10n.ActionsConfigurator.Action.createAutomation
    Key: actions_configurator.action.create_automation
    Line: 132
  - L10n.ActionsConfigurator.VisualSection.sceneDefined
    Key: actions_configurator.visual_section.scene_defined
    Line: 172
  - L10n.ActionsConfigurator.VisualSection.serverDefined
    Key: actions_configurator.visual_section.server_defined
    Line: 178

APPINTENTS:
  - L10n.AppIntents.WidgetAction.actionsParameterConfiguration
    Key: app_intents.widget_action.actions_parameter_configuration
    Line: 606

CAMERA:
  - L10n.Camera.serverNotFound
    Key: camera.server_not_found
    Line: 764
  - L10n.Camera.snapshotFailed
    Key: camera.snapshot_failed
    Line: 766

CAMERALIST:
  - L10n.CameraList.noArea
    Key: camera_list.no_area
    Line: 771
  - L10n.CameraList.searchPlaceholder
    Key: camera_list.search_placeholder
    Line: 773

CAMERAS:
  - L10n.Cameras.dragToReorder
    Key: cameras.drag_to_reorder
    Line: 829

SETTINGSDETAILS:
  - L10n.SettingsDetails.Actions.ActionsSynced.footerNoActions
    Key: settings_details.actions.actions_synced.footer_no_actions
    Line: 3844
  - L10n.SettingsDetails.Actions.Scenes.customizeAction
    Key: settings_details.actions.scenes.customize_action
    Line: 3862

URLHANDLER:
  - L10n.UrlHandler.Error.actionNotFound
    Key: url_handler.error.action_not_found
    Line: 4675

ROOT:
  - L10n.noArea
    Key: no_area
    Line: 36

================================================================================
Total unused: 13
================================================================================

To clean up these strings, manually remove them from the Localizable.strings files
and regenerate Strings.swift using SwiftGen.

@bgoncal bgoncal changed the title Drop usage of entity_registry in favor of lis_for_display + drop friendly_name usage Drop usage of entity_registry in favor of list_for_display + drop friendly_name usage Jun 11, 2026

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

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/list model + GRDB tables with a single persisted displayEntityRegistry table backed by EntityRegistryListForDisplay.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.

Comment thread Sources/Shared/HAAppEntity.swift Outdated
Comment thread Sources/Extensions/Widgets/Controls/Light/IntentLightEntity.swift Outdated
Comment thread Sources/Extensions/Widgets/Controls/Switch/IntentSwitchEntity.swift Outdated
Comment thread Sources/Extensions/Widgets/Controls/Fan/IntentFanEntity.swift Outdated
Comment thread Sources/Extensions/Widgets/Controls/Cover/IntentCoverEntity.swift Outdated
@bgoncal bgoncal merged commit 3c62221 into main Jun 11, 2026
12 checks passed
@bgoncal bgoncal deleted the list-for-display branch June 11, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants