Use exposed error messages in Assist
Breaking change
Proposed change
Assist includes error messages for 9 different cases where having an entity not exposed causes an intent match failure:
- "turn on standing light" - entity named "standing light" is not exposed
- "turn on lamp in living room" - entity named "lamp" is in living room, but not exposed
- "turn on downstairs TV" - entity named "TV" is on the downstairs floor, but not exposed
- "turn on all the lights" - no lights are exposed
- "turn on lights in the kitchen" - no lights in the kitchen are exposed
- "turn on lights upstairs" - no lights on the upstairs floor are exposed
- "open all windows" - no covers with window device class are exposed
- "open windows in the kitchen" - no windows in the kitchen are exposed
- "open main floor windows" - no windows on the main floor are exposed
(NOTE: We don't have sentences for all of these cases yet)
This PR reports the correct error message for each case, and includes a test for each one. This required one large change, and several smaller changes.
The large change is that intent recognition now has 3 phrases instead of just 2. Previously, a strict match was attempted first and a fuzzy match second. Now, two strict matches are tried, one with only exposed entities, and the other with all entities. This is for cases 1-3 above, where we need to know that a device/entity exists, but is not exposed.
QUESTION: For the second strict match will all entities, can we filter down this list (for example, remove diagnostic entities or domains that Assist can't handle)?
The smaller changes were in async_match_targets keeping track of unexposed entities so that we could distinguish between a name/area/domain/device class not existing and not being exposed.
Type of change
- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [x] New feature (which adds functionality to an existing integration)
- [ ] Deprecation (breaking change to happen in the future)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
Additional information
- This PR fixes or closes issue: fixes #
- This PR is related to issue:
- Link to documentation pull request:
Checklist
- [ ] The code change is tested and works locally.
- [ ] Local tests pass. Your PR cannot be merged unless tests pass
- [ ] There is no commented out code in this PR.
- [ ] I have followed the development checklist
- [ ] I have followed the perfect PR recommendations
- [ ] The code has been formatted using Ruff (
ruff format homeassistant tests) - [ ] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated for www.home-assistant.io
If the code communicates with devices, web services, or third-party tools:
- [ ] The manifest file has all fields filled out correctly.
Updated and included derived files by running:python3 -m script.hassfest. - [ ] New or updated dependencies have been added to
requirements_all.txt.
Updated by runningpython3 -m script.gen_requirements_all. - [ ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
To help with the load of incoming pull requests:
- [ ] I have reviewed two other open pull requests in this repository.
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (conversation) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of conversation can trigger bot actions by commenting:
@home-assistant closeCloses the pull request.@home-assistant rename Awesome new titleRenames the pull request.@home-assistant reopenReopen the pull request.@home-assistant unassign conversationRemoves the current integration label and assignees on the pull request, add the integration domain after the command.@home-assistant add-label needs-more-informationAdd a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.@home-assistant remove-label needs-more-informationRemove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.
Technically a user could expose a config or diagnostic entity. However, I think it's fine to not have those be considered for error messaging. It might be useful in some edge cases but it might not be worth the slowdown.
@arturpragacz appreciate your input! If you have more insights on how we can improve voice, happy to receive it :)