Skip to content

Commit 63acd72

Browse files
committed
fix: make code dynamic
1 parent 0eeee2a commit 63acd72

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

roborock/devices/mqtt_channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def message_handler(payload: bytes) -> None:
6969
return
7070
for message in messages:
7171
_LOGGER.debug("Received message: %s", message)
72-
if message.version == b"1.0":
72+
if message.version != b"B01":
7373
asyncio.create_task(self._resolve_future_with_lock(message))
7474
try:
7575
callback(message)

roborock/protocols/b01_protocol.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
RoborockMessage,
1414
RoborockMessageProtocol,
1515
)
16+
from roborock.util import get_next_int
1617

1718
_LOGGER = logging.getLogger(__name__)
1819

@@ -23,7 +24,15 @@
2324

2425
def encode_mqtt_payload(dps: int, command: CommandType, params: ParamsType) -> RoborockMessage:
2526
"""Encode payload for B01 commands over MQTT."""
26-
dps_data = {"dps": {dps: {"method": str(command), "msgId": "1751755654575", "params": params or []}}}
27+
dps_data = {
28+
"dps": {
29+
dps: {
30+
"method": str(command),
31+
"msgId": str(get_next_int(100000000000, 999999999999)),
32+
"params": params or [],
33+
}
34+
}
35+
}
2736
payload = pad(json.dumps(dps_data).encode("utf-8"), AES.block_size)
2837
return RoborockMessage(
2938
protocol=RoborockMessageProtocol.RPC_REQUEST,

0 commit comments

Comments
 (0)