Provide areas and device context for all extensions entity pickers#4756
Conversation
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>
|
Found 21 unused localization strings in the codebase. Click to see detailsTo clean up these strings, manually remove them from the |
There was a problem hiding this comment.
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
EntityContextSubtitleas the shared formatter for entity picker subtitles (Area • Device, with sensible fallbacks). - Updates multiple widget/control/AppIntent
AppEntitytypes to surface area/device context and to populate that context via area/device maps. - Adds an optional
Serverparameter 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. |
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
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>
Summary
Screenshots
Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#
Any other notes