Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions roborock/data/v1/v1_clean_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Comment on lines +221 to +222
return VacuumModes.OFF


Expand Down
28 changes: 18 additions & 10 deletions tests/devices/traits/v1/test_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."""
Comment on lines +297 to +298
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:
Expand Down
Loading