Set assist pipeline binary sensor to true only when stt-start is received (#98844)

This commit is contained in:
Jesse Hills 2023-08-23 08:00:38 +12:00 committed by GitHub
parent 35a8385d9d
commit 57bc8ae68e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -343,7 +343,6 @@ class ESPHomeManager:
), ),
"esphome.voice_assistant_udp_server.run_pipeline", "esphome.voice_assistant_udp_server.run_pipeline",
) )
self.entry_data.async_set_assist_pipeline_state(True)
return port return port

View File

@ -71,6 +71,7 @@ class VoiceAssistantUDPServer(asyncio.DatagramProtocol):
self.hass = hass self.hass = hass
assert entry_data.device_info is not None assert entry_data.device_info is not None
self.entry_data = entry_data
self.device_info = entry_data.device_info self.device_info = entry_data.device_info
self.queue: asyncio.Queue[bytes] = asyncio.Queue() self.queue: asyncio.Queue[bytes] = asyncio.Queue()
@ -158,7 +159,9 @@ class VoiceAssistantUDPServer(asyncio.DatagramProtocol):
data_to_send = None data_to_send = None
error = False error = False
if event_type == VoiceAssistantEventType.VOICE_ASSISTANT_STT_END: if event_type == VoiceAssistantEventType.VOICE_ASSISTANT_STT_START:
self.entry_data.async_set_assist_pipeline_state(True)
elif event_type == VoiceAssistantEventType.VOICE_ASSISTANT_STT_END:
assert event.data is not None assert event.data is not None
data_to_send = {"text": event.data["stt_output"]["text"]} data_to_send = {"text": event.data["stt_output"]["text"]}
elif event_type == VoiceAssistantEventType.VOICE_ASSISTANT_INTENT_END: elif event_type == VoiceAssistantEventType.VOICE_ASSISTANT_INTENT_END: