Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 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
2 changes: 1 addition & 1 deletion miio/tests/test_vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def test_goto(self):
def test_zoned_clean(self):
self.device.start()
assert self.status().is_on is True
self.device.zoned_clean(25000, 25000, 25500, 25500, 3)
self.device.zoned_clean([[25000, 25000, 25500, 25500, 3], [23000, 23000, 22500, 22500, 1]])
assert self.status().state_code == self.device.STATE_ZONED_CLEAN

@pytest.mark.xfail
Expand Down
25 changes: 7 additions & 18 deletions miio/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from .click_common import (
DeviceGroup, command, GlobalContextObject,
)
from .device import Device, DeviceException
from .device import Device, DeviceException, LiteralParamType
from .vacuumcontainers import (VacuumStatus, ConsumableStatus, DNDStatus,
CleaningSummary, CleaningDetails, Timer,
SoundStatus, SoundInstallStatus, CarpetModeStatus)
Expand Down Expand Up @@ -81,26 +81,15 @@ def goto(self, x_coord: int, y_coord: int):
"""Go to specific target.
:param int x_coord: x coordinate
:param int y_coord: y coordinate"""
return self.send("app_goto_target",
[x_coord, y_coord])
return self.send("app_goto_target", [x_coord, y_coord])

@command(
click.argument("x1_coord", type=int),
click.argument("y1_coord", type=int),
click.argument("x2_coord", type=int),
click.argument("y2_coord", type=int),
click.argument("iterations", type=int),
click.argument("zones", type=LiteralParamType(), required=True),
)
def zoned_clean(self, x1_coord: int, y1_coord: int,
x2_coord: int, y2_coord: int, iterations: int):
"""Clean a zoned area.
:param int x1_coord: x1 coordinate bottom left corner
:param int y1_coord: y1 coordinate bottom left corner
:param int x2_coord: x2 coordinate top right corner
:param int y2_coord: y2 coordinate top right corner
:param int iterations: How many times the zone should be cleaned"""
return self.send("app_zoned_clean",
[x1_coord, y1_coord, x2_coord, y2_coord, iterations])
def zoned_clean(self, zones: List):
"""Cleans zoned areas.
:param List zones: List of zones to clean: [[x1,y1,x2,y2, iterations],[x1,y1,x2,y2, iterations]]"""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (107 > 100 characters)

return self.send("app_zoned_clean", zones)

@command()
def manual_start(self):
Expand Down
13 changes: 13 additions & 0 deletions miio/vacuum_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,19 @@ def home(vac: miio.Vacuum):
click.echo("Requesting return to home: %s" % vac.home())


@cli.command()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

@pass_dev
def goto(vac: miio.Vacuum):
"""Going to target."""
click.echo("Going to target : %s" % vac.goto())


@cli.command()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

@pass_dev
def zoned_clean(vac: miio.Vacuum):
"""Cleaning zone(s)."""
click.echo("Cleaning zone(s) : %s" % vac.zoned_clean())

@cli.group()
@pass_dev
# @click.argument('command', required=False)
Expand Down