Skip to content

feat(v1): add clean_segments helper to RoomsTrait - #1081

Merged
allenporter merged 3 commits into
Python-roborock:mainfrom
hCoureau:submit/feat/clean-segments-helper
Nov 23, 2026
Merged

allenporter merged 3 commits into
Python-roborock:mainfrom
hCoureau:submit/feat/clean-segments-helper

Conversation

@hCoureau

@hCoureau hCoureau commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Callers such as Home Assistant have to build the app_segment_clean payload to start a room clean on a V1 vacuum. Q7 and Q10 already expose clean_segments(segment_ids).

Changes

Add RoomsTrait.clean_segments(segment_ids) for V1. It takes the segment IDs reported by that trait and sends the V1 segment-clean command for the current map. The robot determines the cleaning order and uses its default repeat behavior.

Testing

  • A test calls the public V1 rooms trait and checks the emitted RPC and payload. This revision was validated with simulated RPCs.
  • 2,681 tests passed on each of Python 3.11 and 3.14 against upstream 321c6d5. The default suite excludes the 11 real-broker tests.
  • Pre-commit, commitlint, and source and wheel builds passed.

Starting a V1 room clean meant building the app_segment_clean payload by
hand, while Q7 and Q10 already expose clean_segments(segment_ids).
CommandTrait.clean_segments(segment_ids) sends [{"segments": segment_ids}]
and does not set a repeat count.
Comment thread roborock/devices/traits/v1/command.py Outdated
"""
self._rpc_channel = None

async def clean_segments(self, segment_ids: list[int]) -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This "CommadTrait" has a single low level command send. It's meant to not have any other app logic. Can clean_segments move to another trait?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved it to RoomsTrait (195448b), alongside the segment ids it takes. CommandTrait is back to just send.

CommandTrait is meant to only expose the low-level send command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hCoureau hCoureau changed the title feat(v1): add clean_segments helper to CommandTrait feat(v1): add clean_segments helper to RoomsTrait Nov 23, 2026
@hCoureau

Copy link
Copy Markdown
Contributor Author

@allenporter moved clean_segments to RoomsTrait per your feedback, could you take another look when you have a moment? Thanks!

@allenporter
allenporter merged commit 390afc8 into Python-roborock:main Nov 23, 2026
9 checks passed
@allenporter

Copy link
Copy Markdown
Contributor

Thanks @hCoureau 👍

@hCoureau
hCoureau deleted the submit/feat/clean-segments-helper branch November 23, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants