Skip to content

feat: add GET_CLEAN_DETAIL and GET_RT_CLEAN_DETAIL commands - #1063

Merged
Lash-L merged 2 commits into
Python-roborock:mainfrom
cptntrps:feat/clean-detail-commands
Nov 22, 2026
Merged

Lash-L merged 2 commits into
Python-roborock:mainfrom
cptntrps:feat/clean-detail-commands

Conversation

@cptntrps

Copy link
Copy Markdown
Contributor

Summary

Adds two V1 commands for the clean timeline:

  • GET_RT_CLEAN_DETAIL (get_rt_clean_detail), params {"type": 0, "from": <offset>}: the event timeline of the current run, or of the last run when the robot is idle.
  • GET_CLEAN_DETAIL (get_clean_detail), params {"begin": <run begin>, "type": 0, "id": 0, "from": <offset>}: the same for a past run. The begin values are the ones in get_clean_summary records. Without type and id the robot answers -10005 param error!.

The response is {"begin", "from", "num", "more", "events": [{"t", "i", "e"}]}, where e is a JSON string. Use from and more to read the next page.

Event ids seen on a Saros 10R (a144)

I checked these against runs where I logged what the robot did:

i e Meaning
41 {"2": <segment>} room started
43 {"2": <segment>} room finished
63 {"2": <segment>} room left early (app_skip_current_cleaning_area, or the robot found the room done)
12 {"121": <code>} task ended: 14 finished, 123 stopped by app_charge
11 {"111": <from>, "112": <to>, "1": <battery>} state change

Example: during a two-room clean, 63 for the first room appeared at the same second the skip was sent, followed by 43 for that room and 41 for the next. During a live run, the last 41 without a following 43 gives the room in progress.

This PR adds only the commands. A typed trait could come later, once more models confirm the event ids.

Checks

  • uv run pytest: 2363 passed
  • ruff check, ruff format --check: clean
  • mypy on the changed files: clean

get_rt_clean_detail returns the event timeline of the current or last run;
get_clean_detail returns it for a past run, selected by its begin time.
@Lash-L Lash-L added Small PR Small pull request (<200 lines) Data model changes Changes to data models, device info, or feature mappings Feature New feature V1 V1 platform labels Nov 18, 2026

@Lash-L Lash-L left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Automated code review by Gemini 4 Neon in Antigravity using our /review (/code-review) skill (.agents/skills/code-review/SKILL.md / AGENTS.md).

Summary by Architectural Layer

  • PR Scope & Hygiene: Clean, focused PR (+28 lines across 2 files) adding only the two V1 command enum entries and a parametrized test, with a Conventional Commits title/commit (feat:) and no conformance allowlist changes.
  • Priority 1 — Public Trait APIs & Consumer Contracts: No new traits or domain models added. Reuses the existing CommandTrait.send() contract (RoborockCommand | str, ParamsType); deferring a typed trait until event schemas are confirmed across additional models is well-scoped.
  • Priority 2 — Data Lifecycle & State Management: No state, lifecycle, concurrency, or caching changes.
  • Priority 3 — Wire Protocols, Codecs & Resilient Enums: Adds GET_CLEAN_DETAIL = "get_clean_detail" and GET_RT_CLEAN_DETAIL = "get_rt_clean_detail" to RoborockCommand (roborock/roborock_typing.py). As an outgoing V1 RPC command identifier enum (not a wire status/error decoder), RoborockCommand(str, Enum) is appropriate.
  • Tests & Fixtures: Adds test_send_clean_detail in the mirrored suite tests/devices/traits/v1/test_command.py, using @pytest.mark.parametrize and the existing command_trait fixture consistent with peer tests in the module.

Protocol Verification (RR_API)

Cross-verified against the Roborock app bundles (hermes/com.roborock.tanos, nonhermes/com.roborock.tanos, and model bundles including Saros 10R, Saros 20, Qrevo Edge 2/3 Pro, Qrevo 2 Pro, Qrevo S Pro):

  • RPC method strings: Exact match — getCleanTimerLineDetail invokes get_clean_detail and getRTCleanTimerLineDetail invokes get_rt_clean_detail (module_441.js).
  • Parameters & response: Confirmed in CleanTimelineView (module_2496.js) and History Summary (module_3617.js): {"type": 0, "from": <offset>} for get_rt_clean_detail, {"begin": <startTime>, "type": 0, "id": 0, "from": <offset>} for get_clean_detail, and response fields more, events (t, i, e), from, and num.

Verdict

No findings survived review and adversarial self-check. This PR is clean and ready to approve.

@Lash-L Lash-L added /review run Code review skill (/review) has been run Passed /review Passed the /review skill check labels Nov 21, 2026
Comment thread tests/devices/traits/v1/test_command.py Outdated
(RoborockCommand.GET_CLEAN_DETAIL, {"begin": 1794867592, "type": 0, "id": 0, "from": 0}),
],
)
async def test_send_clean_detail(command_trait: CommandTrait, command: RoborockCommand, params: dict) -> None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We can skip this test imo

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I went ahead and removed it myself, will merge now. TY!

@Lash-L
Lash-L merged commit 8f857ce into Python-roborock:main Nov 22, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Data model changes Changes to data models, device info, or feature mappings Feature New feature Passed /review Passed the /review skill check /review run Code review skill (/review) has been run Small PR Small pull request (<200 lines) V1 V1 platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants