Fix custom_text entity-mode snippets staying skipped for text-backed entities - #67
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix custom text provider not updating value from source entity
Fix custom_text entity-mode snippets staying skipped for text-backed entities
Jul 2, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a bug in the custom_text provider’s entity mode where snippets could remain skipped despite the source entity having usable text, by broadening what counts as “text” and expanding supported entity domains.
Changes:
- Add text extraction fallback to common attributes (
text,message,value) when entity state is blank/unknown/unavailable. - Extend the entity selector to allow
textentities in addition to existing domains. - Add regression tests covering attribute-backed text, selector domains, and ensuring entity reads are refreshed on each coordinator
generate().
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| custom_components/user_briefing/providers/custom_text.py | Adds text entity support and robust entity text extraction (state + attribute fallbacks). |
| tests/test_provider_schemas.py | Verifies the custom_text entity selector includes the text domain. |
| tests/test_custom_text.py | Adds test ensuring attribute fallback works when entity state is unknown. |
| tests/test_coordinator.py | Adds regression test ensuring entity-mode custom_text reads the latest entity value on each async_generate(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tamaygz
marked this pull request as ready for review
July 2, 2026 14:23
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.
custom_textsnippets configured in entity mode could remainskippedduring briefing generation even when the linked source entity visibly had content. This was caused by treating the entitystateas the only valid text source and by not allowingtextentities in the selector.Entity-mode text extraction
statewhen it contains usable text.text,message,value) when the state is blank,unknown, orunavailable.Supported source entities
textentities in addition toinput_text,sensor, andtemplate.Regression coverage
unknowngenerate()callstextentities