python-roborock 2.9.4__tar.gz → 2.9.6__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.9.4 → python_roborock-2.9.6}/PKG-INFO +1 -1
- {python_roborock-2.9.4 → python_roborock-2.9.6}/pyproject.toml +1 -1
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/api.py +6 -11
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/cloud_api.py +6 -6
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/local_api.py +6 -6
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/version_1_apis/roborock_client_v1.py +0 -4
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/version_1_apis/roborock_local_client_v1.py +2 -1
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/version_1_apis/roborock_mqtt_client_v1.py +2 -1
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/version_a01_apis/roborock_client_a01.py +2 -2
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/version_a01_apis/roborock_mqtt_client_a01.py +3 -2
- {python_roborock-2.9.4 → python_roborock-2.9.6}/LICENSE +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/README.md +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/__init__.py +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/cli.py +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/code_mappings.py +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/command_cache.py +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/const.py +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/containers.py +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/exceptions.py +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/protocol.py +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/py.typed +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/roborock_future.py +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/roborock_message.py +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/roborock_typing.py +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/util.py +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/version_1_apis/__init__.py +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/version_a01_apis/__init__.py +0 -0
- {python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/web_api.py +0 -0
|
@@ -31,8 +31,9 @@ class RoborockClient(ABC):
|
|
|
31
31
|
"""Roborock client base class."""
|
|
32
32
|
|
|
33
33
|
_logger: logging.LoggerAdapter
|
|
34
|
+
queue_timeout: int
|
|
34
35
|
|
|
35
|
-
def __init__(self, device_info: DeviceData
|
|
36
|
+
def __init__(self, device_info: DeviceData) -> None:
|
|
36
37
|
"""Initialize RoborockClient."""
|
|
37
38
|
self.event_loop = get_running_loop_or_create_one()
|
|
38
39
|
self.device_info = device_info
|
|
@@ -45,13 +46,6 @@ class RoborockClient(ABC):
|
|
|
45
46
|
"misc_info": {"Nonce": base64.b64encode(self._nonce).decode("utf-8")}
|
|
46
47
|
}
|
|
47
48
|
self.is_available: bool = True
|
|
48
|
-
self.queue_timeout = queue_timeout
|
|
49
|
-
|
|
50
|
-
def __del__(self) -> None:
|
|
51
|
-
self.release()
|
|
52
|
-
|
|
53
|
-
def release(self) -> None:
|
|
54
|
-
self.sync_disconnect()
|
|
55
49
|
|
|
56
50
|
async def async_release(self) -> None:
|
|
57
51
|
await self.async_disconnect()
|
|
@@ -65,12 +59,12 @@ class RoborockClient(ABC):
|
|
|
65
59
|
"""Connect to the Roborock device."""
|
|
66
60
|
|
|
67
61
|
@abstractmethod
|
|
68
|
-
def
|
|
62
|
+
async def async_disconnect(self) -> Any:
|
|
69
63
|
"""Disconnect from the Roborock device."""
|
|
70
64
|
|
|
71
65
|
@abstractmethod
|
|
72
|
-
|
|
73
|
-
"""
|
|
66
|
+
def is_connected(self) -> bool:
|
|
67
|
+
"""Return True if the client is connected to the device."""
|
|
74
68
|
|
|
75
69
|
@abstractmethod
|
|
76
70
|
def on_message_received(self, messages: list[RoborockMessage]) -> None:
|
|
@@ -91,6 +85,7 @@ class RoborockClient(ABC):
|
|
|
91
85
|
|
|
92
86
|
async def validate_connection(self) -> None:
|
|
93
87
|
if not self.should_keepalive():
|
|
88
|
+
self._logger.info("Resetting Roborock connection due to kepalive timeout")
|
|
94
89
|
await self.async_disconnect()
|
|
95
90
|
await self.async_connect()
|
|
96
91
|
|
|
@@ -46,12 +46,12 @@ class _Mqtt(mqtt.Client):
|
|
|
46
46
|
class RoborockMqttClient(RoborockClient, ABC):
|
|
47
47
|
"""Roborock MQTT client base class."""
|
|
48
48
|
|
|
49
|
-
def __init__(self, user_data: UserData, device_info: DeviceData
|
|
49
|
+
def __init__(self, user_data: UserData, device_info: DeviceData) -> None:
|
|
50
50
|
"""Initialize the Roborock MQTT client."""
|
|
51
51
|
rriot = user_data.rriot
|
|
52
52
|
if rriot is None:
|
|
53
53
|
raise RoborockException("Got no rriot data from user_data")
|
|
54
|
-
RoborockClient.__init__(self, device_info
|
|
54
|
+
RoborockClient.__init__(self, device_info)
|
|
55
55
|
self._mqtt_user = rriot.u
|
|
56
56
|
self._hashed_user = md5hex(self._mqtt_user + ":" + rriot.k)[2:10]
|
|
57
57
|
url = urlparse(rriot.r.m)
|
|
@@ -121,7 +121,7 @@ class RoborockMqttClient(RoborockClient, ABC):
|
|
|
121
121
|
"""Check if the mqtt client is connected."""
|
|
122
122
|
return self._mqtt_client.is_connected()
|
|
123
123
|
|
|
124
|
-
def
|
|
124
|
+
def _sync_disconnect(self) -> Any:
|
|
125
125
|
if not self.is_connected():
|
|
126
126
|
return None
|
|
127
127
|
|
|
@@ -139,7 +139,7 @@ class RoborockMqttClient(RoborockClient, ABC):
|
|
|
139
139
|
|
|
140
140
|
return disconnected_future
|
|
141
141
|
|
|
142
|
-
def
|
|
142
|
+
def _sync_connect(self) -> Any:
|
|
143
143
|
if self.is_connected():
|
|
144
144
|
self._mqtt_client.maybe_restart_loop()
|
|
145
145
|
return None
|
|
@@ -155,14 +155,14 @@ class RoborockMqttClient(RoborockClient, ABC):
|
|
|
155
155
|
|
|
156
156
|
async def async_disconnect(self) -> None:
|
|
157
157
|
async with self._mutex:
|
|
158
|
-
if disconnected_future := self.
|
|
158
|
+
if disconnected_future := self._sync_disconnect():
|
|
159
159
|
# There are no errors set on this future
|
|
160
160
|
await disconnected_future
|
|
161
161
|
await self.event_loop.run_in_executor(None, self._mqtt_client.loop_stop)
|
|
162
162
|
|
|
163
163
|
async def async_connect(self) -> None:
|
|
164
164
|
async with self._mutex:
|
|
165
|
-
if connected_future := self.
|
|
165
|
+
if connected_future := self._sync_connect():
|
|
166
166
|
try:
|
|
167
167
|
await connected_future
|
|
168
168
|
except VacuumError as err:
|
|
@@ -37,7 +37,7 @@ class _LocalProtocol(asyncio.Protocol):
|
|
|
37
37
|
class RoborockLocalClient(RoborockClient, ABC):
|
|
38
38
|
"""Roborock local client base class."""
|
|
39
39
|
|
|
40
|
-
def __init__(self, device_data: DeviceData
|
|
40
|
+
def __init__(self, device_data: DeviceData):
|
|
41
41
|
"""Initialize the Roborock local client."""
|
|
42
42
|
if device_data.host is None:
|
|
43
43
|
raise RoborockException("Host is required")
|
|
@@ -48,7 +48,7 @@ class RoborockLocalClient(RoborockClient, ABC):
|
|
|
48
48
|
self.transport: Transport | None = None
|
|
49
49
|
self._mutex = Lock()
|
|
50
50
|
self.keep_alive_task: TimerHandle | None = None
|
|
51
|
-
RoborockClient.__init__(self, device_data
|
|
51
|
+
RoborockClient.__init__(self, device_data)
|
|
52
52
|
self._local_protocol = _LocalProtocol(self._data_received, self._connection_lost)
|
|
53
53
|
|
|
54
54
|
def _data_received(self, message):
|
|
@@ -61,7 +61,7 @@ class RoborockLocalClient(RoborockClient, ABC):
|
|
|
61
61
|
|
|
62
62
|
def _connection_lost(self, exc: Exception | None):
|
|
63
63
|
"""Called when the transport connection is lost."""
|
|
64
|
-
self.
|
|
64
|
+
self._sync_disconnect()
|
|
65
65
|
self.on_connection_lost(exc)
|
|
66
66
|
|
|
67
67
|
def is_connected(self):
|
|
@@ -79,7 +79,7 @@ class RoborockLocalClient(RoborockClient, ABC):
|
|
|
79
79
|
async with self._mutex:
|
|
80
80
|
try:
|
|
81
81
|
if not self.is_connected():
|
|
82
|
-
self.
|
|
82
|
+
self._sync_disconnect()
|
|
83
83
|
async with async_timeout.timeout(self.queue_timeout):
|
|
84
84
|
self._logger.debug(f"Connecting to {self.host}")
|
|
85
85
|
self.transport, _ = await self.event_loop.create_connection( # type: ignore
|
|
@@ -93,7 +93,7 @@ class RoborockLocalClient(RoborockClient, ABC):
|
|
|
93
93
|
await self.hello()
|
|
94
94
|
await self.keep_alive_func()
|
|
95
95
|
|
|
96
|
-
def
|
|
96
|
+
def _sync_disconnect(self) -> None:
|
|
97
97
|
if self.transport and self.event_loop.is_running():
|
|
98
98
|
self._logger.debug(f"Disconnecting from {self.host}")
|
|
99
99
|
self.transport.close()
|
|
@@ -102,7 +102,7 @@ class RoborockLocalClient(RoborockClient, ABC):
|
|
|
102
102
|
|
|
103
103
|
async def async_disconnect(self) -> None:
|
|
104
104
|
async with self._mutex:
|
|
105
|
-
self.
|
|
105
|
+
self._sync_disconnect()
|
|
106
106
|
|
|
107
107
|
async def hello(self):
|
|
108
108
|
request_id = 1
|
{python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/version_1_apis/roborock_client_v1.py
RENAMED
|
@@ -164,10 +164,6 @@ class RoborockClientV1(RoborockClient, ABC):
|
|
|
164
164
|
self.listener_model = self._listeners[device_info.device.duid]
|
|
165
165
|
self._endpoint = endpoint
|
|
166
166
|
|
|
167
|
-
def release(self):
|
|
168
|
-
super().release()
|
|
169
|
-
[item.stop() for item in self.cache.values()]
|
|
170
|
-
|
|
171
167
|
async def async_release(self) -> None:
|
|
172
168
|
await super().async_release()
|
|
173
169
|
[item.stop() for item in self.cache.values()]
|
{python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/version_1_apis/roborock_local_client_v1.py
RENAMED
|
@@ -17,8 +17,9 @@ class RoborockLocalClientV1(RoborockLocalClient, RoborockClientV1):
|
|
|
17
17
|
|
|
18
18
|
def __init__(self, device_data: DeviceData, queue_timeout: int = 4):
|
|
19
19
|
"""Initialize the Roborock local client."""
|
|
20
|
-
RoborockLocalClient.__init__(self, device_data
|
|
20
|
+
RoborockLocalClient.__init__(self, device_data)
|
|
21
21
|
RoborockClientV1.__init__(self, device_data, "abc")
|
|
22
|
+
self.queue_timeout = queue_timeout
|
|
22
23
|
self._logger = RoborockLoggerAdapter(device_data.device.name, _LOGGER)
|
|
23
24
|
|
|
24
25
|
def build_roborock_message(
|
{python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/version_1_apis/roborock_mqtt_client_v1.py
RENAMED
|
@@ -32,8 +32,9 @@ class RoborockMqttClientV1(RoborockMqttClient, RoborockClientV1):
|
|
|
32
32
|
raise RoborockException("Got no rriot data from user_data")
|
|
33
33
|
endpoint = base64.b64encode(Utils.md5(rriot.k.encode())[8:14]).decode()
|
|
34
34
|
|
|
35
|
-
RoborockMqttClient.__init__(self, user_data, device_info
|
|
35
|
+
RoborockMqttClient.__init__(self, user_data, device_info)
|
|
36
36
|
RoborockClientV1.__init__(self, device_info, endpoint)
|
|
37
|
+
self.queue_timeout = queue_timeout
|
|
37
38
|
self._logger = RoborockLoggerAdapter(device_info.device.name, _LOGGER)
|
|
38
39
|
|
|
39
40
|
async def send_message(self, roborock_message: RoborockMessage):
|
{python_roborock-2.9.4 → python_roborock-2.9.6}/roborock/version_a01_apis/roborock_client_a01.py
RENAMED
|
@@ -108,9 +108,9 @@ zeo_data_protocol_entries = {
|
|
|
108
108
|
class RoborockClientA01(RoborockClient, ABC):
|
|
109
109
|
"""Roborock client base class for A01 devices."""
|
|
110
110
|
|
|
111
|
-
def __init__(self, device_info: DeviceData, category: RoborockCategory
|
|
111
|
+
def __init__(self, device_info: DeviceData, category: RoborockCategory):
|
|
112
112
|
"""Initialize the Roborock client."""
|
|
113
|
-
super().__init__(device_info
|
|
113
|
+
super().__init__(device_info)
|
|
114
114
|
self.category = category
|
|
115
115
|
|
|
116
116
|
def on_message_received(self, messages: list[RoborockMessage]) -> None:
|
|
@@ -34,8 +34,9 @@ class RoborockMqttClientA01(RoborockMqttClient, RoborockClientA01):
|
|
|
34
34
|
if rriot is None:
|
|
35
35
|
raise RoborockException("Got no rriot data from user_data")
|
|
36
36
|
|
|
37
|
-
RoborockMqttClient.__init__(self, user_data, device_info
|
|
38
|
-
RoborockClientA01.__init__(self, device_info, category
|
|
37
|
+
RoborockMqttClient.__init__(self, user_data, device_info)
|
|
38
|
+
RoborockClientA01.__init__(self, device_info, category)
|
|
39
|
+
self.queue_timeout = queue_timeout
|
|
39
40
|
self._logger = RoborockLoggerAdapter(device_info.device.name, _LOGGER)
|
|
40
41
|
|
|
41
42
|
async def send_message(self, roborock_message: RoborockMessage):
|
|
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
|