-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathclean_modes.py
More file actions
113 lines (92 loc) · 3.86 KB
/
clean_modes.py
File metadata and controls
113 lines (92 loc) · 3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
from __future__ import annotations
from enum import StrEnum
from roborock import DeviceFeatures
class RoborockModeEnum(StrEnum):
"""A custom StrEnum that also stores an integer code for each member."""
code: int
def __new__(cls, value: str, code: int) -> RoborockModeEnum:
"""Creates a new enum member."""
member = str.__new__(cls, value)
member._value_ = value
member.code = code
return member
class CleanModes(RoborockModeEnum):
GENTLE = ("gentle", 105)
OFF = ("off", 105)
QUIET = ("quiet", 101)
BALANCED = ("balanced", 102)
TURBO = ("turbo", 103)
MAX = ("max", 104)
MAX_PLUS = ("max_plus", 108)
CUSTOMIZED = ("custom", 106)
SMART_MODE = ("smart_mode", 110)
class CleanRoutes(RoborockModeEnum):
STANDARD = ("standard", 300)
DEEP = ("deep", 301)
DEEP_PLUS = ("deep_plus", 303)
FAST = ("fast", 304)
DEEP_PLUS_CN = ("deep_plus", 305)
SMART_MODE = ("smart_mode", 306)
CUSTOMIZED = ("custom", 302)
class CleanModesOld(RoborockModeEnum):
QUIET = ("quiet", 38)
BALANCED = ("balanced", 60)
TURBO = ("turbo", 75)
MAX = ("max", 100)
class WaterModes(RoborockModeEnum):
OFF = ("off", 200)
LOW = ("low", 201)
MILD = ("mild", 201)
MEDIUM = ("medium", 202)
STANDARD = ("standard", 202)
HIGH = ("high", 203)
INTENSE = ("intense", 203)
CUSTOMIZED = ("custom", 204)
CUSTOM = ("custom_water_flow", 207)
EXTREME = ("extreme", 208)
SMART_MODE = ("smart_mode", 209)
def get_clean_modes(features: DeviceFeatures) -> list[CleanModes]:
"""Get the valid clean modes for the device - also known as 'fan power' or 'suction mode'"""
modes = [CleanModes.QUIET, CleanModes.BALANCED, CleanModes.TURBO, CleanModes.MAX]
if features.is_max_plus_mode_supported or features.is_none_pure_clean_mop_with_max_plus:
# If the vacuum has max plus mode supported
modes.append(CleanModes.MAX_PLUS)
if features.is_pure_clean_mop_supported:
# If the vacuum is capable of 'pure mop clean' aka no vacuum
modes.append(CleanModes.OFF)
else:
# If not, we can add gentle
modes.append(CleanModes.GENTLE)
return modes
def get_clean_routes(features: DeviceFeatures, region: str) -> list[CleanRoutes]:
"""The routes that the vacuum will take while mopping"""
if features.is_none_pure_clean_mop_with_max_plus:
return [CleanRoutes.FAST, CleanRoutes.STANDARD]
supported = [CleanRoutes.STANDARD, CleanRoutes.DEEP]
if features.is_careful_slow_mop_supported:
if not (
features.is_corner_clean_mode_supported
and features.is_clean_route_deep_slow_plus_supported
and region == "CN"
):
# for some reason there is a china specific deep plus mode
supported.append(CleanRoutes.DEEP_PLUS_CN)
else:
supported.append(CleanRoutes.DEEP_PLUS)
if features.is_clean_route_fast_mode_supported:
supported.append(CleanRoutes.FAST)
return supported
def get_water_modes(features: DeviceFeatures) -> list[WaterModes]:
"""Get the valid water modes for the device - also known as 'water flow' or 'water level'"""
supported_modes = [WaterModes.OFF]
if features.is_mop_shake_module_supported:
# For mops that have the vibrating mop pad, they do mild standard intense
supported_modes.extend([WaterModes.MILD, WaterModes.STANDARD, WaterModes.INTENSE])
else:
supported_modes.extend([WaterModes.LOW, WaterModes.MEDIUM, WaterModes.HIGH])
if features.is_custom_water_box_distance_supported:
# This is for devices that allow you to set a custom water flow from 0-100
supported_modes.append(WaterModes.CUSTOM)
if features.is_mop_shake_module_supported and features.is_mop_shake_water_max_supported:
supported_modes.append(WaterModes.EXTREME)
return supported_modes