Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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"]),
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
22 changes: 19 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,25 @@ 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
VACUUM = "vacuum", 2
MOP = "mop", 3

# Legacy aliases
Comment thread
lboue marked this conversation as resolved.
Outdated
BOTH_WORK = VAC_AND_MOP
ONLY_SWEEP = VACUUM
ONLY_MOP = MOP

@classmethod
def from_value(cls, value: str):
"""Find enum member by string value with legacy support."""
legacy_values = {
"bothwork": "vac_and_mop",
"onlysweep": "vacuum",
"onlymop": "mop",
}
normalized_value = legacy_values.get(value.lower(), value)
return super().from_value(normalized_value)
Comment thread
lboue marked this conversation as resolved.
Outdated


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
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