mirror of
https://github.com/home-assistant/core.git
synced 2026-04-20 10:36:06 +00:00
Implement suggestions
This commit is contained in:
@@ -627,10 +627,10 @@ class IntentHandleView(http.HomeAssistantView):
|
||||
{
|
||||
vol.Required("name"): cv.string,
|
||||
vol.Optional("data"): vol.Schema({cv.string: object}),
|
||||
vol.Optional("language"): str,
|
||||
vol.Optional("assistant"): vol.Any(str, None),
|
||||
vol.Optional("device_id"): vol.Any(str, None),
|
||||
vol.Optional("satellite_id"): vol.Any(str, None),
|
||||
vol.Optional("language"): cv.string,
|
||||
vol.Optional("assistant"): vol.Any(cv.string, None),
|
||||
vol.Optional("device_id"): vol.Any(cv.string, None),
|
||||
vol.Optional("satellite_id"): vol.Any(cv.string, None),
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -102,9 +102,13 @@ async def test_http_language_device_satellite_id(
|
||||
|
||||
intent_type = "TestIntent"
|
||||
|
||||
async def async_handle(self, intent_obj):
|
||||
async def async_handle(self, intent_obj: intent.Intent):
|
||||
"""Handle the intent."""
|
||||
assert intent_obj.context.user_id == hass_admin_user.id
|
||||
assert intent_obj.device_id == device_id
|
||||
assert intent_obj.satellite_id == satellite_id
|
||||
assert intent_obj.language == language
|
||||
|
||||
response = intent_obj.create_response()
|
||||
response.async_set_speech("Test response")
|
||||
response.async_set_speech_slots({"slot1": "value 1", "slot2": 2})
|
||||
@@ -196,7 +200,8 @@ async def test_http_assistant(
|
||||
"/api/intent/handle",
|
||||
json={
|
||||
"name": "HassTurnOn",
|
||||
"data": {"name": "Garage Door 1", "assistant": conversation.DOMAIN},
|
||||
"data": {"name": "Garage Door 1"},
|
||||
"assistant": conversation.DOMAIN,
|
||||
},
|
||||
)
|
||||
assert resp.status == 200
|
||||
|
||||
Reference in New Issue
Block a user