-
-
Notifications
You must be signed in to change notification settings - Fork 34.6k
Add extract_from_target websocket command #150124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
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
|
There was a problem hiding this comment.
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 adds a new expand_target
websocket command that provides a consistent way for frontend and core to expand various target types (entities, devices, areas, labels) into their constituent entities and references.
- Introduces a new websocket command
expand_target
that processes target selectors and returns expanded entity references - Adds comprehensive test coverage for the new command including edge cases and validation scenarios
- Provides structured output including referenced entities/devices/areas and missing items for error handling
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
homeassistant/components/websocket_api/commands.py | Implements the new expand_target websocket command handler with validation and target expansion logic |
tests/components/websocket_api/test_commands.py | Adds comprehensive test suite covering various target types, edge cases, and validation scenarios |
Comments suppressed due to low confidence (1)
tests/components/websocket_api/test_commands.py:158
- The type annotation
dict[str, str]
is incorrect as targets can contain lists of strings, not just strings. Should bedict[str, Any]
or a more specific type that accommodates the actual structure.
assert len(runs) == 1
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Proposed change
Add a new
expand_target
websocket command so that frontend and core have a consistent way of expanding targets.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: