mirror of
https://github.com/home-assistant/core.git
synced 2026-07-15 10:34:19 +01:00
Add to-do list response target for ListAddItemIntent (#121970)
* Add todo list response target for ListAddItemIntent * Delete .vscode/settings.json * Fix imports * Add test * Formatting * Fix test --------- Co-authored-by: Tom Harris <tomharris@harrisnj.net> Co-authored-by: Michael Hansen <mike@rhasspy.org>
This commit is contained in:
@@ -62,4 +62,13 @@ class ListAddItemIntent(intent.IntentHandler):
|
||||
|
||||
response = intent_obj.create_response()
|
||||
response.response_type = intent.IntentResponseType.ACTION_DONE
|
||||
response.async_set_results(
|
||||
[
|
||||
intent.IntentResponseTarget(
|
||||
type=intent.IntentResponseTargetType.ENTITY,
|
||||
name=list_name,
|
||||
id=match_result.states[0].entity_id,
|
||||
)
|
||||
]
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -1145,6 +1145,9 @@ async def test_add_item_intent(
|
||||
assistant=conversation.DOMAIN,
|
||||
)
|
||||
assert response.response_type == intent.IntentResponseType.ACTION_DONE
|
||||
assert response.success_results[0].name == "list 1"
|
||||
assert response.success_results[0].type == intent.IntentResponseTargetType.ENTITY
|
||||
assert response.success_results[0].id == entity1.entity_id
|
||||
|
||||
assert len(entity1.items) == 1
|
||||
assert len(entity2.items) == 0
|
||||
|
||||
Reference in New Issue
Block a user