Skip to content

feat: add Q7 carpet settings and map names - #1040

Open
ramon-angosto wants to merge 3 commits into
Python-roborock:mainfrom
ramon-angosto:q7/3-carpet-map-names
Open

ramon-angosto wants to merge 3 commits into
Python-roborock:mainfrom
ramon-angosto:q7/3-carpet-map-names

Conversation

@ramon-angosto

Copy link
Copy Markdown
Contributor

Depends on #1039. Only the last commit belongs to this PR.

Summary

  • Q7PropertiesApi.set_carpet_turbo(enabled) and set_carpet_avoid(enabled). They are written individually with prop.set {"carpet_turbo": 0|1} / {"carpet_avoid": 0|1} and read back nested under privacy. The new RoborockB01Props.CARPET_TURBO / CARPET_AVOID members are used.
  • Q7MapListEntry.name keeps the user-visible map name returned by service.get_map_list (for example "Temporary map" for an unsaved map). The name was previously dropped.

Testing

  • Unit tests for both settings and for map list parsing with names.
  • Verified on a Q7 TF+ (roborock.vacuum.sc05, firmware 03.01.80).

@Lash-L Lash-L added Feature New feature Q7 B01 Q7 platform labels Nov 15, 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 Argon in Antigravity using our /review (/code-review) skill (.agents/skills/code-review/SKILL.md / AGENTS.md).

Summary by Architectural Priority Layer

  • PR Scoping & Stack Note
    • This PR (q7/3-carpet-map-names) targets main while stacked on top of #1038 (67ce5a18) and #1039 (6bbd0cc5); this review focuses specifically on commit 63c929051d67efd83698a91558af23f3309998a8 (feat: add Q7 carpet settings and map names). Rebasing onto main once #1038 and #1039 land (or retargeting the base branch in the interim) will isolate the diff.
    • Commit 63c92905 is small and self-contained (~55 lines added across 6 files). Although carpet settings (set_carpet_turbo / set_carpet_avoid) and preserving Q7MapListEntry.name are two independent Q7 additions, both are tiny additive updates and keeping them together in this commit is very easy to review.
  • Layer 1: Core Abstractions, Data Models & Public APIs (roborock/data/b01_q7/b01_q7_containers.py, roborock/devices/traits/b01/q7/__init__.py, roborock/roborock_message.py)
    • Q7MapListEntry.name: str | None = None accurately models the name field returned alongside id and cur in service.get_map_list responses.
    • Q7PropertiesApi.set_carpet_turbo and Q7PropertiesApi.set_carpet_avoid cleanly accept enabled: bool and send 0/1 via prop.set (carpet_turbo / carpet_avoid).
    • One minor B01Props container consistency note inline on RoborockB01Props.CARPET_TURBO / CARPET_AVOID: adding carpet_turbo: int | None = None and carpet_avoid: int | None = None to B01Props preserves the 1:1 field mapping with RoborockB01Props when those properties are queried directly via query_values([RoborockB01Props.CARPET_TURBO, RoborockB01Props.CARPET_AVOID]).
  • Layer 2: Control Flow, Error Handling & Concurrency
    • Async command dispatch in set_carpet_turbo and set_carpet_avoid is linear and side-effect-free.
  • Layer 3: Code Hygiene, Typing & Tests (tests/data/b01_q7/test_b01_q7_containers.py, tests/devices/traits/b01/q7/test_init.py, tests/devices/traits/b01/q7/test_map.py)
    • Unit tests cleanly use @pytest.mark.parametrize to cover both set_carpet_turbo and set_carpet_avoid across True/False states, and verify Q7MapList name deserialization.

ADD_SWEEP_STATUS = "add_sweep_status"
# Settable individually via prop.set (reported nested under ``privacy`` by prop.get).
CARPET_TURBO = "carpet_turbo"
CARPET_AVOID = "carpet_avoid"

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.

RoborockB01Props is also the parameter enum for Q7PropertiesApi.query_values(props: list[RoborockB01Props]) -> B01Props | None. While prop.get nests carpet_turbo and carpet_avoid under privacy when RoborockB01Props.PRIVACY is queried, querying carpet_turbo or carpet_avoid directly in prop.get returns top-level carpet_turbo / carpet_avoid integer fields in the response payload.

Consider also adding carpet_turbo: int | None = None and carpet_avoid: int | None = None to B01Props in roborock/data/b01_q7/b01_q7_containers.py (matching all other RoborockB01Props members, such as quiet_is_open / quiet_begin_time / quiet_end_time) so query_values([RoborockB01Props.CARPET_TURBO, RoborockB01Props.CARPET_AVOID]) does not silently drop those fields during B01Props.from_dict().

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.

Good catch, done in 318dc35: B01Props now has carpet_turbo and carpet_avoid, with a test that query_values([CARPET_TURBO, CARPET_AVOID]) keeps them.

@Lash-L Lash-L added the /review run Code review skill (/review) has been run label Nov 15, 2026
@Lash-L
Lash-L marked this pull request as draft November 15, 2026 19:57
Add `clean_zone` and `clean_zones` to the Q7 properties API. Zones are given
as two opposite corners in the common Roborock millimetre coordinate space
through a new `Q7RoborockPoint`, which converts to and from the Q7 world
coordinates (meters, origin next to the dock).

