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
7 changes: 6 additions & 1 deletion roborock/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1275,7 +1275,12 @@ async def q10_empty_dustbin(ctx: click.Context, device_id: str) -> None:

@session.command()
@click.option("--device_id", required=True, help="Device ID")
@click.option("--mode", required=True, type=click.Choice(["bothwork", "onlysweep", "onlymop"]), help="Clean mode")
@click.option(
"--mode",
required=True,
type=click.Choice(["vac_and_mop", "vacuum", "mop"], case_sensitive=False),
help='Clean mode (preferred: "vac_and_mop", "vacuum", "mop")',
)
@click.pass_context
@async_command
async def q10_set_clean_mode(ctx: click.Context, device_id: str, mode: str) -> None:
Expand Down
6 changes: 3 additions & 3 deletions roborock/data/b01_q10/b01_q10_code_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ class YXRoomMaterial(RoborockModeEnum):

class YXCleanType(RoborockModeEnum):
UNKNOWN = "unknown", -1
BOTH_WORK = "bothwork", 1
ONLY_SWEEP = "onlysweep", 2
ONLY_MOP = "onlymop", 3
VAC_AND_MOP = "vac_and_mop", 1 # bothwork
VACUUM = "vacuum", 2 # onlysweep
MOP = "mop", 3 # onlymop


class YXDeviceState(RoborockModeEnum):
Expand Down
16 changes: 15 additions & 1 deletion tests/data/test_code_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest

from roborock import HomeDataProduct, RoborockCategory
from roborock.data.b01_q10.b01_q10_code_mappings import B01_Q10_DP
from roborock.data.b01_q10.b01_q10_code_mappings import B01_Q10_DP, YXCleanType


def test_from_code() -> None:
Expand Down Expand Up @@ -89,3 +89,17 @@ def test_homedata_product_unknown_category():
product = HomeDataProduct.from_dict(data)
assert product.id == "unknown_cat_id"
assert product.category == RoborockCategory.UNKNOWN


@pytest.mark.parametrize(
("readable_value", "expected_clean_type"),
[
("vac_and_mop", YXCleanType.VAC_AND_MOP),
("vacuum", YXCleanType.VACUUM),
("mop", YXCleanType.MOP),
],
)
def test_yx_clean_type_from_value_readable_values(readable_value: str, expected_clean_type: YXCleanType) -> None:
"""Test YXCleanType accepts canonical readable values."""
assert YXCleanType.from_value(readable_value) is expected_clean_type
assert expected_clean_type.value == readable_value
2 changes: 1 addition & 1 deletion tests/devices/traits/b01/q10/test_vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def vacuumm_fixture(q10_api: Q10PropertiesApi) -> VacuumTrait:
(lambda x: x.stop_clean(), {"206": {}}),
(lambda x: x.return_to_dock(), {"203": {}}),
(lambda x: x.empty_dustbin(), {"203": 2}),
(lambda x: x.set_clean_mode(YXCleanType.BOTH_WORK), {"137": 1}),
(lambda x: x.set_clean_mode(YXCleanType.VAC_AND_MOP), {"137": 1}),
(lambda x: x.set_fan_level(YXFanLevel.BALANCED), {"123": 2}),
],
)
Expand Down
Loading