11from __future__ import annotations
22
3+ import asyncio
34import base64
45import logging
56import threading
@@ -132,7 +133,7 @@ def sync_connect(self) -> bool:
132133
133134 async def async_disconnect (self ) -> None :
134135 async with self ._mutex :
135- async_response = self ._async_response (DISCONNECT_REQUEST_ID )
136+ async_response = asyncio . ensure_future ( self ._async_response (DISCONNECT_REQUEST_ID ) )
136137 disconnecting = self .sync_disconnect ()
137138 if disconnecting :
138139 (_ , err ) = await async_response
@@ -141,7 +142,7 @@ async def async_disconnect(self) -> None:
141142
142143 async def async_connect (self ) -> None :
143144 async with self ._mutex :
144- async_response = self ._async_response (CONNECT_REQUEST_ID )
145+ async_response = asyncio . ensure_future ( self ._async_response (CONNECT_REQUEST_ID ) )
145146 connecting = self .sync_connect ()
146147 if connecting :
147148 (_ , err ) = await async_response
@@ -167,7 +168,7 @@ async def send_message(self, roborock_message: RoborockMessage):
167168 local_key = self .device_info .device .local_key
168169 msg = MessageParser .build (roborock_message , local_key , False )
169170 self ._logger .debug (f"id={ request_id } Requesting method { method } with { params } " )
170- async_response = self ._async_response (request_id , response_protocol )
171+ async_response = asyncio . ensure_future ( self ._async_response (request_id , response_protocol ) )
171172 self ._send_msg_raw (msg )
172173 (response , err ) = await async_response
173174 self ._diagnostic_data [method if method is not None else "unknown" ] = {
0 commit comments