Skip to content

Provide areas and device context for all extensions entity pickers#4756

Merged
bgoncal merged 9 commits into
mainfrom
entity-naming
Jun 17, 2026
Merged

Provide areas and device context for all extensions entity pickers#4756
bgoncal merged 9 commits into
mainfrom
entity-naming

Conversation

@bgoncal

@bgoncal bgoncal commented Jun 16, 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 and others added 2 commits June 16, 2026 18:18
Add structured naming context (Area • Device) to every entity picker via a shared EntityContextSubtitle helper. Add a separate server picker (flat list instead of per-server sections) to the Light/Switch/Cover/Fan/Button controls and the Sensor widget; Assist pipeline pickers get a server-filter pill + flat list. Scene/Automation/Script and the generic entity picker keep server sections and gain context only — their iOS 16.4 queries can't use IntentParameterDependency (iOS 17+).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Delete orphaned copies left by an earlier folder reorg that are not referenced in the project (never compiled): Widgets/Automation/Control/ and the entire Widgets/OpenEntity/ tree. The live versions live under Widgets/Controls/.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bgoncal bgoncal self-assigned this Jun 16, 2026
Copilot AI review requested due to automatic review settings June 16, 2026 16:34
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

⚠️ Unused L10n strings detected

Found 21 unused localization strings in the codebase.

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

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

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

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

Found 21 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

WIDGETS:
  - L10n.Widgets.Controls.Automations.placeholderTitle
    Key: widgets.controls.automations.placeholder_title
    Line: 5727
  - L10n.Widgets.Controls.Button.placeholderTitle
    Key: widgets.controls.button.placeholder_title
    Line: 5735
  - L10n.Widgets.Controls.Cover.placeholderTitle
    Key: widgets.controls.cover.placeholder_title
    Line: 5745
  - L10n.Widgets.Controls.Fan.placeholderTitle
    Key: widgets.controls.fan.placeholder_title
    Line: 5755
  - L10n.Widgets.Controls.Light.placeholderTitle
    Key: widgets.controls.light.placeholder_title
    Line: 5765
  - L10n.Widgets.Controls.Scenes.placeholderTitle
    Key: widgets.controls.scenes.placeholder_title
    Line: 5919
  - L10n.Widgets.Controls.Scripts.placeholderTitle
    Key: widgets.controls.scripts.placeholder_title
    Line: 5931
  - L10n.Widgets.Controls.Switch.placeholderTitle
    Key: widgets.controls.switch.placeholder_title
    Line: 5939

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

================================================================================
Total unused: 21
================================================================================

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

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 standardizes entity picker context across extensions by adding consistent area/device subtitles to AppEntity display representations and by introducing optional server scoping for ControlWidget / widget configuration entity pickers.

Changes:

  • Introduces EntityContextSubtitle as the shared formatter for entity picker subtitles (Area • Device, with sensible fallbacks).
  • Updates multiple widget/control/AppIntent AppEntity types to surface area/device context and to populate that context via area/device maps.
  • Adds an optional Server parameter to several widget/control configurations and scopes picker results to the selected server when provided; removes legacy/duplicate “OpenEntity” control widget implementations in old paths.

Reviewed changes

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

