Skip to content

Commit

Permalink
fix: set roommapping when it is only one room (#203)
Browse files Browse the repository at this point in the history
* fix: set roommapping when it is only one room

* fix: add len check
  • Loading branch information
Lash-L authored May 8, 2024
1 parent 412189b commit 26af66b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions roborock/version_1_apis/roborock_client_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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) 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
for segment_id, iot_id in [unpack_list(room, 2) for room in mapping if isinstance(room, list)]
Expand Down

0 comments on commit 26af66b

Please sign in to comment.