mirror of
https://github.com/home-assistant/core.git
synced 2026-08-20 05:10:44 +01:00
Forward service call context to entity in assist_satellite.ask_question (#179536)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
dbee85c093
commit
465624ef51
@@ -131,6 +131,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
f"Invalid Assist satellite entity id: {satellite_entity_id}"
|
||||
)
|
||||
|
||||
satellite_entity.async_set_context(call.context)
|
||||
|
||||
ask_question_args = {
|
||||
"question": call.data.get("question"),
|
||||
"question_media_id": call.data.get("question_media_id"),
|
||||
|
||||
@@ -916,6 +916,7 @@ async def test_ask_question(
|
||||
"""Test asking a question on a device and matching an answer."""
|
||||
entity_id = "assist_satellite.test_entity"
|
||||
question_text = "What kind of music would you like to listen to?"
|
||||
context = Context()
|
||||
|
||||
await async_update_pipeline(
|
||||
hass, async_get_pipeline(hass), stt_engine="test-stt-engine", stt_language="en"
|
||||
@@ -982,9 +983,11 @@ async def test_ask_question(
|
||||
{"entity_id": entity_id, "question": question_text, **service_data},
|
||||
blocking=True,
|
||||
return_response=True,
|
||||
context=context,
|
||||
)
|
||||
assert entity.state == AssistSatelliteState.IDLE
|
||||
assert response == asdict(expected_answer)
|
||||
assert hass.states.get(entity_id).context is context
|
||||
|
||||
|
||||
async def test_ask_question_requires_entity_permission(
|
||||
|
||||
Reference in New Issue
Block a user