Commit Graph

53 Commits (b3b5ca9b9592f2df4ff5e2b740cb5c2b52cd2498)

Author SHA1 Message Date
Ville Skyttä 3b4774d9ed
Remove unnnecessary pylint configs from components/[a-d]* (#98911) 2023-08-24 00:54:02 +02:00
Michael Hansen 7e3fdd85fc
Add wildcards to sentence triggers (#97236)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-07-27 20:30:42 +02:00
Marc Mueller 797a9c1ead
Improve `async_track_state_added/removed_domain` callback typing (#97126) 2023-07-24 09:11:41 +02:00
Michael Hansen d811fa0e74
Sentence trigger (#94613)
* Add async_register_trigger_sentences for default agent

* Add trigger response and trigger handler

* Check callback in test

* Clean up and move response to callback

* Add trigger test

* Drop TriggerAction

* Test we pass sentence to callback

* Match triggers once, allow multiple sentences

* Don't use trigger id

* Use async callback

* No response for now

* Use asyncio.gather for callback responses

* Fix after rebase

* Use a list for trigger sentences

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-06-22 18:29:34 -05:00
Michael Hansen 38614bc3f0
Add websocket command to test intent recognition for default agent (#94674)
* Add websocket command to test intent recognition for default agent

* Return results as a list

* Only check intent name/entities in test

* Less verbose output in debug API
2023-06-22 12:24:59 -04:00
Tudor Sandu 95e4ef2255
Fix states not being translated in voice assistants (#93572)
Fix states not being translated
2023-06-01 20:10:57 -04:00
Tudor Sandu fe472e6c5b
Fix error if a `custom_sentences` file is empty (#93530)
* Fix #93528

* Log warning file is invalid

* More explicit log warning message

* Rewrite log message
2023-05-30 19:53:52 -04:00
J. Nick Koston e2b69fc470
Significantly improve performance of conversation default_agent listening for new states (#93577)
Use the async_track_state_added_domain helper instead of tracking
all state changes and rejecting them as it is already optimized
for this job
2023-05-25 23:04:38 -04:00
Michael Hansen 74560ab139
Skip unexposed entities in intent handlers (#92415)
* Filter intent handler entities by exposure

* Add test for skipping unexposed entities
2023-05-03 12:18:31 -04:00
Erik Montnemery 0126cfa9d9
Allow exposing any entity to the default conversation agent (#92398)
* Allow exposing any entity to the default conversation agent

* Tweak

* Fix race, update tests

* Update tests
2023-05-03 09:45:54 -04:00
Erik Montnemery 4860a8d1e8
Don't use storage collection helper in ExposedEntities (#92396)
* Don't use storage collection helper in ExposedEntities

* Fix tests
2023-05-03 12:39:22 +02:00
Erik Montnemery e3c16e634b
Allow exposing entities not in the entity registry to assistants (#92363) 2023-05-02 22:08:09 +02:00
Erik Montnemery ebd9cd096a
Keep expose setting in sync for assist (#92158)
* Keep expose setting in sync for assist

* Fix initialization, add test

* Fix tests

* Add AgentManager.async_setup

* Fix typo

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-04-28 15:59:21 +02:00
Erik Montnemery dc3c47986b
Add property `supported_languages` to `AbstractConversationAgent` (#91588)
* Add property supported_languages to AbstractConversationAgent

* Fix test

* Use MATCH_ALL for openai supported languages
2023-04-18 15:11:04 -05:00
rlippmann f5911bcad6
Add slots to dataclasses in default_config (#91410)
* add dataclass slots to default config items

* remove slots from sun mixing
2023-04-14 14:22:39 -04:00
Erik Montnemery 2c9e9d0fde
Allow UI configuration of entities exposed to voice_assistant (#91233)
* Allow UI configuration of entities exposed to voice_assistant

* Invalidate cache when settings change

* Add tests

* Expose entities to conversation by default

* Update tests
2023-04-11 22:39:40 -04:00
Erik Montnemery 3c8397a7b9
Flush conversation name cache when an entity is renamed (#91214) 2023-04-11 08:33:08 -04:00
epenet 0e4c32efe2
Adjust registry access in conversation (#88879) 2023-02-28 21:56:18 -05:00
Michael Hansen e0bdb3ecc3
Update intent sentences package (#88933)
* Actually use translated state names in response

* Change test result now that locks are excluded from HassTurnOn

* Bump home-assistant-intents and hassil versions
2023-02-28 21:07:18 -05:00
Michael Hansen a71487a42b
Make a copy of matching states so translated state names can be used (#88683) 2023-02-23 20:50:23 -05:00
Michael Hansen d5f1713498
Include binary_sensor in default Assist exposed domains (#88682) 2023-02-23 19:40:10 -05:00
Michael Hansen 5bf3a0b7af
Load custom sentences for language variations (en-us, etc.) (#88498) 2023-02-20 12:28:04 -05:00
Marc Mueller f3c6558db4
Improve conversation typing (#88440) 2023-02-19 21:27:30 -05:00
Michael Hansen 325674ec44
Only expose default cloud domains in Assist default agent (#88274)
* Only expose default cloud domains in default agent

* Copy exposed domain list to conversation

* Implement requested changes

* Add test for exposed devices/areas
2023-02-17 16:19:22 -05:00
epenet ba23816a0c
Inverse json import logic (#88099)
* Fix helpers and util

* Adjust components

* Move back errors

* Add report

* mypy

* mypy

* Assert deprecation messages

* Move test_json_loads_object

* Adjust tests

* Fix rebase

* Adjust pylint plugin

* Fix plugin

* Adjust references

* Adjust backup tests
2023-02-16 11:37:57 +01:00
Michael Hansen 8cd5106c15
Add HassGetState intent for queries (#87808)
* Use names instead of entity ids for list

* Add HassGetState for Assist queries

* Add unknown area to test

* Clean up and test device classes
2023-02-09 23:39:46 -05:00
epenet a202588fd2
Add return type to json_loads (#85672)
* Add JSON type definitions

* Sample use

* Keep mutable for a follo-up PR (avoid dead code)

* Use list/dict

* Remove JsonObjectType

* Remove reference to Union

* Cleanup

* Improve rest

* Rename json_dict => json_data

* Add docstring

* Add type hint to json_loads

* Add cast

* Move type alias to json helpers

* Cleanup

* Create and use json_loads_object

* Make error more explicit and add tests

* Use JsonObjectType in conversation

* Remove quotes
2023-02-07 17:21:55 +01:00
Paulus Schoutsen f32f46aff5
Fix Assist skipping entities that are hidden or have entity category (#87096)
Skipping entities that are hidden or have entity category
2023-02-01 10:48:04 -06:00
Michael Hansen be69c81db5
Prioritize entity names over area names in Assist matching (#86982)
* Refactor async_match_states

* Check entity name after state, before aliases

* Give entity name matches priority over area names

* Don't force result to have area

* Add area alias in tests

* Move name/area list creation back

* Clean up PR

* More clean up
2023-01-30 23:46:25 -05:00
Michael Hansen f7fdaadde0
Performance improvements for Assist (#86966)
* Move hassil recognize into executor

* Bump hassil to 0.2.6

* Disable template parsing in name/area lists

* Don't iterate over hass.config.components directly
2023-01-30 12:25:22 -06:00
J. Nick Koston 691a234090
Cache the names and area lists in the default agent (#86874)
* Cache the names and area lists in the default agent

fixes #86803

* add coverage to make sure the entity cache busts

* add areas test

* cover the last line
2023-01-29 07:16:29 -05:00
Michael Hansen adeaf746ec
Use device area id in intent matching (#86678)
* Use device area id when matching

* Normalize whitespace in response

* Add extra test entity
2023-01-26 09:48:49 -06:00
Paulus Schoutsen 6c8efe3a3b
Conversation cleanup (#86592)
* Require config entry when setting Conversation agent, add new unset agent method

* Remove onboarding from conversation agent

* Type attribution

* Wrap async_process params in ConversationInput object
2023-01-24 21:47:49 -06:00
Michael Hansen ea95abcb30
Use intent responses from home-assistant-intents (#86484)
* Use intent responses from home_assistant_intents

* Use error responses from home_assistant_intents

* Remove speech checks for intent tests (set by conversation now)

* Bump hassil and home-assistant-intents versions

* Use Home Assistant JSON reader when loading intents

* Remove speech checks for light tests (done in agent)

* Add more tests for code coverage

* Add test for reloading on new component

* Add test for non-default response
2023-01-23 22:38:41 -05:00
Michael Hansen 255611238b
Conversation config (#86326)
* Restore conversation config

* Fall back to en for en_US, etc.

* Simplify config passing around

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-01-20 21:39:49 -05:00
Michael Hansen 5aca996f22
HassTurnOn/Off intents to also handle cover entities (#86206)
* Move entity/area resolution to async_match_states

* Special case for covers in HassTurnOn/Off

* Enable light color/brightness on areas

* Remove async_register from default agent

* Remove CONFIG_SCHEMA from conversation component

* Fix intent tests

* Fix light test

* Move entity/area resolution to async_match_states

* Special case for covers in HassTurnOn/Off

* Enable light color/brightness on areas

* Remove async_register from default agent

* Remove CONFIG_SCHEMA from conversation component

* Fix intent tests

* Fix light test

* Fix humidifier intent handlers

* Remove DATA_CONFIG for conversation

* Copy ServiceIntentHandler code to light

* Add proper errors to humidifier intent handlers
2023-01-19 17:15:01 -06:00
Paulus Schoutsen 9631146745
Add conversation mobile app webhook (#86239)
* Add conversation mobile app webhook

* Re-instate removed unused import which was used as fixture
2023-01-19 13:59:02 -05:00
Michael Hansen 2f98485ae7
Add conversation reload service (#86175)
* Add preload and reload service calls to conversation

* Add conversation preload/reload to websocket API

* Merge prepare into reload

* reload service and prepare websocket API

* Add preload and reload service calls to conversation

* Add conversation preload/reload to websocket API

* Merge prepare into reload

* reload service and prepare websocket API

* Add language lock for loading intents

* Add more tests for code coverage
2023-01-18 19:36:51 -06:00
Michael Hansen 07bd208c7d
Load custom sentences from config directory (#85558)
* Load custom sentences from config directory

* Load custom sentences from config directory

* Custom sentences in custom_sentences/<language>/

* Load custom sentences from config directory

* Custom sentences in custom_sentences/<language>/

* Add custom_sentences test
2023-01-09 16:48:59 -06:00
Michael Hansen ecaec0332d
Hassil intents (#85156)
* Add hassil to requirements

* Add intent sentences

* Update sentences

* Use hassil to recognize intents in conversation

* Fix tests

* Bump hassil due to dependency conflict

* Add dataclasses-json package contraints

* Bump hassil (removes dataclasses-json dependency)

* Remove climate sentences until intents are supported

* Move I/O outside event loop

* Bump hassil to 0.2.3

* Fix light tests

* Handle areas in intents

* Clean up code according to suggestions

* Remove sentences from repo

* Use home-assistant-intents package

* Apply suggestions from code review

* Flake8

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-01-07 16:20:21 -05:00
Michael Hansen 961c8cc167
Update intent response (#83858)
* Add language to conversation and intent response

* Move language to intent response instead of speech

* Extend intent response for voice MVP

* Add tests for error conditions in conversation/process

* Move intent response type data into "data" field

* Move intent response error message back to speech

* Remove "success" from intent response

* Add id to target in intent response

* target defaults to None

* Update homeassistant/helpers/intent.py

* Fix test

* Return conversation_id and multiple targets

* Clean up git mess

* Fix linting errors

* Fix more async_handle signatures

* Separate conversation_id and IntentResponse

* Add unknown error code

* Add ConversationResult

* Don't set domain on single entity

* Language is required for intent response

* Add partial_action_done

* Default language in almond agent

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-12-13 16:46:40 -06:00
Michael Hansen ac87528bec
Add language to conversation and intent response (#83486)
* Add language to conversation and intent response

* Add language parameter to conversation/process service

* Move language to intent response instead of speech

* Add language to almond conversation agent

* Fix intent test
2022-12-08 11:39:28 -05:00
epenet 7e0515b119
Remove conversation from mypy ignore list (#74991) 2022-07-11 17:47:33 +02:00
Josh Soref 4bf0510b78
spelling: components/conversation (#64238)
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-01-17 16:27:25 +01:00
Marc Mueller b1d49b3b66
Use assignment expressions 29 (#58713) 2021-10-30 16:31:43 +02:00
Marc Mueller f149bef9f3
Use assignment expressions 18 (#57967) 2021-10-18 18:36:35 +02:00
Shay Levy cf228e3fe5
Add constructor return type in integrations A-D (#50903) 2021-05-20 18:51:39 +03:00
Marc Mueller 7c0734bdd5
Update typing 05 (#48038) 2021-03-17 23:43:55 +01:00
Philip Allgaier 625bbe6238
Cleanup unused loggers (components A-M) (#41600) 2020-10-12 16:59:05 +02:00
Paulus Schoutsen d1aa0cea97
Move intent registration to own integration (#29280)
* Move intent registration to own integration.

* Lint
2019-12-01 14:12:57 -08:00