Skip to content

feat: expose Q10 current cleaning room - #939

Open
hCoureau wants to merge 33 commits into
Python-roborock:mainfrom
hCoureau:feat/q10-current-room
Open

hCoureau wants to merge 33 commits into
Python-roborock:mainfrom
hCoureau:feat/q10-current-room

Conversation

@hCoureau

@hCoureau hCoureau commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Q10 firmware does not provide a validated active-room field. This exposes map.current_room by conservatively matching the latest live robot position to the segmented map grid.

Behavior

  • Return the existing Q10Room model or None, with a defensive copy of a resolved room.
  • Use the exact segmented cell when available. A bounded nearby-cell search handles unsegmented positions; ambiguous results remain None.
  • Prefer usable header calibration, with path-fit calibration as a fallback for older or incomplete packets.
  • Require an active or paused cleaning state and a fresh live trace. Inactive/docked updates clear freshness so a prior session is not reused.
  • Preserve custom room labels and redact raw room names in diagnostics.

Session validity stays in the trait. Spatial resolution is a pure function of typed map/trace models.

Dependencies

Depends on #938 and #937. #936, #908, and #965 are merged. Upstream main through b3a98b9 (7.12.0) is integrated.

Allen’s follow-up feedback on merged #936 is addressed by separate clean-record and saved-map decoder tests, with no conditional assertions.

Validation and limits

Validation of 33b5af5:

  • uv run pytest -q on Python 3.13: 1,497 passed, 53 xfailed, 92 snapshots passed.
  • All pre-commit hooks passed, including Ruff, mypy, codespell, and structured-file checks.
  • uv build passed for both wheel and sdist.
  • The affected cumulative protocol suite passed on Python 3.11 and 3.14: 96 passed, 10 snapshots passed on each version. The full cumulative suite passed on both versions before this test-only follow-up and merge.

No physical-device run was performed for this revision.

Existing tests cover room resolution, ambiguity, calibration, session freshness, custom labels, and diagnostic redaction. Earlier physical Q10 S5/S5+ testing observed a custom room label during a single-room clean and clearing during return/docking. A room-to-room transition was not covered by that reported run.

This is inferred room occupancy during cleaning, not an authoritative firmware report of the selected cleaning segment. Missing or unusable map/trace data returns None. Archive requests inherit the bounded lifecycle from #937, including its clean-history ambiguity barrier and same-map freshness limitation.

No private map captures, room labels, or account data are included. Related: #767.

@hCoureau hCoureau mentioned this pull request Aug 31, 2026
8 of 23 tasks
@lboue

lboue commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Tested against a real device: Roborock Q10 S5+ (ss07 firmware family), on commit cd2621d (this PR's isolated commit, rebased onto its stacked dependencies).

Watched device.b01_q10_properties.map.current_room live via add_update_listener while running a targeted clean:

{"time": "13:16:10", "state": null,            "room_id": null, "room_name": null,        "position": null}
{"time": "13:16:11", "state": "SWEEP_AND_MOP",  "room_id": null, "room_name": null,        "position": {"x": -976, "y": -888}}
{"time": "13:16:11", "state": "SWEEP_AND_MOP",  "room_id": 3,    "room_name": "Salle d’eau","position": {"x": -976, "y": -888}}
...
{"time": "13:18:26", "state": "RETURNING_HOME", "room_id": null, "room_name": null,        "position": {"x": -412, "y": -508}}
{"time": "13:20:03", "state": "EMPTYING_THE_BIN","room_id": null,"room_name": null,        "position": null}

Observations:

  • current_room correctly reflects a custom room label (Salle d’eau, French for "bathroom") rather than a raw firmware rr_... default - matches the "preserve custom room labels" goal.
  • It's briefly None right after the position/state first arrive (before the first segmented-grid match resolves), then locks onto the right room.
  • It correctly clears back to None as soon as the state moves to RETURNING_HOME / EMPTYING_THE_BIN, confirming stale session state doesn't leak into docking/post-clean states.

This was a single-room spot clean, so I didn't get to observe a room-to-room transition in this pass.

This branch has not been deployed

No deployments
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