Add TARGET_FIELDS to config validation#150238
Merged
abmantis merged 3 commits intoAug 26, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new TARGET_FIELDS constant for use in LLM field serialization, replacing the previous use of TARGET_SERVICE_FIELDS. The change streamlines target field validation by simplifying the schema structure to only accept arrays of strings for each target type (entity_id, device_id, area_id, floor_id, label_id).
Key changes:
- Adds a new
TARGET_FIELDSvalidation schema with simplified array-only structure - Updates the LLM selector serializer to use the new
TARGET_FIELDSinstead ofTARGET_SERVICE_FIELDS - Updates corresponding tests to reflect the simplified schema structure
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| homeassistant/helpers/config_validation.py | Adds new TARGET_FIELDS constant with simplified array-based validation for target fields |
| homeassistant/helpers/llm.py | Updates selector serializer to use new TARGET_FIELDS instead of TARGET_SERVICE_FIELDS |
| tests/helpers/test_llm.py | Updates test expectations to match the simplified target selector schema output |
19 tasks
9d30e3e to
702828e
Compare
19 tasks
Member
|
Please explain in the PR description why it's good to use the new validator instead of |
Member
Author
|
@MartinHjelmare Done. |
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.
Proposed change
New streamlined
TARGET_FIELDSwas added for use in LLM fields serializer.TARGET_SERVICE_FIELDS, that was used before, includes a lot of bloat, that accumulated over the years. That schema accepts things like:None of that should be present in the validation schema for the LLMs, as we want them to always give us the right output, and don't need to be involved with all that accumulated baggage.
The new schema should also be used for the new targeted conditions and triggers, as we don't have to concern ourselves with backwards compatibility there, and should be stricter in the input we accept.
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: