Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added time left for recommended sensor cleaning #119

Merged
merged 5 commits into from
Nov 17, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
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