Close existing UDP server for ESPHome voice assistant (#101845)

This commit is contained in:
Michael Hansen 2023-10-11 13:32:00 -05:00 committed by Franck Nijhof
parent ffe60102fd
commit 3b13c9129a
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

View File

@ -327,7 +327,10 @@ class ESPHomeManager:
) -> int | None:
"""Start a voice assistant pipeline."""
if self.voice_assistant_udp_server is not None:
return None
_LOGGER.warning("Voice assistant UDP server was not stopped")
self.voice_assistant_udp_server.stop()
self.voice_assistant_udp_server.close()
self.voice_assistant_udp_server = None
hass = self.hass
self.voice_assistant_udp_server = VoiceAssistantUDPServer(