The device expects the zone preference type to be selected first
(`service.set_preference_type`), then the zone corners as a flat list
(`service.set_zone_points`), and finally `service.set_zone_clean` to start.
Several zones are concatenated into a single task.
Add a `RemoteTrait` to the Q7 properties API, mirroring the Q10 remote API.
Manual mode is entered with `prop.set sweep_type=5` and the robot is driven
with `service.set_direction` (1 forward, 2 left, 3 right, 0 exit). Each
command moves the robot for a short burst, so callers repeat it while a
direction is held. Leaving remote mode restores `sweep_type=0`.
Add `set_carpet_turbo` and `set_carpet_avoid` to the Q7 properties API. Both
are written individually with `prop.set` (`carpet_turbo` / `carpet_avoid`)
and reported back nested under `privacy`.

Keep the user-visible `name` of each entry returned by
`service.get_map_list`, which was previously dropped.
@ramon-angosto
ramon-angosto marked this pull request as ready for review November 16, 2026 08:07

@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).

Scope & Stacking

  • Stacked on #1038–#1039; this follow-up review covers PR #1040's own commit 318dc35 (feat: add Q7 carpet settings and map names, 6 files, +65/-1), with cross-verification against the Roborock Q7 app bundle and Q7 (roborock.vacuum.sc05) firmware.
  • Prior review feedback addressed: Commit 318dc35 resolves the Nov 15 review comment by adding carpet_turbo: int | None = None and carpet_avoid: int | None = None to B01Props and adding test_q7_api_query_carpet_settings to cover direct query_values([CARPET_TURBO, CARPET_AVOID]) calls.

Summary by Architectural Layer

  • Priority 1 — Public Trait APIs & Consumer Contracts:
    • Q7MapListEntry.name: str | None = None and B01Props.carpet_turbo / carpet_avoid cleanly extend existing RoborockBase dataclasses with concrete types.
    • Q7PropertiesApi.set_carpet_turbo(enabled: bool) and set_carpet_avoid(enabled: bool) match sibling boolean setters (set_child_lock, set_dust_auto_state, set_button_lights) with clean, consumer-agnostic signatures.
  • Priority 2 — Data Lifecycle & State Management:
    • Command dispatch in set_carpet_turbo / set_carpet_avoid is linear and side-effect-free; MapTrait.refresh() preserves Q7MapListEntry.name automatically via Q7MapList.from_dict().
  • Priority 3 — Wire Protocol & Firmware Verification:
    • Carpet settings (carpet_turbo / carpet_avoid): Verified against both the Roborock Q7 app bundle (carpetTurbo / carpetAvoid via prop.set with 0/1, top-level prop.get via getCarpetTurbo / getCarpetTurboAndMultiFloor, and nested privacy.carpet_turbo / privacy.carpet_avoid in settings batches) and Q7 sc05 firmware (rriot_client prop.set, prop.get, and privacy tables plus DeviceCleanConfig uint setters).
    • Map names (service.get_map_list): Verified against the Q7 app bundle (map_list[] entries with id, cur, name) and Q7 sc05 firmware (rriot_client map_list keys name, id, cur, and the built-in "Temporary map" default string).
  • Tests & Fixtures:
    • Tests are properly colocated under mirror paths (test_b01_q7_containers.py, test_init.py, test_map.py), reuse fake_channel with @pytest.mark.parametrize, and assert public behavior.

Verdict

No issues found after adversarial self-check. The PR is clean and ready to approve once #1038–#1039 land (and CI checks run on the branch).

@Lash-L Lash-L added the Passed /review Passed the /review skill check label Nov 21, 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 Claude Opus 5.5 in Claude Code using our /review (/code-review) skill (.agents/skills/code-review/SKILL.md / AGENTS.md).

Follow-Up Review (318dc35)

Verdict: Does not pass /review. The code in this PR's own commit is fine, but the branch conflicts with main and has no CI run, so it has to be rebased first.

Scope and stack status

  • The branch has three commits on top of 109f433 (7.23.2):
    • ad3991f feat: add Q7 zone cleaning. This came from #1038, which was squash-merged as e9d8b34.
    • 19380d5 feat: add Q7 remote control trait. This came from #1039, which was squash-merged as 42976c0.
    • 318dc35 feat: add Q7 carpet settings and map names. This is the only commit that belongs to #1040 (6 files, +65/-1).
  • The two carried commits match what merged. Their added and removed lines are identical to e9d8b34 and 42976c0, so no stale or diverged code is riding along.
  • The conflict comes only from the stale stack. main now holds the squashed copies of #1038 and #1039, and later Q7 work has landed on top of them, including #1074 (dd74fa1, B01Fault aliases, touching test_b01_q7_containers.py). Running git merge-tree --write-tree origin/main 318dc35 reports content conflicts in:
    • roborock/devices/traits/b01/q7/__init__.py
    • tests/data/b01_q7/test_b01_q7_containers.py
    • tests/devices/traits/b01/q7/test_init.py
  • Replaying only 318dc35 onto current main (b46ae6f), with 19380d5 as the merge base, applies with no conflicts.

