Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set roommapping when it is only one room #203

Merged
merged 2 commits into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading