-
-
Notifications
You must be signed in to change notification settings - Fork 563
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
Reset consumable by name #115
Changes from 6 commits
aa3338c
1ce83c2
de89ac1
d6557ee
3d1b833
120de89
2bbb532
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,6 +144,33 @@ 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): | ||
"""Reset consumable state | ||
|
||
Allowed values: main_brush, side_brush, filter, sensor_dirty | ||
""" | ||
from miio.vacuum import Consumable | ||
if name == 'main_brush': | ||
consumable = Consumable.MainBrush | ||
elif name == 'side_brush': | ||
consumable = Consumable.SideBrush | ||
elif name == 'filter': | ||
consumable = Consumable.Filter | ||
elif name == 'sensor_dirty': | ||
consumable = Consumable.SensorDirty | ||
else: | ||
click.echo("Allowed values: main_brush, side_brush, filter, sensor_dirty") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. line too long (82 > 79 characters) |
||
return | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it makes sense to error out here before returning, if not just to avoid bug reports caused by potential misspellings / name changes. |
||
|
||
click.echo("Resetting consumable '%s': %s" % ( | ||
name, | ||
vac.consumable_reset(consumable) | ||
)) | ||
|
||
|
||
@cli.command() | ||
@pass_dev | ||
def start(vac: miio.Vacuum): | ||
|
There was a problem hiding this comment.
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