From 30a97acdfb39c7472be477ba07eb927b226bd3c8 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Mon, 9 Sep 2024 11:37:38 -0500 Subject: [PATCH] Move code around to try and fix test --- aioesphomeapi/client.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/aioesphomeapi/client.py b/aioesphomeapi/client.py index 6dbbe3a6..08161200 100644 --- a/aioesphomeapi/client.py +++ b/aioesphomeapi/client.py @@ -1373,13 +1373,14 @@ def _on_voice_assistant_audio(msg: VoiceAssistantAudio) -> None: ) ) - def _on_voice_assistant_announcement_finished( - msg: VoiceAssistantAnnounceFinished, - ) -> None: - finished = VoiceAssistantAnnounceFinishedModel.from_pb(msg) - self._create_background_task(handle_announcement_finished(finished)) - if handle_announcement_finished is not None: + + def _on_voice_assistant_announcement_finished( + msg: VoiceAssistantAnnounceFinished, + ) -> None: + finished = VoiceAssistantAnnounceFinishedModel.from_pb(msg) + self._create_background_task(handle_announcement_finished(finished)) + remove_callbacks.append( connection.add_message_callback( _on_voice_assistant_announcement_finished,