From e840b44fcd9eb0c42320c013d01a6a45a6eba79c Mon Sep 17 00:00:00 2001 From: Luke Date: Tue, 11 Aug 2026 13:26:01 -0400 Subject: [PATCH] fix: logic around mop being off --- roborock/data/v1/v1_clean_modes.py | 17 ++++------------ tests/devices/traits/v1/test_status.py | 28 +++++++++++++++++--------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/roborock/data/v1/v1_clean_modes.py b/roborock/data/v1/v1_clean_modes.py index cc6345aa..258307b3 100644 --- a/roborock/data/v1/v1_clean_modes.py +++ b/roborock/data/v1/v1_clean_modes.py @@ -118,10 +118,7 @@ def get_clean_modes(features: DeviceFeatures) -> list[VacuumModes]: modes.append(VacuumModes.MAX_PLUS) if features.is_pure_clean_mop_supported: # If the vacuum is capable of 'pure mop clean' aka no vacuum - if features.is_support_main_brush_up_down_supported: - modes.append(VacuumModes.OFF_RAISE_MAIN_BRUSH) - else: - modes.append(VacuumModes.OFF) + modes.append(VacuumModes.OFF) else: # If not, we can add gentle modes.append(VacuumModes.GENTLE) @@ -218,17 +215,11 @@ def get_cleaning_mode_options(features: DeviceFeatures) -> list[CleaningMode]: def get_mop_only_vacuum_mode(features: DeviceFeatures) -> VacuumModes: - """Determine the vacuum mode to use when you just want to mop. - - There are three cases that must be handled: - 1. The device does not support only mopping. - 2. The device supports raising the vacuum brush while mopping - 3. All other cases. - """ + """Return the vacuum mode used by the app for mop-only cleaning.""" if not features.is_pure_clean_mop_supported: raise RoborockUnsupportedFeature("Mop-only cleaning is not supported") - if features.is_support_main_brush_up_down_supported: - return VacuumModes.OFF_RAISE_MAIN_BRUSH + # Main-brush lift is a device capability, not an alternate fan-power + # command. The app still sends CleanModeZero (105) for mop-only cleaning. return VacuumModes.OFF diff --git a/tests/devices/traits/v1/test_status.py b/tests/devices/traits/v1/test_status.py index f11ee661..0c397faf 100644 --- a/tests/devices/traits/v1/test_status.py +++ b/tests/devices/traits/v1/test_status.py @@ -180,11 +180,14 @@ def test_current_cleaning_mode( assert status_trait.current_cleaning_mode_name == expected_mode.value -def test_current_cleaning_mode_with_brush_up_mop() -> None: - """Test brush-up mop-only classification on supported devices.""" - status_trait = _create_cleaning_mode_status_trait(is_support_main_brush_up_down_supported=True) - status_trait.fan_power = VacuumModes.OFF_RAISE_MAIN_BRUSH.code - status_trait.water_box_mode = WaterModes.STANDARD.code +def test_current_cleaning_mode_with_main_brush_lift() -> None: + """Test mop-only classification on a device with main-brush lift.""" + status_trait = _create_cleaning_mode_status_trait( + is_support_main_brush_up_down_supported=True, + is_water_slide_mode_supported=True, + ) + status_trait.fan_power = VacuumModes.OFF.code + status_trait.water_box_mode = WaterModes.PURE_WATER_FLOW_MIDDLE.code status_trait.mop_mode = CleanRoutes.STANDARD.code assert status_trait.current_cleaning_mode == CleaningMode.MOP @@ -291,17 +294,22 @@ def test_cleaning_mode_options_with_smart_mode() -> None: ] -def test_get_cleaning_mode_parameters_with_brush_up_mop() -> None: - """Test mop-only uses the brush-up mode when supported.""" - status_trait = _create_cleaning_mode_status_trait(is_support_main_brush_up_down_supported=True) +def test_get_cleaning_mode_parameters_qrevo_edge_2() -> None: + """Test the app-compatible Qrevo Edge 2 mop-only payload.""" + status_trait = _create_cleaning_mode_status_trait( + is_support_main_brush_up_down_supported=True, + is_water_slide_mode_supported=True, + ) assert get_cleaning_mode_parameters(CleaningMode.MOP, status_trait._device_features_trait) == [ { - "fan_power": VacuumModes.OFF_RAISE_MAIN_BRUSH.code, - "water_box_mode": WaterModes.STANDARD.code, + "fan_power": VacuumModes.OFF.code, + "water_box_mode": WaterModes.PURE_WATER_FLOW_MIDDLE.code, "mop_mode": CleanRoutes.STANDARD.code, } ] + assert VacuumModes.OFF in status_trait.fan_speed_options + assert VacuumModes.OFF_RAISE_MAIN_BRUSH not in status_trait.fan_speed_options def test_get_cleaning_mode_parameters_without_clean_route_setting() -> None: