Implement suggestions

This commit is contained in:
Michael Hansen
2026-03-03 11:58:18 -06:00
parent 5b2e0e2a4f
commit cd4db314cd
2 changed files with 11 additions and 6 deletions

View File

@@ -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),
}
)
)

View File

@@ -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