Skip to content

feat(v1): add CleaningMode.VAC_THEN_MOP - #1024

Open
paulleonartcalvo wants to merge 4 commits into
Python-roborock:mainfrom
paulleonartcalvo:feat/vac-then-mop-cleaning-mode
Open

paulleonartcalvo wants to merge 4 commits into
Python-roborock:mainfrom
paulleonartcalvo:feat/vac-then-mop-cleaning-mode

Conversation

@paulleonartcalvo

Copy link
Copy Markdown

Builds on #959 and implements the direction @allenporter suggested in this review comment: fold "clean then mop" into CleaningMode as a fourth mode, so consumers like Home Assistant get it through the existing cleaning mode select instead of a separate control. Closes #914.

The first three commits are @klowdo's from #959, rebased onto main unchanged. The last commit adds the mode on top. Happy to fold this into #959 instead if that is easier.

Changes

  • CleaningMode.VAC_THEN_MOP ("vac_then_mop"), offered in get_cleaning_mode_options() when is_clean_then_mop_mode_supported.
  • get_current_cleaning_mode() takes an optional seq_type and reports VAC_THEN_MOP for vacuum-and-mop settings with seq_type == 1; StatusTrait.current_cleaning_mode passes it through.
  • StatusTrait.set_cleaning_mode():
    • VAC_THEN_MOP: writes the vacuum-and-mop motor settings with set_clean_motor_mode, then app_set_clean_sequence_type with type: 1 and the same motor values (repeat: 1 when is_ctm_with_repeat_supported).
    • Any other mode while the sequence is on: sends type: 0 after the motor write, like the app. Nothing extra is sent when it is already off or unsupported.
  • clean_then_mop returns None on devices without the feature (point 3 of the review).
  • Removed the separate set_clean_then_mop() setter from feat(v1): expose clean-then-mop status from the device #959, since the mode now covers it and a standalone setter can produce the conflicting type: 1 with water_box_mode: 200 case from the review. Easy to restore if you would rather keep it.
  • SEQ_TYPE_CLEAN_THEN_MOP now lives in v1_clean_modes and is shared with the per-room CustomizeCleanModeTrait (feat(v1): expose per-room clean-then-mop via customize clean mode #984).

Device testing

Qrevo Edge 3 Pro (roborock.vacuum.a296, water slide, isCleanThenMopModeSupported and isCtmWithRepeatSupported both true):

  • Payload the official app sends when picking "Vacuum then mop": app_set_clean_sequence_type {"type": 1, "water_box_mode": 248, "mop_mode": 300, "fan_power": 102, "repeat": 1}. The robot answered ok.
  • With that set, a kitchen segment clean detached the mop pads for the vacuum pass, returned to the dock to reattach them, then went back out to mop.
  • Not yet verified on this model: reading seq_type back from get_status (verified on the Saros 20 in feat(v1): expose clean-then-mop status from the device #959).

uv run pytest (2301 passed) and uv run pre-commit run --all-files pass.

🤖 Generated with Claude Code

klowdo and others added 4 commits November 9, 2026 22:18
The device reports seq_type in its get_status payload, but StatusV2 did not
model it, so RoborockBase.from_dict discarded it along with every other
unmatched key. The vendor app reads the same field off the same payload to
derive its "clean then mop" state.

Add seq_type to StatusV2 and a clean_then_mop property on StatusTrait that
reports whether the current run vacuums each room fully before mopping it.
It describes the run in progress rather than a persisted setting, and the
device offers no setter, so it is read only here; the value travels outbound
as a parameter of the cleaning command instead.

Gated for reporting on is_clean_then_mop_mode_supported.

Verified against a Roborock Saros 20 (roborock.vacuum.a288).
Model the app's "Vacuum then mop" choice as a fourth high-level cleaning
mode, as suggested in review of Python-roborock#959, so consumers such as Home Assistant
get it through cleaning_mode_options / current_cleaning_mode /
set_cleaning_mode without orchestrating a separate control.

- Offer VAC_THEN_MOP when is_clean_then_mop_mode_supported.
- Report it when vacuum-and-mop settings run with seq_type 1.
- set_cleaning_mode writes the vacuum-and-mop motor settings, then
  app_set_clean_sequence_type with type 1 (repeat 1 when
  is_ctm_with_repeat_supported); switching to another mode while it is
  enabled sends type 0, like the app.
- clean_then_mop returns None on devices without the feature.
- Replace the separate set_clean_then_mop setter with the mode, and share
  SEQ_TYPE_CLEAN_THEN_MOP with the per-room customize clean mode trait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Lash-L Lash-L added Feature New feature V1 V1 platform labels Nov 15, 2026
@lacroixdavid1

Copy link
Copy Markdown

Device data from another model, in case it helps here: Qrevo S Pro (roborock.vacuum.a326, firmware 02.49.24, isCleanThenMopModeSupported and isCtmWithRepeatSupported both true). Measured on 2026-10-19 from Home Assistant (python-roborock 7.4.2 at the time), sending the raw command through vacuum.send_command.

Read-back of seq_type, which was still open for the a296 above

  • At the dock get_status reported seq_type: 0, with fan_power 104, water_box_mode 203, mop_mode 300.
  • app_set_clean_sequence_type with {"type": 1, "fan_power": 104, "water_box_mode": 203, "mop_mode": 300, "repeat": 1} returned ["ok"], and get_status then read seq_type: 1.

One job, vacuum then mop

A one-room segment clean started right after from Home Assistant ran as:

Elapsed State cleaning_info
0:00 18 segment cleaning fan_power 104, water_box_status 200 (no water)
5:35 26 going to wash the mop, 22 emptying the bin, 23 washing the mop
9:17 18 segment cleaning fan_power 105 (no suction), water_box_status 203
15:00 6 returning home

The top-level fan_power / water_box_mode / mop_mode stayed 104 / 203 / 300 the whole time; only cleaning_info shows which pass is running. Only the ordinary state codes, none of the 63xx ones. The job left a single clean record (complete 1, finish_reason 56).

The setting did not outlive the job

seq_type stayed 1 during the run. The first status while returning home read seq_type: 0, with nothing sent from Home Assistant in between. So on this model and firmware the robot clears it itself when the job ends. Two things follow for this PR:

  • current_cleaning_mode will read vac_and_mop again after each job, so a consumer has to select vac_then_mop before every run. In Home Assistant the select would flip back by itself.
  • The clean_then_mop docstring says the value is persisted on the device. That matches the idle Saros 20 test in feat(v1): expose clean-then-mop status from the device #959, but not this model once a job has run.

This is one run on one device, so take it as a data point, not a rule. I can repeat it on current firmware, or run a specific sequence, if that helps.

Done with AI assistance.


Generated by Claude Code

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 V1 V1 platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support the "Clean then mop" cleaning mode (feature bit 93, is_clean_then_mop_mode_supported)

4 participants