diff --git a/aioesphomeapi/connection.py b/aioesphomeapi/connection.py index 5925a461..ceee89e6 100644 --- a/aioesphomeapi/connection.py +++ b/aioesphomeapi/connection.py @@ -118,6 +118,7 @@ def __init__( self._ping_stop_event = asyncio.Event() self._connect_task: Optional[asyncio.Task[None]] = None + self._keep_alive_task: Optional[asyncio.Task[None]] = None self._fatal_exception: Optional[Exception] = None self._expected_disconnect = False diff --git a/aioesphomeapi/reconnect_logic.py b/aioesphomeapi/reconnect_logic.py index 4d14588b..c0160a57 100644 --- a/aioesphomeapi/reconnect_logic.py +++ b/aioesphomeapi/reconnect_logic.py @@ -59,6 +59,7 @@ def __init__( self._wait_task_lock = asyncio.Lock() # Event for tracking when logic should stop self._stop_event = asyncio.Event() + self._stop_task: Optional[asyncio.Task[None]] = None @property def _is_stopped(self) -> bool: