Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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", "bothwork", "onlysweep", "onlymop"], case_sensitive=False),
Comment thread
lboue marked this conversation as resolved.
Outdated
help='Clean mode (preferred: "vac_and_mop", "vacuum", "mop")',
)
Comment thread
lboue marked this conversation as resolved.
Comment thread
lboue marked this conversation as resolved.
@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


Comment thread
lboue marked this conversation as resolved.
Comment thread
lboue marked this conversation as resolved.
Comment thread
lboue marked this conversation as resolved.
class YXDeviceState(RoborockModeEnum):
Expand Down
22 changes: 21 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,23 @@ def test_homedata_product_unknown_category():
product = HomeDataProduct.from_dict(data)
assert product.id == "unknown_cat_id"
assert product.category == RoborockCategory.UNKNOWN


def test_yx_clean_type_legacy_values_stable() -> None:
"""Test YXCleanType exposes readable public values."""
assert YXCleanType.VAC_AND_MOP.value == "vac_and_mop"
assert YXCleanType.VACUUM.value == "vacuum"
assert YXCleanType.MOP.value == "mop"


@pytest.mark.parametrize(
("input_value", "expected"),
[
("vac_and_mop", YXCleanType.VAC_AND_MOP),
("vacuum", YXCleanType.VACUUM),
("mop", YXCleanType.MOP),
],
)
def test_yx_clean_type_from_value_compat_aliases(input_value: str, expected: YXCleanType) -> None:
Comment thread
lboue marked this conversation as resolved.
Outdated
"""Test YXCleanType accepts readable values."""
assert YXCleanType.from_value(input_value) is expected
Comment thread
lboue marked this conversation as resolved.
Outdated
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}),
Comment thread
lboue marked this conversation as resolved.
],
)
Expand Down
Loading