Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions roborock/devices/traits/v1/rooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ async def refresh(self) -> None:
rooms = rooms.with_room_names(self._room_name_map)
common.merge_trait_values(self, rooms)

async def clean_segments(self, segment_ids: list[int]) -> None:
"""Start cleaning the given segments (rooms) of the current map.

Segment ids are the `segment_id` values in `rooms`.
"""
await self.rpc_channel.send_command(RoborockCommand.APP_SEGMENT_CLEAN, params=[{"segments": segment_ids}])

async def _refresh_rooms(self) -> list[HomeDataRoom]:
"""Fetch the latest rooms from the web API."""
try:
Expand Down
9 changes: 9 additions & 0 deletions tests/devices/traits/v1/test_rooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,12 @@ async def test_refresh_shared_room_names_use_shared_device_rooms(
]
web_api_client.get_shared_device_rooms.assert_called_once_with(rooms_trait._device_uid)
web_api_client.get_rooms.assert_not_called()


async def test_clean_segments(rooms_trait: RoomsTrait, mock_rpc_channel: AsyncMock) -> None:
"""Test starting a segment clean."""
await rooms_trait.clean_segments([17, 19])

mock_rpc_channel.send_command.assert_called_once_with(
RoborockCommand.APP_SEGMENT_CLEAN, params=[{"segments": [17, 19]}]
)
Loading