Skip to content

Commit

Permalink
Reset consumable by name: main_brush_work_time, side_brush_work_time,…
Browse files Browse the repository at this point in the history
… sensor_dirty_time, filter_work_time
  • Loading branch information
mrin committed Nov 6, 2017
1 parent 23a6aae commit aa3338c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 3 additions & 3 deletions miio/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ def consumable_status(self) -> ConsumableStatus:
"""Return information about consumables."""
return ConsumableStatus(self.send("get_consumable")[0])

def consumable_reset(self):
def consumable_reset(self, name):
"""Reset consumable information."""
raise NotImplementedError("unknown parameters")
# self.send("reset_consumable", ["unknown"])
# name = ["main_brush_work_time", "side_brush_work_time", "sensor_dirty_time" or "filter_work_time"]
return self.send("reset_consumable", [name])

def map(self):
"""Return map token."""
Expand Down
9 changes: 9 additions & 0 deletions miio/vacuum_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ def consumables(vac: miio.Vacuum):
click.echo("Sensor dirty: %s" % res.sensor_dirty)


@cli.command()
@click.argument('name', type=str, required=True)
@pass_dev
def reset_consumable(vac: miio.Vacuum, name):
"""Query and reset consumable."""
click.echo("Reset consumable %s" % name)
vac.consumable_reset(name)


@cli.command()
@pass_dev
def start(vac: miio.Vacuum):
Expand Down

0 comments on commit aa3338c

Please sign in to comment.