Resolve person member entities in search - #175462
Merged
Merged
Conversation
Contributor
|
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the Search integration’s handling of person results so that device tracker member entities are “up-resolved” (device/area/floor/config entry/integration) the same way as other member/referenced-entity search paths (e.g., scenes).
Changes:
- Update person search to resolve each member entity “up” via the same per-entity loop pattern used by scene search.
- Correct an inaccurate comment in
_async_search_person. - Strengthen Search tests by registering a
mobile_app-backed device tracker with an associated device/config entry and asserting the additional resolved search results.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
homeassistant/components/search/__init__.py |
Changes person search to iterate member entities and call _async_resolve_up_entity so related device/config entry/integration data is included. |
tests/components/search/test_init.py |
Improves fixtures to register a real mobile_app device tracker + device/config entry and expands assertions for entity/person search results. |
justanotherariel
approved these changes
Jul 3, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Breaking change
Proposed change
Every search path in the search integration that walks member or referenced entities (scene, group, automation, script) resolves each entity up to its device, area, floor, config entry, and integration. Person search is the exception: it adds the member device trackers flat. As a result, searching a person never surfaces the device behind their phone tracker, the mobile_app config entry, or the integration providing it.
This change resolves each person member entity up, using the exact same loop pattern scene search uses for its entities. It also fixes a copy/paste comment in the same method (the person method claimed to up resolve "the scene entity").
Tests: the fixture now registers
device_tracker.paulus_iphoneproperly, behind amobile_appconfig entry with a device, instead of using an unregistered entity id string. The person search assertion gains the device, config entry, and integration, and the entity search assertion for the tracker picks up the same three from the richer fixture. Fails without the fix.Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: