Skip to content

Commit 26af66b

Browse files
authored
fix: set roommapping when it is only one room (#203)
* fix: set roommapping when it is only one room * fix: add len check
1 parent 412189b commit 26af66b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

roborock/version_1_apis/roborock_client_v1.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,8 @@ async def get_room_mapping(self) -> list[RoomMapping] | None:
277277
"""Gets the mapping from segment id -> iot id. Only works on local api."""
278278
mapping: list = await self.send_command(RoborockCommand.GET_ROOM_MAPPING)
279279
if isinstance(mapping, list):
280+
if not isinstance(mapping[0], list) and len(mapping) == 2:
281+
return [RoomMapping(segment_id=mapping[0], iot_id=mapping[1])]
280282
return [
281283
RoomMapping(segment_id=segment_id, iot_id=iot_id) # type: ignore
282284
for segment_id, iot_id in [unpack_list(room, 2) for room in mapping if isinstance(room, list)]

0 commit comments

Comments
 (0)