Earlier findings status

  • 2026-11-15 review: add carpet_turbo / carpet_avoid to B01Props so a direct query_values([CARPET_TURBO, CARPET_AVOID]) keeps them. Resolved in 318dc35 (b01_q7_containers.py:209-210), and test_q7_api_query_carpet_settings covers it.
  • 2026-11-21 review: no issues, ready once #1038–#1039 land and CI runs. #1038 and #1039 have landed, but the branch was never rebased afterwards, so CI has still not run. That condition is still open and is the blocking item below.

Priority 1: Public Trait APIs & Consumer Contracts

  • [Blocking] Merge conflict with main, and no CI. GitHub reports the PR as CONFLICTING and there are no checks on 318dc35. Rebase only this PR's commit onto current main and drop the two already-merged commits:

    git fetch origin
    git rebase --onto origin/main 19380d5 q7/3-carpet-map-names
    git push --force-with-lease

    This leaves a single commit that applies cleanly. Then remove "Depends on #1039. Only the last commit belongs to this PR." from the description. #1041 (Q7 robot position) is stacked on this branch, so it will need the same --onto rebase after this one moves.

  • Q7PropertiesApi.set_carpet_turbo / set_carpet_avoid (roborock/devices/traits/b01/q7/__init__.py:227-233) take enabled: bool and send int(enabled) through set_prop. This matches the sibling setters set_child_lock and set_button_lights. The API is concrete, consumer-agnostic and has no Any at the boundary.

  • Q7MapListEntry.name: str | None = None (roborock/data/b01_q7/b01_q7_containers.py:120) is additive and optional, so map-list payloads without names still parse.

Priority 2: Data Lifecycle & State Management

  • No issues. Both setters are one-shot writes with no cached state. MapTrait.refresh() picks up name through Q7MapList.from_dict() with no extra plumbing.
  • Nit (non-blocking): the two values now appear in two places, B01Props.carpet_turbo (top level, filled only by a direct prop.get of those keys) and B01Props.privacy.carpet_turbo (filled when privacy is queried). A one-line docstring on the new B01Props fields (b01_q7_containers.py:209-210) would tell consumers which one is populated when.

Priority 3: Wire Protocols, Codecs & Enums

  • The wire names are correct. In the Q7 app bundle, setCarpetTurbo, carpetTurbo and carpetAvoid send prop.set {"carpet_turbo": v} / {"carpet_avoid": v} at the top level (unlike floorDirection, which nests under privacy). getCarpetTurbo / getCarpetTurboAndMultiFloor read them with a top-level prop.get, and the settings screen reads privacy.carpet_turbo / privacy.carpet_avoid. service.get_map_list entries carry id, cur and name. This matches the earlier firmware cross-check of the sc05 map_list keys and the built-in "Temporary map" name.

  • Nit (non-blocking): the comment at roborock/roborock_message.py:332 says the props are "reported nested under privacy by prop.get". A direct prop.get of carpet_turbo / carpet_avoid returns them at the top level, as this PR's own test and the live device both show. Only a query for privacy nests them. Suggested wording:

    # Settable individually via prop.set. A direct prop.get returns them top-level;
    # they are also reported nested under ``privacy``.

Tests & Fixtures

  • The new tests are in the mirror paths: tests/data/b01_q7/test_b01_q7_containers.py, tests/devices/traits/b01/q7/test_init.py and test_map.py. They use fake_channel, and test_q7_api_set_carpet_settings stacks two @pytest.mark.parametrize decorators. The assertions check published commands and the parsed public models. No conformance allowlist changes.

Live test on a Q7 M5+

Device: Q7 M5+ (roborock.vacuum.sc05, protocol B01, firmware 03.01.80), real US cloud, at 318dc35.

  • query_values([CARPET_TURBO, CARPET_AVOID]) returned {carpet_turbo: 1, carpet_avoid: 0} at the top level.
  • set_carpet_turbo(False) followed by set_carpet_avoid(True) read back as {0, 1}. Restoring the original values read back as {1, 0}.
  • map.refresh() returned the names: Map2 (current), Map3, Map4, Temporary map (id 0) and Deans room.
  • Zone cleaning and remote control were not exercised because they move the robot. Both are already on main via #1038 and #1039 and are not part of this PR's diff.

Local results

Check PR head 318dc35 318dc35 replayed onto main b46ae6f
pytest tests 2385 passed, 53 xfailed 2867 passed, 46 xfailed, 168 snapshots passed
ruff check / ruff format --check clean clean
mypy (Q7 trait + data modules) — no issues
GitHub CI no checks (branch conflicts) —

This is an automated review and can be incorrect, so please reply if any finding looks wrong.

@Lash-L Lash-L removed the Passed /review Passed the /review skill check label Nov 25, 2026

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

Feature New feature Q7 B01 Q7 platform /review run Code review skill (/review) has been run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants