Skip to content

Commit da83078

Browse files
fix: remove coroutine warning
1 parent bfc37b9 commit da83078

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

roborock/cloud_api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import asyncio
34
import base64
45
import logging
56
import 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"] = {

roborock/local_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ async def send_message(self, roborock_message: RoborockMessage):
153153
if method:
154154
self._logger.debug(f"id={request_id} Requesting method {method} with {params}")
155155
# Send the command to the Roborock device
156-
async_response = self._async_response(request_id, response_protocol)
156+
async_response = asyncio.ensure_future(self._async_response(request_id, response_protocol))
157157
self._send_msg_raw(msg)
158158
(response, err) = await async_response
159159
self._diagnostic_data[method if method is not None else "unknown"] = {

0 commit comments

Comments
 (0)