1
1
from __future__ import annotations
2
2
3
+ import asyncio
3
4
import base64
4
5
import logging
5
6
import threading
@@ -132,7 +133,7 @@ def sync_connect(self) -> bool:
132
133
133
134
async def async_disconnect (self ) -> None :
134
135
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 ) )
136
137
disconnecting = self .sync_disconnect ()
137
138
if disconnecting :
138
139
(_ , err ) = await async_response
@@ -141,7 +142,7 @@ async def async_disconnect(self) -> None:
141
142
142
143
async def async_connect (self ) -> None :
143
144
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 ) )
145
146
connecting = self .sync_connect ()
146
147
if connecting :
147
148
(_ , err ) = await async_response
@@ -167,7 +168,7 @@ async def send_message(self, roborock_message: RoborockMessage):
167
168
local_key = self .device_info .device .local_key
168
169
msg = MessageParser .build (roborock_message , local_key , False )
169
170
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 ) )
171
172
self ._send_msg_raw (msg )
172
173
(response , err ) = await async_response
173
174
self ._diagnostic_data [method if method is not None else "unknown" ] = {
0 commit comments