Skip to content

Commit 6122647

Browse files
committed
feat(q10): Add Q10 vacuum CLI commands
- Add q10-vacuum-start command to start vacuum cleaning - Add q10-vacuum-pause command to pause vacuum cleaning - Add q10-vacuum-resume command to resume vacuum cleaning - Add q10-vacuum-stop command to stop vacuum cleaning - Add q10-vacuum-dock command to return vacuum to dock - All commands require device_id parameter - Commands validate that device has VacuumTrait (Q10 only)
1 parent 9719cac commit 6122647

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

roborock/cli.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,86 @@ def write_markdown_table(product_features: dict[str, dict[str, any]], all_featur
11411141
click.echo("Done.")
11421142

11431143

1144+
@click.command()
1145+
@click.option("--device_id", required=True, help="Device ID")
1146+
@click.pass_context
1147+
@async_command
1148+
async def q10_vacuum_start(ctx, device_id):
1149+
"""Start vacuum cleaning on Q10 device."""
1150+
context: RoborockContext = ctx.obj
1151+
device_manager = await context.get_device_manager()
1152+
device = await device_manager.get_device(device_id)
1153+
trait = device.traits.get("VacuumTrait")
1154+
if not trait:
1155+
raise RoborockUnsupportedFeature("Device does not have VacuumTrait. Is it a Q10?")
1156+
await trait.start_clean()
1157+
click.echo("Starting vacuum cleaning...")
1158+
1159+
1160+
@click.command()
1161+
@click.option("--device_id", required=True, help="Device ID")
1162+
@click.pass_context
1163+
@async_command
1164+
async def q10_vacuum_pause(ctx, device_id):
1165+
"""Pause vacuum cleaning on Q10 device."""
1166+
context: RoborockContext = ctx.obj
1167+
device_manager = await context.get_device_manager()
1168+
device = await device_manager.get_device(device_id)
1169+
trait = device.traits.get("VacuumTrait")
1170+
if not trait:
1171+
raise RoborockUnsupportedFeature("Device does not have VacuumTrait. Is it a Q10?")
1172+
await trait.pause_clean()
1173+
click.echo("Pausing vacuum cleaning...")
1174+
1175+
1176+
@click.command()
1177+
@click.option("--device_id", required=True, help="Device ID")
1178+
@click.pass_context
1179+
@async_command
1180+
async def q10_vacuum_resume(ctx, device_id):
1181+
"""Resume vacuum cleaning on Q10 device."""
1182+
context: RoborockContext = ctx.obj
1183+
device_manager = await context.get_device_manager()
1184+
device = await device_manager.get_device(device_id)
1185+
trait = device.traits.get("VacuumTrait")
1186+
if not trait:
1187+
raise RoborockUnsupportedFeature("Device does not have VacuumTrait. Is it a Q10?")
1188+
await trait.resume_clean()
1189+
click.echo("Resuming vacuum cleaning...")
1190+
1191+
1192+
@click.command()
1193+
@click.option("--device_id", required=True, help="Device ID")
1194+
@click.pass_context
1195+
@async_command
1196+
async def q10_vacuum_stop(ctx, device_id):
1197+
"""Stop vacuum cleaning on Q10 device."""
1198+
context: RoborockContext = ctx.obj
1199+
device_manager = await context.get_device_manager()
1200+
device = await device_manager.get_device(device_id)
1201+
trait = device.traits.get("VacuumTrait")
1202+
if not trait:
1203+
raise RoborockUnsupportedFeature("Device does not have VacuumTrait. Is it a Q10?")
1204+
await trait.stop_clean()
1205+
click.echo("Stopping vacuum cleaning...")
1206+
1207+
1208+
@click.command()
1209+
@click.option("--device_id", required=True, help="Device ID")
1210+
@click.pass_context
1211+
@async_command
1212+
async def q10_vacuum_dock(ctx, device_id):
1213+
"""Return vacuum to dock on Q10 device."""
1214+
context: RoborockContext = ctx.obj
1215+
device_manager = await context.get_device_manager()
1216+
device = await device_manager.get_device(device_id)
1217+
trait = device.traits.get("VacuumTrait")
1218+
if not trait:
1219+
raise RoborockUnsupportedFeature("Device does not have VacuumTrait. Is it a Q10?")
1220+
await trait.return_to_dock()
1221+
click.echo("Returning vacuum to dock...")
1222+
1223+
11441224
cli.add_command(login)
11451225
cli.add_command(discover)
11461226
cli.add_command(list_devices)
@@ -1170,6 +1250,11 @@ def write_markdown_table(product_features: dict[str, dict[str, any]], all_featur
11701250
cli.add_command(flow_led_status)
11711251
cli.add_command(led_status)
11721252
cli.add_command(network_info)
1253+
cli.add_command(q10_vacuum_start)
1254+
cli.add_command(q10_vacuum_pause)
1255+
cli.add_command(q10_vacuum_resume)
1256+
cli.add_command(q10_vacuum_stop)
1257+
cli.add_command(q10_vacuum_dock)
11731258

11741259

11751260
def main():

0 commit comments

Comments
 (0)