|
5 | 5 | import secrets |
6 | 6 | import threading |
7 | 7 | from asyncio import Lock |
8 | | -from typing import Any, Callable |
| 8 | +from typing import Any |
9 | 9 | from urllib.parse import urlparse |
10 | 10 |
|
11 | 11 | import paho.mqtt.client as mqtt |
|
22 | 22 | ) |
23 | 23 | from .roborock_queue import RoborockQueue |
24 | 24 | from .typing import ( |
25 | | - RoborockCommand, RoborockDeviceProp, |
| 25 | + RoborockCommand, RoborockDeviceProp, RoborockDeviceInfo, |
26 | 26 | ) |
27 | 27 | from .util import run_in_executor |
28 | 28 |
|
|
34 | 34 | class RoborockMqttClient(RoborockClient, mqtt.Client): |
35 | 35 | _thread: threading.Thread |
36 | 36 |
|
37 | | - def __init__(self, user_data: UserData, device_localkey: dict[str, str]) -> None: |
| 37 | + def __init__(self, user_data: UserData, devices_info: dict[str, RoborockDeviceInfo]) -> None: |
38 | 38 | rriot = user_data.rriot |
39 | 39 | endpoint = base64.b64encode(md5bin(rriot.endpoint)[8:14]).decode() |
40 | | - RoborockClient.__init__(self, endpoint, device_localkey) |
| 40 | + RoborockClient.__init__(self, endpoint, devices_info) |
41 | 41 | mqtt.Client.__init__(self, protocol=mqtt.MQTTv5) |
42 | 42 | self._mqtt_user = rriot.user |
43 | 43 | self._hashed_user = md5hex(self._mqtt_user + ":" + rriot.endpoint)[2:10] |
@@ -192,7 +192,7 @@ async def send_command( |
192 | 192 | _LOGGER.debug(f"id={request_id} Requesting method {method} with {params}") |
193 | 193 | request_protocol = 101 |
194 | 194 | response_protocol = 301 if method in SPECIAL_COMMANDS else 102 |
195 | | - msg = super()._encode_msg(device_id, request_protocol, timestamp, payload) |
| 195 | + msg = super()._encode_msg(device_id, request_id, request_protocol, timestamp, payload) |
196 | 196 | self._send_msg_raw(device_id, msg) |
197 | 197 | (response, err) = await self._async_response(request_id, response_protocol) |
198 | 198 | if err: |
|
0 commit comments