From 0c541aa40fa4f8e3e9146830e2c2018f14f55c6b Mon Sep 17 00:00:00 2001 From: Teemu R Date: Fri, 3 Jul 2020 18:15:42 +0200 Subject: [PATCH] viomi: add ability to change the mopping pattern (#744) * mop_mode command allows now changing between S and Y patterns * old mop_mode command has been renamed to clean_mode which is more suitable name Fixes #725 --- miio/viomivacuum.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/miio/viomivacuum.py b/miio/viomivacuum.py index 3d5270ee4..1d136e457 100644 --- a/miio/viomivacuum.py +++ b/miio/viomivacuum.py @@ -100,6 +100,13 @@ class ViomiWaterGrade(Enum): High = 13 +class ViomiMopMode(Enum): + """Mopping pattern.""" + + S = 0 + Y = 1 + + class ViomiVacuumStatus: def __init__(self, data): # ["run_state","mode","err_state","battary_life","box_type","mop_type","s_time","s_area", @@ -293,10 +300,14 @@ def move(self, direction, duration=0.5): self.send("set_direction", [ViomiMovementDirection.Stop.value]) @command(click.argument("mode", type=EnumType(ViomiMode, False))) - def mop_mode(self, mode): - """Set mopping mode.""" + def clean_mode(self, mode): + """Set the cleaning mode.""" self.send("set_mop", [mode.value]) + @command(click.argument("mop_mode", type=EnumType(ViomiMopMode, False))) + def mop_mode(self, mop_mode): + self.send("set_moproute", [mop_mode.value]) + @command() def dnd_status(self): """Returns do-not-disturb status."""