Skip to content

Commit

Permalink
Revert "Extend viomi vacuum support"
Browse files Browse the repository at this point in the history
This reverts commit 770baa4.
  • Loading branch information
rytilahti committed Feb 10, 2020
1 parent 770baa4 commit 0352b52
Showing 1 changed file with 33 additions and 38 deletions.
71 changes: 33 additions & 38 deletions miio/viomivacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class ViomiVacuumState(Enum):
Docked = 5


class ViomiMode(Enum):
Vacuum = 0 # No Mop, Vacuum only
VacuumAndMop = 1
Mop = 2
class ViomiMopMode(Enum):
Off = 0 # No Mop, Vacuum only
Mixed = 1
MopOnly = 2


class ViomiLanguage(Enum):
Expand All @@ -58,19 +58,7 @@ class ViomiMovementDirection(Enum):
Right = 3 # Rotate
Backward = 4
Stop = 5
Unknown = 10


class ViomiBinType(Enum):
Vacuum = 1
Water = 2
VacuumAndWater = 3


class ViomiWaterGrade(Enum):
Low = 11
Medium = 12
High = 13
# 10 is unknown


class ViomiVacuumStatus:
Expand All @@ -95,9 +83,9 @@ def is_on(self) -> bool:
def mode(self):
"""Active mode.
TODO: is this same as mop_type property?
TODO: unknown values
"""
return ViomiMode(self.data["mode"])
return self.data["mode"]

@property
def error(self):
Expand All @@ -113,9 +101,18 @@ def battery(self) -> int:
return self.data["battary_life"]

@property
def bin_type(self) -> ViomiBinType:
"""Type of the inserted bin."""
return ViomiBinType(self.data["box_type"])
def box_type(self):
"""Box type.
TODO: unknown values"""
return self.data["box_type"]

@property
def mop_type(self):
"""Mop type.
TODO: unknown values"""
return self.data["mop_type"]

@property
def clean_time(self) -> timedelta:
Expand All @@ -124,7 +121,10 @@ def clean_time(self) -> timedelta:

@property
def clean_area(self) -> float:
"""Cleaned area in square meters."""
"""Cleaned area.
TODO: unknown values
"""
return self.data["s_area"]

@property
Expand All @@ -133,9 +133,12 @@ def fanspeed(self) -> ViomiVacuumSpeed:
return ViomiVacuumSpeed(self.data["suction_grade"])

@property
def water_grade(self) -> ViomiWaterGrade:
"""Water grade."""
return ViomiWaterGrade(self.data["water_grade"])
def water_level(self):
"""Tank's water level.
TODO: unknown values, percentage?
"""
return self.data["water_grade"]

@property
def remember_map(self) -> bool:
Expand All @@ -153,12 +156,9 @@ def has_new_map(self) -> bool:
return bool(self.data["has_newmap"])

@property
def mop_mode(self) -> ViomiMode:
"""Whether mopping is enabled and if so which mode
TODO: is this really the same as mode?
"""
return ViomiMode(self.data["is_mop"])
def mop_mode(self) -> ViomiMopMode:
"""Whether mopping is enabled and if so which mode"""
return ViomiMopMode(self.data["is_mop"])


class ViomiVacuum(Device):
Expand Down Expand Up @@ -227,11 +227,6 @@ def set_fan_speed(self, speed: ViomiVacuumSpeed):
"""Set fanspeed [silent, standard, medium, turbo]."""
self.send("set_suction", [speed.value])

@command(click.argument("watergrade"))
def set_water_grade(self, watergrade: ViomiWaterGrade):
"""Set water grade [low, medium, high]."""
self.send("set_suction", [watergrade.value])

@command()
def home(self):
"""Return to home."""
Expand All @@ -254,7 +249,7 @@ def move(self, direction, duration=0.5):
time.sleep(0.1)
self.send("set_direction", [ViomiMovementDirection.Stop.value])

@command(click.argument("mode", type=EnumType(ViomiMode, False)))
@command(click.argument("mode", type=EnumType(ViomiMopMode, False)))
def mop_mode(self, mode):
"""Set mopping mode."""
self.send("set_mop", [mode.value])
Expand Down

2 comments on commit 0352b52

@merccooper
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

		Error Codes! (at least the ones that i could get): 

                    "code": 500,
		"title": "Radar timed out",
		"detail": "Please make sure the laser radar is not blocked",

		"code": 501,
		"title": "Vacuum-mop's wheels are suspended",
		"detail": "Please place the vacuum-mop on a level surface to start",

		"code": 503,
		"title": "Paused",
		"detail": "Please install the dust compartment or the 2-in-1 dust compartment with water reservoir.",

		"code": 508,
		"title": "Vacuum-mop slope start",
		"detail": "请移到水平地面启动,或在进入设置页标平后重新启动",

		"code": 511,
		"title": "Could not return to dock to charge",
		"detail": "Please return the vacuum-mop to the dock to charge",

		"code": 512,
		"title": "Could not return to dock to charge",
		"detail": "Please return the vacuum-mop to the dock to charge",

		"code": 513,
		"title": "Could not navigate",
		"detail": "Please clear any obstacles around the vacuum-mop and try again",

		"code": 514,
		"title": "Being stuck",
		"detail": "Please clear any obstacles around the vacuum-mop and try again",

		"code": 521,
		"title": "550ml water reservoir has not been installed",
		"detail": "Please install 550ml water tank(sold separately).",

		"code": 522,
		"title": "Mop has not been installed",
		"detail": "Please install the mop and its board.",

		"code": 527,
		"title": "Please remove mop and start cleanup",
		"detail": "Please remove the mop and its board and restart.",

		"code": 509,
		"title": "Cliff sensor error",
		"detail": "Please wipe the cliff sensors clean and move the vacuum-mop to a new location to start.",

		"code": 510,
		"title": "Collision sensor is stuck",
		"detail": "Please remove the any foreign objects and move the vacuum-mop to a new location to start.",

		"code": 516,
		"title": "Vacuum-mop temperature error",
		"detail": "Please wait for the vacuum-mop's temperature to return to normal before using it again.",
		"isError": true

		"code": 515,
		"title": "Charging error",
		"detail": "Please wipe the charging contact points on both the dock and the vacuum-mop clean with a dry cloth.",

		"code": 528,
		"title": "Paused",
		"detail": "Please install the dust compartment or the 2-in-1 dust compartment with water reservoir.",

		"code": 529,
		"title": "Paused",
		"detail": "Please install mop and 550ml water tank(sold separately).",

		"code": 530,
		"title": "Paused",
		"detail": "Please install the 2-in-1 dust compartment with water reservoir and the mop",

		"code": 531,
		"title": "Paused",
		"detail": "Please install the 2-in-1 dust compartment with water reservoir",

		"code": 525,
		"title": "Insufficient water",
		"detail": "Please refill the water reservoir in time",

		"code": 502,
		"title": "Low battery",
		"detail": "Please charge the battery in time",

		"code": 511,
		"title": "Could not return to dock to charge",
		"detail": "Tap here to view the solution",

		"code": 2101,
		"title": "Charging",
		"detail": "When the power reaches 60%, the unfinished cleaning will continue.",

@rytilahti
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I added these to #626

Please sign in to comment.