Skip to content

Commit e840b44

Browse files
committed
fix: logic around mop being off
1 parent e8d5466 commit e840b44

2 files changed

Lines changed: 22 additions & 23 deletions

File tree

‎roborock/data/v1/v1_clean_modes.py‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,7 @@ def get_clean_modes(features: DeviceFeatures) -> list[VacuumModes]:
118118
modes.append(VacuumModes.MAX_PLUS)
119119
if features.is_pure_clean_mop_supported:
120120
# If the vacuum is capable of 'pure mop clean' aka no vacuum
121-
if features.is_support_main_brush_up_down_supported:
122-
modes.append(VacuumModes.OFF_RAISE_MAIN_BRUSH)
123-
else:
124-
modes.append(VacuumModes.OFF)
121+
modes.append(VacuumModes.OFF)
125122
else:
126123
# If not, we can add gentle
127124
modes.append(VacuumModes.GENTLE)
@@ -218,17 +215,11 @@ def get_cleaning_mode_options(features: DeviceFeatures) -> list[CleaningMode]:
218215

219216

220217
def get_mop_only_vacuum_mode(features: DeviceFeatures) -> VacuumModes:
221-
"""Determine the vacuum mode to use when you just want to mop.
222-
223-
There are three cases that must be handled:
224-
1. The device does not support only mopping.
225-
2. The device supports raising the vacuum brush while mopping
226-
3. All other cases.
227-
"""
218+
"""Return the vacuum mode used by the app for mop-only cleaning."""
228219
if not features.is_pure_clean_mop_supported:
229220
raise RoborockUnsupportedFeature("Mop-only cleaning is not supported")
230-
if features.is_support_main_brush_up_down_supported:
231-
return VacuumModes.OFF_RAISE_MAIN_BRUSH
221+
# Main-brush lift is a device capability, not an alternate fan-power
222+
# command. The app still sends CleanModeZero (105) for mop-only cleaning.
232223
return VacuumModes.OFF
233224

234225

‎tests/devices/traits/v1/test_status.py‎

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,14 @@ def test_current_cleaning_mode(
180180
assert status_trait.current_cleaning_mode_name == expected_mode.value
181181

182182

183-
def test_current_cleaning_mode_with_brush_up_mop() -> None:
184-
"""Test brush-up mop-only classification on supported devices."""
185-
status_trait = _create_cleaning_mode_status_trait(is_support_main_brush_up_down_supported=True)
186-
status_trait.fan_power = VacuumModes.OFF_RAISE_MAIN_BRUSH.code
187-
status_trait.water_box_mode = WaterModes.STANDARD.code
183+
def test_current_cleaning_mode_with_main_brush_lift() -> None:
184+
"""Test mop-only classification on a device with main-brush lift."""
185+
status_trait = _create_cleaning_mode_status_trait(
186+
is_support_main_brush_up_down_supported=True,
187+
is_water_slide_mode_supported=True,
188+
)
189+
status_trait.fan_power = VacuumModes.OFF.code
190+
status_trait.water_box_mode = WaterModes.PURE_WATER_FLOW_MIDDLE.code
188191
status_trait.mop_mode = CleanRoutes.STANDARD.code
189192

190193
assert status_trait.current_cleaning_mode == CleaningMode.MOP
@@ -291,17 +294,22 @@ def test_cleaning_mode_options_with_smart_mode() -> None:
291294
]
292295

293296

294-
def test_get_cleaning_mode_parameters_with_brush_up_mop() -> None:
295-
"""Test mop-only uses the brush-up mode when supported."""
296-
status_trait = _create_cleaning_mode_status_trait(is_support_main_brush_up_down_supported=True)
297+
def test_get_cleaning_mode_parameters_qrevo_edge_2() -> None:
298+
"""Test the app-compatible Qrevo Edge 2 mop-only payload."""
299+
status_trait = _create_cleaning_mode_status_trait(
300+
is_support_main_brush_up_down_supported=True,
301+
is_water_slide_mode_supported=True,
302+
)
297303

298304
assert get_cleaning_mode_parameters(CleaningMode.MOP, status_trait._device_features_trait) == [
299305
{
300-
"fan_power": VacuumModes.OFF_RAISE_MAIN_BRUSH.code,
301-
"water_box_mode": WaterModes.STANDARD.code,
306+
"fan_power": VacuumModes.OFF.code,
307+
"water_box_mode": WaterModes.PURE_WATER_FLOW_MIDDLE.code,
302308
"mop_mode": CleanRoutes.STANDARD.code,
303309
}
304310
]
311+
assert VacuumModes.OFF in status_trait.fan_speed_options
312+
assert VacuumModes.OFF_RAISE_MAIN_BRUSH not in status_trait.fan_speed_options
305313

306314

307315
def test_get_cleaning_mode_parameters_without_clean_route_setting() -> None:

0 commit comments

Comments
 (0)