Add floor context to entity pickers and entity display#4875
Open
bgoncal wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds “floor” awareness to entity context/subtitle rendering so entity pickers and AppIntent-based pickers can disambiguate identically named areas by including the floor (e.g., Home • Ground Floor • Living Room • Thermostat) when needed.
Changes:
- Fetches floor registry data and stores floor context alongside areas (floor id + denormalized floor name).
- Extends shared subtitle/context formatting to optionally include floor, and adds collision detection to only show floors when area names collide.
- Plumbs
floorNamethrough MagicItem/AppIntent/Widget entity representations and adds unit tests for the subtitle/disambiguation rules.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/App/Area/EntityContextSubtitle.test.swift | Adds tests for subtitle floor placement/omission and floor disambiguation behavior. |
| Sources/Shared/Models/HAFloorRegistryResponse.swift | Introduces a typed model for the floor registry response. |
| Sources/Shared/Models/HAAreasRegistryResponse.swift | Adds floorId to the area registry response decoding. |
| Sources/Shared/MagicItem/MagicItemProvider.swift | Caches per-server floor-name mappings and includes floor in MagicItem entity context. |
| Sources/Shared/HATypedRequest+App.swift | Adds a typed request for config/floor_registry/list. |
| Sources/Shared/Environment/AppDatabaseUpdater.swift | Resolves and persists floorName into AppArea records when saving areas. |
| Sources/Shared/Environment/AppAreaTable.swift | Adds floorId / floorName columns to the AppArea table schema. |
| Sources/Shared/Environment/AppArea.swift | Persists floorId and denormalized floorName on the AppArea model. |
| Sources/Shared/Database/DatabaseTables.swift | Adds floorId / floorName column identifiers for the AppArea table. |
| Sources/Shared/AreasService.swift | Fetches floors for a server and exposes lookup APIs for floor resolution. |
| Sources/Extensions/Widgets/Scene/Control/IntentSceneEntity.swift | Adds floorName to widget scene entities and wires it into query mapping. |
| Sources/Extensions/Widgets/HAAppEntityAppIntentEntity.swift | Adds floorName to AppIntent entities and includes it in query/collection building. |
| Sources/Extensions/Widgets/Controls/Switch/IntentSwitchEntity.swift | Adds floorName to switch control entities and populates it from floor mappings. |
| Sources/Extensions/Widgets/Controls/Light/IntentLightEntity.swift | Adds floorName to light control entities and populates it from floor mappings. |
| Sources/Extensions/Widgets/Controls/Fan/IntentFanEntity.swift | Adds floorName to fan control entities and populates it from floor mappings. |
| Sources/Extensions/Widgets/Controls/Cover/IntentCoverEntity.swift | Adds floorName to cover control entities and populates it from floor mappings. |
| Sources/Extensions/Widgets/Controls/Button/IntentButtonEntity.swift | Adds floorName to button control entities and populates it from floor mappings. |
| Sources/Extensions/Widgets/Controls/Automation/IntentAutomationEntity.swift | Adds floorName to automation control entities and populates it from floor mappings. |
| Sources/Extensions/EntityProvider+Details.swift | Extends subtitle formatting with floor, adds collision detection helpers, and adds a floor-name mapping helper. |
| Sources/Extensions/AppIntents/Sensor/IntentSensorsAppEntity.swift | Adds floorName to sensor AppIntent entities and populates it from floor mappings. |
| Sources/Extensions/AppIntents/Script/ScriptAppIntent.swift | Adds floorName to script AppIntent entities and populates it from floor mappings. |
| HomeAssistant.xcodeproj/project.pbxproj | Registers the new files in the project and test target build phases. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4875 +/- ##
=======================================
Coverage ? 47.25%
=======================================
Files ? 277
Lines ? 17430
Branches ? 0
=======================================
Hits ? 8236
Misses ? 9194
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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