From a6f174c5929080a47b89c9896202b0e8ad753ea6 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Thu, 4 Apr 2024 18:11:43 +1300 Subject: [PATCH] Always require `handle_stop` --- aioesphomeapi/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aioesphomeapi/client.py b/aioesphomeapi/client.py index 20a502e..d331573 100644 --- a/aioesphomeapi/client.py +++ b/aioesphomeapi/client.py @@ -1234,7 +1234,7 @@ class APIClient: [str, int, VoiceAssistantAudioSettingsModel, str | None], Coroutine[Any, Any, int | None], ], - handle_stop: Callable[[], Coroutine[Any, Any, None]] | None = None, + handle_stop: Callable[[], Coroutine[Any, Any, None]], handle_audio: ( Callable[ [bytes], @@ -1284,7 +1284,7 @@ class APIClient: start_task.add_done_callback(_started) # We hold a reference to the start_task in unsub function # so we don't need to add it to the background tasks. - elif handle_stop is not None: + elif handle_audio is None: self._create_background_task(handle_stop()) remove_callbacks = []