Only send ESPHome intent progress when necessary (#147458)

* Only send intent progress when necessary

* cover

* Fix logic

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Michael Hansen
2025-06-24 15:35:38 -05:00
committed by GitHub
parent 9e7c7ec97e
commit 19b773df85
2 changed files with 81 additions and 5 deletions

View File

@@ -284,11 +284,15 @@ class EsphomeAssistSatellite(
assert event.data is not None
data_to_send = {"text": event.data["stt_output"]["text"]}
elif event_type == VoiceAssistantEventType.VOICE_ASSISTANT_INTENT_PROGRESS:
data_to_send = {
"tts_start_streaming": "1"
if (event.data and event.data.get("tts_start_streaming"))
else "0",
}
if (
not event.data
or ("tts_start_streaming" not in event.data)
or (not event.data["tts_start_streaming"])
):
# ESPHome only needs to know if early TTS streaming is available
return
data_to_send = {"tts_start_streaming": "1"}
elif event_type == VoiceAssistantEventType.VOICE_ASSISTANT_INTENT_END:
assert event.data is not None
data_to_send = {