Show a summary per file
File Description
Sources/Extensions/Widgets/Scene/Control/IntentSceneEntity.swift Adds optional area/device context and subtitle to Scene entity picker items.
Sources/Extensions/Widgets/OpenEntity/ControlOpenSwitch/ControlOpenSwitchValueProvider.swift Removes legacy Open Switch control widget value provider (duplicate/old location).
Sources/Extensions/Widgets/OpenEntity/ControlOpenSwitch/ControlOpenSwitch.swift Removes legacy Open Switch control widget (duplicate/old location).
Sources/Extensions/Widgets/OpenEntity/ControlOpenSensor/ControlOpenSensorValueProvider.swift Removes legacy Open Sensor control widget value provider (duplicate/old location).
Sources/Extensions/Widgets/OpenEntity/ControlOpenSensor/ControlOpenSensor.swift Removes legacy Open Sensor control widget (duplicate/old location).
Sources/Extensions/Widgets/OpenEntity/ControlOpenLock/ControlOpenLockValueProvider.swift Removes legacy Open Lock control widget value provider (duplicate/old location).
Sources/Extensions/Widgets/OpenEntity/ControlOpenLock/ControlOpenLock.swift Removes legacy Open Lock control widget (duplicate/old location).
Sources/Extensions/Widgets/OpenEntity/ControlOpenLight/ControlOpenLightValueProvider.swift Removes legacy Open Light control widget value provider (duplicate/old location).
Sources/Extensions/Widgets/OpenEntity/ControlOpenLight/ControlOpenLight.swift Removes legacy Open Light control widget (duplicate/old location).
Sources/Extensions/Widgets/OpenEntity/ControlOpenInputBoolean/ControlOpenInputBooleanValueProvider.swift Removes legacy Open Input Boolean control widget value provider (duplicate/old location).
Sources/Extensions/Widgets/OpenEntity/ControlOpenInputBoolean/ControlOpenInputBoolean.swift Removes legacy Open Input Boolean control widget (duplicate/old location).
Sources/Extensions/Widgets/OpenEntity/ControlOpenCoverEntity/ControlOpenCoverEntityValueProvider.swift Removes legacy Open Cover control widget value provider (duplicate/old location).
Sources/Extensions/Widgets/OpenEntity/ControlOpenCoverEntity/ControlOpenCoverEntity.swift Removes legacy Open Cover control widget (duplicate/old location).
Sources/Extensions/Widgets/OpenEntity/ControlOpenCamera/ControlOpenCameraValueProvider.swift Removes legacy Open Camera control widget value provider (duplicate/old location).
Sources/Extensions/Widgets/OpenEntity/ControlOpenCamera/ControlOpenCamera.swift Removes legacy Open Camera control widget (duplicate/old location).
Sources/Extensions/Widgets/HAAppEntityAppIntentEntity.swift Switches subtitle generation to EntityContextSubtitle and makes subtitle optional.
Sources/Extensions/Widgets/Controls/Switch/IntentSwitchEntity.swift Uses EntityContextSubtitle and adds server-scoped picker behavior (when configured).
Sources/Extensions/Widgets/Controls/Switch/ControlSwitchValueProvider.swift Adds optional server parameter to switch control configuration intent.
Sources/Extensions/Widgets/Controls/Light/IntentLightEntity.swift Uses EntityContextSubtitle and adds server-scoped picker behavior (when configured).
Sources/Extensions/Widgets/Controls/Light/ControlLightsValueProvider.swift Adds optional server parameter to lights control configuration intent.
Sources/Extensions/Widgets/Controls/Fan/IntentFanEntity.swift Uses EntityContextSubtitle and adds server-scoped picker behavior (when configured).
Sources/Extensions/Widgets/Controls/Fan/ControlFanValueProvider.swift Adds optional server parameter to fan control configuration intent.
Sources/Extensions/Widgets/Controls/Cover/IntentCoverEntity.swift Uses EntityContextSubtitle and adds server-scoped picker behavior (when configured).
Sources/Extensions/Widgets/Controls/Cover/ControlCoverValueProvider.swift Adds optional server parameter to cover control configuration intent.
Sources/Extensions/Widgets/Controls/Button/IntentButtonEntity.swift Adds optional area/device context + server-scoped picker behavior for button entities.
Sources/Extensions/Widgets/Controls/Button/ControlButtonValueProvider.swift Adds optional server parameter to button control configuration intent.
Sources/Extensions/Widgets/Controls/Automation/IntentAutomationEntity.swift Adds optional area/device context and subtitle to Automation entity picker items.
Sources/Extensions/Widgets/Automation/Control/ControlAutomationsValueProvider.swift Removes legacy automations control value provider (duplicate/old location).
Sources/Extensions/EntityProvider+Details.swift Introduces EntityContextSubtitle and refactors HAAppEntity.contextualSubtitle to use it.
Sources/Extensions/AppIntents/Widget/Sensor/WidgetSensorsAppIntent.swift Adds optional server parameter to the Sensors widget configuration intent.
Sources/Extensions/AppIntents/Sensor/IntentSensorsAppEntity.swift Adds optional area/device context + server-scoped picker behavior for sensor entities.
Sources/Extensions/AppIntents/Script/ScriptAppIntent.swift Adds optional area/device context and subtitle to Script entity picker items.
Sources/App/Settings/MagicItem/AssistPipelinePicker.swift Adds server filtering UI to assist pipeline picker sheet.
Sources/App/Settings/MagicItem/Add/AssistPipelineAddList.swift Adds server filtering UI when adding an assist pipeline MagicItem.

Comment thread Sources/Extensions/EntityProvider+Details.swift Outdated
Comment thread Sources/Extensions/Widgets/Controls/Button/IntentButtonEntity.swift
Comment thread Sources/Extensions/Widgets/Controls/Button/IntentButtonEntity.swift
Comment thread Sources/Extensions/AppIntents/Sensor/IntentSensorsAppEntity.swift
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 24 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@bbd0b91). Learn more about missing BASE report.

Files with missing lines Patch % Lines
Sources/Extensions/EntityProvider+Details.swift 0.00% 24 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4756   +/-   ##
=======================================
  Coverage        ?   45.19%           
=======================================
  Files           ?      275           
  Lines           ?    16720           
  Branches        ?        0           
=======================================
  Hits            ?     7556           
  Misses          ?     9164           
  Partials        ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

bgoncal and others added 6 commits June 17, 2026 11:26
The server-filter/flat-list changes to the Assist pickers did not improve the experience in testing; restore the original per-server sectioned pickers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Delete the Open Cover, Open Input Boolean, Open Light, Open Lock, Open Sensor and Open Switch controls: the generic Open Entity control opens any entity (including these domains), so the per-domain variants were duplicates. Removes the control structs + value providers, their WidgetBundle registrations, WidgetsKind cases, and project references. Open Entity and Open Camera are kept.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- EntityContextSubtitle.make: return nil instead of a blank line when the entity-id fallback is empty/whitespace (placeholders, pending-configuration entities).

- IntentButtonEntity: wrap @IntentParameterDependency and its server-scoping branch in #if WIDGET_EXTENSION, matching the other ControlWidget entity queries.

- IntentSensorsAppEntity.defaultResult(): respect the server selected in the configuration instead of defaulting to a sensor from any server.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the assertions for the deleted controlOpen{Lock,CoverEntity,InputBoolean,Light,Switch,Sensor} cases and update allCases.count (27 -> 21).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bgoncal bgoncal merged commit 12aa9c9 into main Jun 17, 2026
15 checks passed
@bgoncal bgoncal deleted the entity-naming branch June 17, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants