python-roborock 2.8.4__tar.gz → 2.8.5__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-2.8.4 → python_roborock-2.8.5}/PKG-INFO +2 -2
- {python_roborock-2.8.4 → python_roborock-2.8.5}/pyproject.toml +1 -1
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/api.py +10 -16
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/version_1_apis/roborock_client_v1.py +7 -1
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/version_1_apis/roborock_local_client_v1.py +1 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/version_1_apis/roborock_mqtt_client_v1.py +1 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/LICENSE +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/README.md +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/__init__.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/cli.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/cloud_api.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/code_mappings.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/command_cache.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/const.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/containers.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/exceptions.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/local_api.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/protocol.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/py.typed +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/roborock_future.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/roborock_message.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/roborock_typing.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/util.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/version_1_apis/__init__.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/version_a01_apis/__init__.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/version_a01_apis/roborock_client_a01.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/version_a01_apis/roborock_mqtt_client_a01.py +0 -0
- {python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/web_api.py +0 -0
|
@@ -7,7 +7,7 @@ import base64
|
|
|
7
7
|
import logging
|
|
8
8
|
import secrets
|
|
9
9
|
import time
|
|
10
|
-
from collections.abc import
|
|
10
|
+
from collections.abc import Coroutine
|
|
11
11
|
from typing import Any
|
|
12
12
|
|
|
13
13
|
from .containers import (
|
|
@@ -36,8 +36,8 @@ class RoborockClient:
|
|
|
36
36
|
self._endpoint = endpoint
|
|
37
37
|
self._nonce = secrets.token_bytes(16)
|
|
38
38
|
self._waiting_queue: dict[int, RoborockFuture] = {}
|
|
39
|
-
self._last_device_msg_in =
|
|
40
|
-
self._last_disconnection =
|
|
39
|
+
self._last_device_msg_in = time.monotonic()
|
|
40
|
+
self._last_disconnection = time.monotonic()
|
|
41
41
|
self.keep_alive = KEEPALIVE
|
|
42
42
|
self._diagnostic_data: dict[str, dict[str, Any]] = {
|
|
43
43
|
"misc_info": {"Nonce": base64.b64encode(self._nonce).decode("utf-8")}
|
|
@@ -59,15 +59,6 @@ class RoborockClient:
|
|
|
59
59
|
def diagnostic_data(self) -> dict:
|
|
60
60
|
return self._diagnostic_data
|
|
61
61
|
|
|
62
|
-
@property
|
|
63
|
-
def time_func(self) -> Callable[[], float]:
|
|
64
|
-
try:
|
|
65
|
-
# Use monotonic clock if available
|
|
66
|
-
time_func = time.monotonic
|
|
67
|
-
except AttributeError:
|
|
68
|
-
time_func = time.time
|
|
69
|
-
return time_func
|
|
70
|
-
|
|
71
62
|
async def async_connect(self):
|
|
72
63
|
raise NotImplementedError
|
|
73
64
|
|
|
@@ -81,13 +72,13 @@ class RoborockClient:
|
|
|
81
72
|
raise NotImplementedError
|
|
82
73
|
|
|
83
74
|
def on_connection_lost(self, exc: Exception | None) -> None:
|
|
84
|
-
self._last_disconnection =
|
|
75
|
+
self._last_disconnection = time.monotonic()
|
|
85
76
|
self._logger.info("Roborock client disconnected")
|
|
86
77
|
if exc is not None:
|
|
87
78
|
self._logger.warning(exc)
|
|
88
79
|
|
|
89
80
|
def should_keepalive(self) -> bool:
|
|
90
|
-
now =
|
|
81
|
+
now = time.monotonic()
|
|
91
82
|
# noinspection PyUnresolvedReferences
|
|
92
83
|
if now - self._last_disconnection > self.keep_alive**2 and now - self._last_device_msg_in > self.keep_alive:
|
|
93
84
|
return False
|
|
@@ -116,8 +107,11 @@ class RoborockClient:
|
|
|
116
107
|
if request_id in self._waiting_queue:
|
|
117
108
|
new_id = get_next_int(10000, 32767)
|
|
118
109
|
_LOGGER.warning(
|
|
119
|
-
|
|
120
|
-
|
|
110
|
+
"Attempting to create a future with an existing id %s (%s)... New id is %s. "
|
|
111
|
+
"Code may not function properly.",
|
|
112
|
+
request_id,
|
|
113
|
+
protocol_id,
|
|
114
|
+
new_id,
|
|
121
115
|
)
|
|
122
116
|
request_id = new_id
|
|
123
117
|
self._waiting_queue[request_id] = queue
|
{python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/version_1_apis/roborock_client_v1.py
RENAMED
|
@@ -361,7 +361,7 @@ class RoborockClientV1(RoborockClient):
|
|
|
361
361
|
|
|
362
362
|
def on_message_received(self, messages: list[RoborockMessage]) -> None:
|
|
363
363
|
try:
|
|
364
|
-
self._last_device_msg_in =
|
|
364
|
+
self._last_device_msg_in = time.monotonic()
|
|
365
365
|
for data in messages:
|
|
366
366
|
protocol = data.protocol
|
|
367
367
|
if data.payload and protocol in [
|
|
@@ -391,6 +391,8 @@ class RoborockClientV1(RoborockClient):
|
|
|
391
391
|
if isinstance(result, list) and len(result) == 1:
|
|
392
392
|
result = result[0]
|
|
393
393
|
queue.resolve((result, None))
|
|
394
|
+
else:
|
|
395
|
+
self._logger.debug("Received response for unknown request id %s", request_id)
|
|
394
396
|
else:
|
|
395
397
|
try:
|
|
396
398
|
data_protocol = RoborockDataProtocol(int(data_point_number))
|
|
@@ -443,10 +445,14 @@ class RoborockClientV1(RoborockClient):
|
|
|
443
445
|
if isinstance(decompressed, list):
|
|
444
446
|
decompressed = decompressed[0]
|
|
445
447
|
queue.resolve((decompressed, None))
|
|
448
|
+
else:
|
|
449
|
+
self._logger.debug("Received response for unknown request id %s", request_id)
|
|
446
450
|
else:
|
|
447
451
|
queue = self._waiting_queue.get(data.seq)
|
|
448
452
|
if queue:
|
|
449
453
|
queue.resolve((data.payload, None))
|
|
454
|
+
else:
|
|
455
|
+
self._logger.debug("Received response for unknown request id %s", data.seq)
|
|
450
456
|
except Exception as ex:
|
|
451
457
|
self._logger.exception(ex)
|
|
452
458
|
|
{python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/version_1_apis/roborock_local_client_v1.py
RENAMED
|
@@ -18,6 +18,7 @@ class RoborockLocalClientV1(RoborockLocalClient, RoborockClientV1):
|
|
|
18
18
|
) -> RoborockMessage:
|
|
19
19
|
secured = True if method in COMMANDS_SECURED else False
|
|
20
20
|
request_id, timestamp, payload = self._get_payload(method, params, secured)
|
|
21
|
+
self._logger.debug("Building message id %s for method %s", request_id, method)
|
|
21
22
|
request_protocol = RoborockMessageProtocol.GENERAL_REQUEST
|
|
22
23
|
message_retry: MessageRetry | None = None
|
|
23
24
|
if method == RoborockCommand.RETRY_REQUEST and isinstance(params, dict):
|
{python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/version_1_apis/roborock_mqtt_client_v1.py
RENAMED
|
@@ -74,6 +74,7 @@ class RoborockMqttClientV1(RoborockMqttClient, RoborockClientV1):
|
|
|
74
74
|
# When we have more custom commands do something more complicated here
|
|
75
75
|
return await self._get_calibration_points()
|
|
76
76
|
request_id, timestamp, payload = self._get_payload(method, params, True)
|
|
77
|
+
self._logger.debug("Building message id %s for method %s", request_id, method)
|
|
77
78
|
request_protocol = RoborockMessageProtocol.RPC_REQUEST
|
|
78
79
|
roborock_message = RoborockMessage(timestamp=timestamp, protocol=request_protocol, payload=payload)
|
|
79
80
|
return await self.send_message(roborock_message)
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_roborock-2.8.4 → python_roborock-2.8.5}/roborock/version_a01_apis/roborock_client_a01.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|