Skip to content

fix(v1): offer custom and SmartPlan cleaning modes on water-slide devices - #1025

Open
paulleonartcalvo wants to merge 1 commit into
Python-roborock:mainfrom
paulleonartcalvo:fix/water-slide-custom-smart-modes
Open

paulleonartcalvo wants to merge 1 commit into
Python-roborock:mainfrom
paulleonartcalvo:fix/water-slide-custom-smart-modes

Conversation

@paulleonartcalvo

Copy link
Copy Markdown

Fixes #977.

Problem

Water-slide devices report water flow as slider positions, so get_water_modes() returns only the slide range for them. That list has no CUSTOMIZED (204) or SMART_MODE (209) entry, so get_cleaning_mode_options() drops CUSTOM and SMART_MODE even when is_customized_clean_supported / is_smart_clean_mode_set_supported are set. get_current_cleaning_mode() still returns custom / smart_mode for those states, so Home Assistant's cleaning mode select shows unknown whenever the device is in either mode, because the current value is not one of its options.

Change

For water-slide devices, CUSTOM and SMART_MODE are gated on their feature flags alone. Non-slide devices are unchanged. The existing test_cleaning_mode_options_water_slide_device asserted the old behaviour; it now covers each flag combination, and there are new tests for readback and for the write payloads on slide devices.

Device testing

#977 noted that writes had not been tested on hardware. On a Qrevo Edge 3 Pro (roborock.vacuum.a296, water slide, both flags true), docked, through set_clean_motor_mode:

written (fan / water / mop) read back from get_status get_current_cleaning_mode
106 / 204 / 302 106 / 204 / 300 custom
110 / 209 / 306 110 / 209 / 306 smart_mode

Both were accepted. Before this change both read back as a mode that is not in cleaning_mode_options. The device was restored to 102 / 248 / 300 afterwards.

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

🤖 Generated with Claude Code

…ices

Water-slide devices report flow as slider positions, so get_water_modes()
has no CUSTOMIZED (204) or SMART_MODE (209) entry for them and
get_cleaning_mode_options() dropped CUSTOM and SMART_MODE even when the
feature flags are set. get_current_cleaning_mode() still classifies those
states, so consumers such as Home Assistant showed an unknown cleaning
mode whenever the device was in custom or SmartPlan mode.

Gate both options on the feature flags alone for water-slide devices.
Verified on a Qrevo Edge 3 Pro (roborock.vacuum.a296): writing
106/204/302 and 110/209/306 with set_clean_motor_mode is accepted and
read back as 106/204/300 and 110/209/306.

Fixes Python-roborock#977

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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

Automated code review by Gemini 4 Carbon in Antigravity using our code-review skill and AGENTS.md.


Thanks for the thorough fix and hardware verification on #977! The approach and test coverage look great — left one inline question on simplifying get_cleaning_mode_options().

Comment on lines +246 to 255
# Water-slide devices report flow as slider positions, so their water mode
# list has no CUSTOMIZED (204) or SMART_MODE (209) entry, but they still
# accept and report those codes for the custom and SmartPlan modes.
is_water_slide = features.is_water_slide_mode_supported
if features.is_customized_clean_supported and (is_water_slide or WaterModes.CUSTOMIZED in supported_water_modes):
options.append(CleaningMode.CUSTOM)
if features.is_smart_clean_mode_set_supported and WaterModes.SMART_MODE in supported_water_modes:
if features.is_smart_clean_mode_set_supported and (
is_water_slide or WaterModes.SMART_MODE in supported_water_modes
):
options.append(CleaningMode.SMART_MODE)

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.

Quick question on get_cleaning_mode_options(): on non-slide devices, get_water_modes() already appends WaterModes.SMART_MODE and WaterModes.CUSTOMIZED unconditionally whenever is_smart_clean_mode_set_supported / is_customized_clean_supported are set (lines 193–196) — checking supported_water_modes here was originally added in #817 only to exclude water-slide devices.

Now that water-slide devices support them too, can we drop supported_water_modes altogether and gate directly on the feature flags (matching get_clean_modes() and get_clean_routes())?

 def get_cleaning_mode_options(features: DeviceFeatures) -> list[CleaningMode]:
     if not features.is_support_water_mode:
         return []

-    supported_water_modes = get_water_modes(features)
     options = [CleaningMode.VACUUM, CleaningMode.VAC_AND_MOP]
     if features.is_pure_clean_mop_supported:
         options.append(CleaningMode.MOP)
-    # Water-slide devices report flow as slider positions, so their water mode
-    # list has no CUSTOMIZED (204) or SMART_MODE (209) entry, but they still
-    # accept and report those codes for the custom and SmartPlan modes.
-    is_water_slide = features.is_water_slide_mode_supported
-    if features.is_customized_clean_supported and (is_water_slide or WaterModes.CUSTOMIZED in supported_water_modes):
+    if features.is_customized_clean_supported:
         options.append(CleaningMode.CUSTOM)
-    if features.is_smart_clean_mode_set_supported and (
-        is_water_slide or WaterModes.SMART_MODE in supported_water_modes
-    ):
+    if features.is_smart_clean_mode_set_supported:
         options.append(CleaningMode.SMART_MODE)
     return options

@Lash-L Lash-L added Small PR Small pull request (<200 lines) bug Something isn't working /review run Code review skill (/review) has been run V1 V1 platform labels Nov 15, 2026
@matanmesika

Copy link
Copy Markdown

Confirming this on a second water-slide model: Roborock Saros 20 Complete (roborock.vacuum.a288, firmware 02.57.88), Home Assistant 2026.11.1 (python-roborock 7.12.0).

While the robot is in SmartPlan it reports fanPower: 110, waterBoxMode: 209, mopMode: 306, with isWaterSlideModeSupported, isSmartCleanModeSetSupported and isCustomizedCleanSupported all true. current_cleaning_mode resolves to smart_mode, but cleaning_mode_options is only vacuum, vac_and_mop, mop, so the Home Assistant cleaning mode select has shown unknown for the last 10 days.

I applied the same idea locally (adding SMART_MODE / CUSTOMIZED to get_water_modes() for water-slide devices when the feature flags are set) and restarted Home Assistant. The select now lists vacuum, vac_and_mop, mop, custom, smart_mode and shows smart_mode, matching the app. No other entities changed. Happy to test anything else on the Saros 20 if it helps get this merged.

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

bug Something isn't working /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.

Water-slide device reports custom mode but capability-derived options exclude it (Qrevo Edge 2 Flow)

4 participants