Skip to content

Commit 361d429

Browse files
committed
fix: bug where the map requested from the app confuses our system
1 parent 97f8ee3 commit 361d429

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

roborock/protocols/v1_protocol.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,18 @@ class MapResponse:
157157
"""The map data, decrypted and decompressed."""
158158

159159

160-
def create_map_response_decoder(security_data: SecurityData) -> Callable[[RoborockMessage], MapResponse]:
160+
def create_map_response_decoder(security_data: SecurityData) -> Callable[[RoborockMessage], MapResponse | None]:
161161
"""Create a decoder for V1 map response messages."""
162162

163-
def _decode_map_response(message: RoborockMessage) -> MapResponse:
163+
def _decode_map_response(message: RoborockMessage) -> MapResponse | None:
164164
"""Decode a V1 map response message."""
165165
if not message.payload or len(message.payload) < 24:
166166
raise RoborockException("Invalid V1 map response format: missing payload")
167167
header, body = message.payload[:24], message.payload[24:]
168168
[endpoint, _, request_id, _] = struct.unpack("<8s8sH6s", header)
169169
if not endpoint.decode().startswith(security_data.endpoint):
170-
raise RoborockException(
171-
f"Invalid V1 map response endpoint: {endpoint!r}, expected {security_data.endpoint!r}"
172-
)
170+
_LOGGER.debug("Received map response requested not made by this device, ignoring.")
171+
return None
173172
try:
174173
decrypted = Utils.decrypt_cbc(body, security_data.nonce)
175174
except ValueError as err:

0 commit comments

Comments
 (0)