Skip to content

feat: add Q7 remote control trait - #1039

Merged
allenporter merged 2 commits into
Python-roborock:mainfrom
ramon-angosto:q7/2-remote-control
Nov 23, 2026
Merged

allenporter merged 2 commits into
Python-roborock:mainfrom
ramon-angosto:q7/2-remote-control

Conversation

@ramon-angosto

Copy link
Copy Markdown
Contributor

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

Summary

Adds Q7PropertiesApi.remote (RemoteTrait), mirroring the Q10 remote API:

  • stop() enters manual mode and holds the robot in place.
  • forward(), left(), right() move the robot.
  • exit_remote() leaves manual mode.

New Q7RemoteDirection enum for the direction codes.

Device protocol

  • prop.set {"sweep_type": 5} enters manual mode. The device then reports work_mode 2.
  • service.set_direction {"direction": n} moves the robot: 1 forward, 2 turn left, 3 turn right, 0 exit.
  • Each command moves the robot for a short burst only, so callers repeat it (about every 125 ms in the official app) while a direction is held.
  • Leaving remote mode sends direction 0 and then prop.set {"sweep_type": 0}.

The official app only offers forward, left and right; there is no backward.

Testing

  • Unit tests for every command.
  • Verified on a Q7 TF+ (roborock.vacuum.sc05, firmware 03.01.80).

@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 Layer

  • PR Scoping / Branch Stacking:
    • Note: This branch (q7/2-remote-control) targets main and is stacked on top of commit 67ce5a18 from #1038 (feat: add Q7 zone cleaning). This review is scoped to 6bbd0cc5 (feat: add Q7 remote control trait); the branch should be rebased onto main once #1038 merges.
  • Data (roborock/data/b01_q7/b01_q7_code_mappings.py):
    • Adds Q7RemoteDirection(RoborockModeEnum) mapping EXIT = ("exit", 0), FORWARD = ("forward", 1), LEFT = ("left", 2), and RIGHT = ("right", 3) for service.set_direction.
  • Traits (roborock/devices/traits/b01/q7/remote.py, roborock/devices/traits/b01/q7/__init__.py):
    • Adds RemoteTrait and wires remote: RemoteTrait onto Q7PropertiesApi (exported in __all__), mirroring the B01 Q10 RemoteTrait surface (stop, forward, left, right, exit_remote).
    • Protocol command sequencing (prop.set with sweep_type: 5 to enter manual mode, service.set_direction with {"direction": <code>} for short-burst movement commands, and direction: 0 followed by prop.set with sweep_type: 0 to exit back to idle) matches Q7 remote control behavior.
  • Tests (tests/devices/traits/b01/q7/test_remote.py):
    • Parametrized unit tests cover stop, forward, left, right, and exit_remote via the q7_api.remote fixture and FakeQ7Channel.

LGTM — no issues found in 6bbd0cc5.

@Lash-L Lash-L added /review run Code review skill (/review) has been run Passed /review Passed the /review skill check labels Nov 15, 2026
@Lash-L
Lash-L marked this pull request as draft November 15, 2026 19:56
@Lash-L
Lash-L marked this pull request as ready for review November 15, 2026 20:21
Copilot AI balanced review requested due to automatic review settings November 15, 2026 20:21

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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`.

@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 (ad3991f); this follow-up review is scoped to PR #1039's own commit 19380d5 (feat: add Q7 remote control trait), with cross-verification against the Roborock Q7 app bundle and Q7 firmware.
  • Prior Nov 15 review (6bbd0cc5) had no requested changes or inline findings. Rebase onto main once #1038 merges.

Summary by Architectural Layer

  • Priority 1 — Public Trait APIs & Consumer Contracts (roborock/devices/traits/b01/q7/remote.py, roborock/devices/traits/b01/q7/__init__.py):
    • Adds RemoteTrait exposing stop(), forward(), left(), right(), and exit_remote(), mirroring the B01 Q10 RemoteTrait surface.
    • Cleanly wired as Q7PropertiesApi.remote and exported in __all__. Receives only the abstract Q7RpcChannel with concrete typing and no Any on public boundaries.
  • Priority 2 — Data Lifecycle & State Management:
    • Stateless command-only trait with direct, linear async calls; no background tasks, listeners, or mutable cached state requiring teardown in close().
  • Priority 3 — Wire Protocols, Codecs & Resilient Enums (roborock/data/b01_q7/b01_q7_code_mappings.py):
    • Adds Q7RemoteDirection(RoborockModeEnum) with unique values and integer codes (EXIT=0, FORWARD=1, LEFT=2, RIGHT=3), satisfying enum fallback resilience and alias conformance checks.
  • Protocol & Firmware Verification:
    • Q7 App Bundle (module_527.js, module_497.js, module_1324.js): Confirms METHOD_REMOTE_CONTROL = 'service.set_direction' with {"direction": n} (SCDirectionParam: top=1, left=2, right=3, no backward button in the UI), SCCleanModel.manual = 5 / SCCleanModel.auto = 0 sent via prop.set {"sweep_type": n}, and repeated short-burst direction sends while held. (The app exits via prop.set {"sweep_type": 0}; sending direction: 0 first in exit_remote() is live-verified on Q7 TF+ sc05 fw 03.01.80.)
    • Q7 Firmware (rriot_client, rootfs.bin blk #447): Confirms set_direction in the RPC dispatch table (parseSetRemoteCtrlReq, reading "direction") and sweep_type property handling alongside parseDeviceManualCtrlReq.
  • Tests (tests/devices/traits/b01/q7/test_remote.py):
    • Properly colocated at the mirror path, reusing q7_api and FakeQ7Channel with @pytest.mark.parametrize covering all 5 public commands via behavior-driven assertions.

Verdict

Clean — no findings survived adversarial self-check. Ready to approve once #1038 lands and this branch is rebased onto main.

@allenporter

Copy link
Copy Markdown
Contributor

Thank you @ramon-angosto for the great contribution.

@allenporter
allenporter merged commit 42976c0 into Python-roborock:main Nov 23, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature New feature Passed /review Passed the /review skill check 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.

4 participants