-
-
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 1 commit
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 |
---|---|---|
|
@@ -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"] | ||
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 (108 > 79 characters) |
||
return self.send("reset_consumable", [name]) | ||
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. Do you happen to know if multiple consumables can be reseted at once? 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 not tried this case on my robo. |
||
|
||
def map(self): | ||
"""Return map token.""" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
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. "Reseting consumable '%s'" would look here nicer. |
||
vac.consumable_reset(name) | ||
|
||
|
||
@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.
line too long (108 > 79 characters)
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.
Could you create a
Consumable
enum, and use it instead of passing strings around. See https://github.com/rytilahti/python-miio/blob/master/miio/vacuum.py#L20 (and its use in https://github.com/rytilahti/python-miio/blob/master/miio/vacuum.py#L164) for example.We do not need to follow their naming scheme either, I think it makes sense here to go for the same naming as in
ConsumableStatus
(https://github.com/rytilahti/python-miio/blob/master/miio/vacuumcontainers.py#L284).