python-roborock 0.32.0__tar.gz → 0.32.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_roborock-0.32.0 → python_roborock-0.32.2}/PKG-INFO +1 -1
- {python_roborock-0.32.0 → python_roborock-0.32.2}/pyproject.toml +1 -1
- {python_roborock-0.32.0 → python_roborock-0.32.2}/roborock/api.py +8 -3
- {python_roborock-0.32.0 → python_roborock-0.32.2}/roborock/cloud_api.py +4 -3
- {python_roborock-0.32.0 → python_roborock-0.32.2}/roborock/local_api.py +1 -1
- {python_roborock-0.32.0 → python_roborock-0.32.2}/LICENSE +0 -0
- {python_roborock-0.32.0 → python_roborock-0.32.2}/README.md +0 -0
- {python_roborock-0.32.0 → python_roborock-0.32.2}/roborock/__init__.py +0 -0
- {python_roborock-0.32.0 → python_roborock-0.32.2}/roborock/cli.py +0 -0
- {python_roborock-0.32.0 → python_roborock-0.32.2}/roborock/code_mappings.py +0 -0
- {python_roborock-0.32.0 → python_roborock-0.32.2}/roborock/command_cache.py +0 -0
- {python_roborock-0.32.0 → python_roborock-0.32.2}/roborock/const.py +0 -0
- {python_roborock-0.32.0 → python_roborock-0.32.2}/roborock/containers.py +0 -0
- {python_roborock-0.32.0 → python_roborock-0.32.2}/roborock/exceptions.py +0 -0
- {python_roborock-0.32.0 → python_roborock-0.32.2}/roborock/protocol.py +0 -0
- {python_roborock-0.32.0 → python_roborock-0.32.2}/roborock/roborock_future.py +0 -0
- {python_roborock-0.32.0 → python_roborock-0.32.2}/roborock/roborock_message.py +0 -0
- {python_roborock-0.32.0 → python_roborock-0.32.2}/roborock/roborock_typing.py +0 -0
- {python_roborock-0.32.0 → python_roborock-0.32.2}/roborock/util.py +0 -0
|
@@ -311,10 +311,8 @@ class RoborockClient:
|
|
|
311
311
|
await self.async_disconnect()
|
|
312
312
|
await self.async_connect()
|
|
313
313
|
|
|
314
|
-
async def
|
|
314
|
+
async def _wait_response(self, request_id: int, queue: RoborockFuture) -> tuple[Any, VacuumError | None]:
|
|
315
315
|
try:
|
|
316
|
-
queue = RoborockFuture(protocol_id)
|
|
317
|
-
self._waiting_queue[request_id] = queue
|
|
318
316
|
(response, err) = await queue.async_get(QUEUE_TIMEOUT)
|
|
319
317
|
if response == "unknown_method":
|
|
320
318
|
raise UnknownMethodError("Unknown method")
|
|
@@ -324,6 +322,13 @@ class RoborockClient:
|
|
|
324
322
|
finally:
|
|
325
323
|
self._waiting_queue.pop(request_id, None)
|
|
326
324
|
|
|
325
|
+
def _async_response(
|
|
326
|
+
self, request_id: int, protocol_id: int = 0
|
|
327
|
+
) -> Coroutine[Any, Any, tuple[Any, VacuumError | None]]:
|
|
328
|
+
queue = RoborockFuture(protocol_id)
|
|
329
|
+
self._waiting_queue[request_id] = queue
|
|
330
|
+
return self._wait_response(request_id, queue)
|
|
331
|
+
|
|
327
332
|
def _get_payload(
|
|
328
333
|
self,
|
|
329
334
|
method: RoborockCommand,
|
|
@@ -1,5 +1,6 @@
|
|
|
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 @@ class RoborockMqttClient(RoborockClient, mqtt.Client):
|
|
|
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 @@ class RoborockMqttClient(RoborockClient, mqtt.Client):
|
|
|
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 @@ class RoborockMqttClient(RoborockClient, mqtt.Client):
|
|
|
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"] = {
|
|
@@ -153,7 +153,7 @@ class RoborockLocalClient(RoborockClient, asyncio.Protocol):
|
|
|
153
153
|
if method:
|
|
154
154
|
self._logger.debug(f"id={request_id} Requesting method {method} with {params}")
|
|
155
155
|
# 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))
|
|
157
157
|
self._send_msg_raw(msg)
|
|
158
158
|
(response, err) = await async_response
|
|
159
159
|
self._diagnostic_data[method if method is not None else "unknown"] = {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|