ESPHome Assist Satellite share TTS url in RUN_START (#143460)

This commit is contained in:
Paulus Schoutsen 2025-04-22 14:22:31 -04:00 committed by GitHub
parent a258aa50a5
commit 00fc3e2c29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 0 deletions

View File

@ -336,6 +336,12 @@ class EsphomeAssistSatellite(
"code": event.data["code"],
"message": event.data["message"],
}
elif event_type == VoiceAssistantEventType.VOICE_ASSISTANT_RUN_START:
assert event.data is not None
if tts_output := event.data["tts_output"]:
path = tts_output["url"]
url = async_process_play_media_url(self.hass, path)
data_to_send = {"url": url}
elif event_type == VoiceAssistantEventType.VOICE_ASSISTANT_RUN_END:
if self._tts_streaming_task is None:
# No TTS

View File

@ -345,6 +345,23 @@ async def test_pipeline_api_audio(
{"url": get_url(hass) + mock_tts_result_stream.url},
)
event_callback(
PipelineEvent(
type=PipelineEventType.RUN_START,
data={
"tts_output": {
"media_id": "test-media-id",
"url": mock_tts_result_stream.url,
"token": mock_tts_result_stream.token,
}
},
)
)
assert mock_client.send_voice_assistant_event.call_args_list[-1].args == (
VoiceAssistantEventType.VOICE_ASSISTANT_RUN_START,
{"url": get_url(hass) + mock_tts_result_stream.url},
)
event_callback(PipelineEvent(type=PipelineEventType.RUN_END))
assert mock_client.send_voice_assistant_event.call_args_list[-1].args == (
VoiceAssistantEventType.VOICE_ASSISTANT_RUN_END,