Skip to content

Commit

Permalink
Added time left for recommended sensor cleaning (#119)
Browse files Browse the repository at this point in the history
* Added time left for recommended sensor cleaning

Unfortunately I am unable to test these changes, however I believe they should work.

* Remove witespace

Github browser based editor sucks!

* Correct wrong instance name and renamed property

* Correct wrong instance again!

* Update CLI to use new dirty sensor value
  • Loading branch information
bbbenji authored and rytilahti committed Nov 17, 2017
1 parent ed01fd8 commit bd5e346
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion miio/vacuum_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ def consumables(vac: miio.Vacuum):
res.side_brush_left))
click.echo("Filter: %s (left %s)" % (res.filter,
res.filter_left))
click.echo("Sensor dirty: %s" % res.sensor_dirty)
click.echo("Sensor dirty: %s (left %s)" % (res.sensor_dirty,
res.sensor_dirty_left))


@cli.command()
Expand Down
5 changes: 5 additions & 0 deletions miio/vacuumcontainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ def __init__(self, data: Dict[str, Any]) -> None:
self.main_brush_total = timedelta(hours=300)
self.side_brush_total = timedelta(hours=200)
self.filter_total = timedelta(hours=150)
self.sensor_dirty_total = timedelta(hours=30)

@property
def main_brush(self) -> timedelta:
Expand Down Expand Up @@ -321,6 +322,10 @@ def filter_left(self) -> timedelta:
def sensor_dirty(self) -> timedelta:
return pretty_seconds(self.data["sensor_dirty_time"])

@property
def sensor_dirty_left(self) -> timedelta:
return self.sensor_dirty_total - self.sensor_dirty

def __repr__(self) -> str:
return "<ConsumableStatus main: %s, side: %s, filter: %s, sensor dirty: %s>" % ( # noqa: E501
self.main_brush, self.side_brush, self.filter, self.sensor_dirty)
Expand Down

0 comments on commit bd5e346

Please sign in to comment.