From 1e96cb1be35f4cb7a11d3b16d02f68937c72a32c Mon Sep 17 00:00:00 2001 From: Luke Date: Wed, 8 May 2024 09:03:58 -0400 Subject: [PATCH 1/2] fix: set roommapping when it is only one room --- roborock/version_1_apis/roborock_client_v1.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roborock/version_1_apis/roborock_client_v1.py b/roborock/version_1_apis/roborock_client_v1.py index 14f8861..0ae0666 100644 --- a/roborock/version_1_apis/roborock_client_v1.py +++ b/roborock/version_1_apis/roborock_client_v1.py @@ -277,6 +277,8 @@ async def get_room_mapping(self) -> list[RoomMapping] | None: """Gets the mapping from segment id -> iot id. Only works on local api.""" mapping: list = await self.send_command(RoborockCommand.GET_ROOM_MAPPING) if isinstance(mapping, list): + if not isinstance(mapping[0], list): + return [RoomMapping(segment_id=mapping[0], iot_id=mapping[1])] return [ RoomMapping(segment_id=segment_id, iot_id=iot_id) # type: ignore for segment_id, iot_id in [unpack_list(room, 2) for room in mapping if isinstance(room, list)] From 596bea7850e3baba360552599f1bacf2d679fc01 Mon Sep 17 00:00:00 2001 From: Luke Date: Wed, 8 May 2024 09:14:20 -0400 Subject: [PATCH 2/2] fix: add len check --- roborock/version_1_apis/roborock_client_v1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roborock/version_1_apis/roborock_client_v1.py b/roborock/version_1_apis/roborock_client_v1.py index 0ae0666..1910f6c 100644 --- a/roborock/version_1_apis/roborock_client_v1.py +++ b/roborock/version_1_apis/roborock_client_v1.py @@ -277,7 +277,7 @@ async def get_room_mapping(self) -> list[RoomMapping] | None: """Gets the mapping from segment id -> iot id. Only works on local api.""" mapping: list = await self.send_command(RoborockCommand.GET_ROOM_MAPPING) if isinstance(mapping, list): - if not isinstance(mapping[0], list): + if not isinstance(mapping[0], list) and len(mapping) == 2: return [RoomMapping(segment_id=mapping[0], iot_id=mapping[1])] return [ RoomMapping(segment_id=segment_id, iot_id=iot_id) # type: ignore