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 GitHub
parent 257686fcfe
commit f0317f0d59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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(