roborock.data.v1.v1_clean_modes

  1from __future__ import annotations
  2
  3import typing
  4
  5from ..code_mappings import RoborockModeEnum
  6
  7if typing.TYPE_CHECKING:
  8    from roborock.device_features import DeviceFeatures
  9
 10
 11class VacuumModes(RoborockModeEnum):
 12    GENTLE = ("gentle", 105)
 13    OFF = ("off", 105)
 14    QUIET = ("quiet", 101)
 15    BALANCED = ("balanced", 102)
 16    TURBO = ("turbo", 103)
 17    MAX = ("max", 104)
 18    MAX_PLUS = ("max_plus", 108)
 19    CUSTOMIZED = ("custom", 106)
 20    SMART_MODE = ("smart_mode", 110)
 21
 22
 23class CleanRoutes(RoborockModeEnum):
 24    STANDARD = ("standard", 300)
 25    DEEP = ("deep", 301)
 26    DEEP_PLUS = ("deep_plus", 303)
 27    FAST = ("fast", 304)
 28    DEEP_PLUS_CN = ("deep_plus", 305)
 29    SMART_MODE = ("smart_mode", 306)
 30    CUSTOMIZED = ("custom", 302)
 31
 32
 33class VacuumModesOld(RoborockModeEnum):
 34    QUIET = ("quiet", 38)
 35    BALANCED = ("balanced", 60)
 36    TURBO = ("turbo", 75)
 37    MAX = ("max", 100)
 38
 39
 40class WaterModes(RoborockModeEnum):
 41    OFF = ("off", 200)
 42    LOW = ("low", 201)
 43    MILD = ("mild", 201)
 44    MEDIUM = ("medium", 202)
 45    STANDARD = ("standard", 202)
 46    HIGH = ("high", 203)
 47    INTENSE = ("intense", 203)
 48    CUSTOMIZED = ("custom", 204)
 49    CUSTOM = ("custom_water_flow", 207)
 50    EXTREME = ("extreme", 208)
 51    SMART_MODE = ("smart_mode", 209)
 52    PURE_WATER_FLOW_START = ("slight", 221)
 53    PURE_WATER_FLOW_SMALL = ("low", 225)
 54    PURE_WATER_FLOW_MIDDLE = ("medium", 235)
 55    PURE_WATER_FLOW_LARGE = ("moderate", 245)
 56    PURE_WATER_SUPER_BEGIN = ("high", 248)
 57    PURE_WATER_FLOW_END = ("extreme", 250)
 58
 59
 60class WashTowelModes(RoborockModeEnum):
 61    SMART = ("smart", 10)
 62    LIGHT = ("light", 0)
 63    BALANCED = ("balanced", 1)
 64    DEEP = ("deep", 2)
 65    SUPER_DEEP = ("super_deep", 8)
 66
 67
 68def get_wash_towel_modes(features: DeviceFeatures) -> list[WashTowelModes]:
 69    """Get the valid wash towel modes for the device"""
 70    modes = [WashTowelModes.LIGHT, WashTowelModes.BALANCED, WashTowelModes.DEEP]
 71    if features.is_super_deep_wash_supported and not features.is_dirty_replenish_clean_supported:
 72        modes.append(WashTowelModes.SUPER_DEEP)
 73    elif features.is_dirty_replenish_clean_supported:
 74        modes.append(WashTowelModes.SMART)
 75    return modes
 76
 77
 78def get_clean_modes(features: DeviceFeatures) -> list[VacuumModes]:
 79    """Get the valid clean modes for the device - also known as 'fan power' or 'suction mode'"""
 80    modes = [VacuumModes.QUIET, VacuumModes.BALANCED, VacuumModes.TURBO, VacuumModes.MAX]
 81    if features.is_max_plus_mode_supported or features.is_none_pure_clean_mop_with_max_plus:
 82        # If the vacuum has max plus mode supported
 83        modes.append(VacuumModes.MAX_PLUS)
 84    if features.is_pure_clean_mop_supported:
 85        # If the vacuum is capable of 'pure mop clean' aka no vacuum
 86        modes.append(VacuumModes.OFF)
 87    else:
 88        # If not, we can add gentle
 89        modes.append(VacuumModes.GENTLE)
 90    if features.is_smart_clean_mode_set_supported:
 91        modes.append(VacuumModes.SMART_MODE)
 92    if features.is_customized_clean_supported:
 93        modes.append(VacuumModes.CUSTOMIZED)
 94    return modes
 95
 96
 97def get_clean_routes(features: DeviceFeatures, region: str) -> list[CleanRoutes]:
 98    """The routes that the vacuum will take while mopping"""
 99    if features.is_none_pure_clean_mop_with_max_plus:
100        return [CleanRoutes.FAST, CleanRoutes.STANDARD]
101    supported = [CleanRoutes.STANDARD, CleanRoutes.DEEP]
102    if features.is_careful_slow_mop_supported:
103        if not (
104            features.is_corner_clean_mode_supported
105            and features.is_clean_route_deep_slow_plus_supported
106            and region == "cn"
107        ):
108            # for some reason there is a china specific deep plus mode
109            supported.append(CleanRoutes.DEEP_PLUS_CN)
110        else:
111            supported.append(CleanRoutes.DEEP_PLUS)
112
113    if features.is_clean_route_fast_mode_supported:
114        supported.append(CleanRoutes.FAST)
115    if features.is_smart_clean_mode_set_supported:
116        supported.append(CleanRoutes.SMART_MODE)
117    if features.is_customized_clean_supported:
118        supported.append(CleanRoutes.CUSTOMIZED)
119
120    return supported
121
122
123def get_water_modes(features: DeviceFeatures) -> list[WaterModes]:
124    """Get the valid water modes for the device - also known as 'water flow' or 'water level'"""
125    # If the device supports water slide mode, it uses a completely different set of modes. Technically, it can even
126    # support values in between. But for now we will just support the main values.
127    if features.is_water_slide_mode_supported:
128        return [
129            WaterModes.PURE_WATER_FLOW_START,
130            WaterModes.PURE_WATER_FLOW_SMALL,
131            WaterModes.PURE_WATER_FLOW_MIDDLE,
132            WaterModes.PURE_WATER_FLOW_LARGE,
133            WaterModes.PURE_WATER_SUPER_BEGIN,
134            WaterModes.PURE_WATER_FLOW_END,
135        ]
136
137    supported_modes = [WaterModes.OFF]
138    if features.is_mop_shake_module_supported:
139        # For mops that have the vibrating mop pad, they do mild standard intense
140        supported_modes.extend([WaterModes.MILD, WaterModes.STANDARD, WaterModes.INTENSE])
141    else:
142        supported_modes.extend([WaterModes.LOW, WaterModes.MEDIUM, WaterModes.HIGH])
143    if features.is_custom_water_box_distance_supported:
144        # This is for devices that allow you to set a custom water flow from 0-100
145        supported_modes.append(WaterModes.CUSTOM)
146    if features.is_mop_shake_module_supported and features.is_mop_shake_water_max_supported:
147        supported_modes.append(WaterModes.EXTREME)
148    if features.is_smart_clean_mode_set_supported:
149        supported_modes.append(WaterModes.SMART_MODE)
150    if features.is_customized_clean_supported:
151        supported_modes.append(WaterModes.CUSTOMIZED)
152
153    return supported_modes
154
155
156def is_mode_customized(clean_mode: VacuumModes, water_mode: WaterModes, mop_mode: CleanRoutes) -> bool:
157    """Check if any of the cleaning modes are set to a custom value."""
158    return (
159        clean_mode == VacuumModes.CUSTOMIZED
160        or water_mode == WaterModes.CUSTOMIZED
161        or mop_mode == CleanRoutes.CUSTOMIZED
162    )
163
164
165def is_smart_mode_set(water_mode: WaterModes, clean_mode: VacuumModes, mop_mode: CleanRoutes) -> bool:
166    """Check if the smart mode is set for the given water mode and clean mode"""
167    return (
168        water_mode == WaterModes.SMART_MODE
169        or clean_mode == VacuumModes.SMART_MODE
170        or mop_mode == CleanRoutes.SMART_MODE
171    )
class VacuumModes(roborock.data.code_mappings.RoborockModeEnum):
12class VacuumModes(RoborockModeEnum):
13    GENTLE = ("gentle", 105)
14    OFF = ("off", 105)
15    QUIET = ("quiet", 101)
16    BALANCED = ("balanced", 102)
17    TURBO = ("turbo", 103)
18    MAX = ("max", 104)
19    MAX_PLUS = ("max_plus", 108)
20    CUSTOMIZED = ("custom", 106)
21    SMART_MODE = ("smart_mode", 110)

A custom StrEnum that also stores an integer code for each member.

GENTLE = <VacuumModes.GENTLE: 'gentle'>
OFF = <VacuumModes.OFF: 'off'>
QUIET = <VacuumModes.QUIET: 'quiet'>
BALANCED = <VacuumModes.BALANCED: 'balanced'>
TURBO = <VacuumModes.TURBO: 'turbo'>
MAX = <VacuumModes.MAX: 'max'>
MAX_PLUS = <VacuumModes.MAX_PLUS: 'max_plus'>
CUSTOMIZED = <VacuumModes.CUSTOMIZED: 'custom'>
SMART_MODE = <VacuumModes.SMART_MODE: 'smart_mode'>
class CleanRoutes(roborock.data.code_mappings.RoborockModeEnum):
24class CleanRoutes(RoborockModeEnum):
25    STANDARD = ("standard", 300)
26    DEEP = ("deep", 301)
27    DEEP_PLUS = ("deep_plus", 303)
28    FAST = ("fast", 304)
29    DEEP_PLUS_CN = ("deep_plus", 305)
30    SMART_MODE = ("smart_mode", 306)
31    CUSTOMIZED = ("custom", 302)

A custom StrEnum that also stores an integer code for each member.

STANDARD = <CleanRoutes.STANDARD: 'standard'>
DEEP = <CleanRoutes.DEEP: 'deep'>
DEEP_PLUS = <CleanRoutes.DEEP_PLUS: 'deep_plus'>
FAST = <CleanRoutes.FAST: 'fast'>
DEEP_PLUS_CN = <CleanRoutes.DEEP_PLUS: 'deep_plus'>
SMART_MODE = <CleanRoutes.SMART_MODE: 'smart_mode'>
CUSTOMIZED = <CleanRoutes.CUSTOMIZED: 'custom'>
class VacuumModesOld(roborock.data.code_mappings.RoborockModeEnum):
34class VacuumModesOld(RoborockModeEnum):
35    QUIET = ("quiet", 38)
36    BALANCED = ("balanced", 60)
37    TURBO = ("turbo", 75)
38    MAX = ("max", 100)

A custom StrEnum that also stores an integer code for each member.

QUIET = <VacuumModesOld.QUIET: 'quiet'>
BALANCED = <VacuumModesOld.BALANCED: 'balanced'>
TURBO = <VacuumModesOld.TURBO: 'turbo'>
MAX = <VacuumModesOld.MAX: 'max'>
class WaterModes(roborock.data.code_mappings.RoborockModeEnum):
41class WaterModes(RoborockModeEnum):
42    OFF = ("off", 200)
43    LOW = ("low", 201)
44    MILD = ("mild", 201)
45    MEDIUM = ("medium", 202)
46    STANDARD = ("standard", 202)
47    HIGH = ("high", 203)
48    INTENSE = ("intense", 203)
49    CUSTOMIZED = ("custom", 204)
50    CUSTOM = ("custom_water_flow", 207)
51    EXTREME = ("extreme", 208)
52    SMART_MODE = ("smart_mode", 209)
53    PURE_WATER_FLOW_START = ("slight", 221)
54    PURE_WATER_FLOW_SMALL = ("low", 225)
55    PURE_WATER_FLOW_MIDDLE = ("medium", 235)
56    PURE_WATER_FLOW_LARGE = ("moderate", 245)
57    PURE_WATER_SUPER_BEGIN = ("high", 248)
58    PURE_WATER_FLOW_END = ("extreme", 250)

A custom StrEnum that also stores an integer code for each member.

OFF = <WaterModes.OFF: 'off'>
LOW = <WaterModes.LOW: 'low'>
MILD = <WaterModes.MILD: 'mild'>
MEDIUM = <WaterModes.MEDIUM: 'medium'>
STANDARD = <WaterModes.STANDARD: 'standard'>
HIGH = <WaterModes.HIGH: 'high'>
INTENSE = <WaterModes.INTENSE: 'intense'>
CUSTOMIZED = <WaterModes.CUSTOMIZED: 'custom'>
CUSTOM = <WaterModes.CUSTOM: 'custom_water_flow'>
EXTREME = <WaterModes.EXTREME: 'extreme'>
SMART_MODE = <WaterModes.SMART_MODE: 'smart_mode'>
PURE_WATER_FLOW_START = <WaterModes.PURE_WATER_FLOW_START: 'slight'>
PURE_WATER_FLOW_SMALL = <WaterModes.LOW: 'low'>
PURE_WATER_FLOW_MIDDLE = <WaterModes.MEDIUM: 'medium'>
PURE_WATER_FLOW_LARGE = <WaterModes.PURE_WATER_FLOW_LARGE: 'moderate'>
PURE_WATER_SUPER_BEGIN = <WaterModes.HIGH: 'high'>
PURE_WATER_FLOW_END = <WaterModes.EXTREME: 'extreme'>
class WashTowelModes(roborock.data.code_mappings.RoborockModeEnum):
61class WashTowelModes(RoborockModeEnum):
62    SMART = ("smart", 10)
63    LIGHT = ("light", 0)
64    BALANCED = ("balanced", 1)
65    DEEP = ("deep", 2)
66    SUPER_DEEP = ("super_deep", 8)

A custom StrEnum that also stores an integer code for each member.

SMART = <WashTowelModes.SMART: 'smart'>
LIGHT = <WashTowelModes.LIGHT: 'light'>
BALANCED = <WashTowelModes.BALANCED: 'balanced'>
DEEP = <WashTowelModes.DEEP: 'deep'>
SUPER_DEEP = <WashTowelModes.SUPER_DEEP: 'super_deep'>
def get_wash_towel_modes( features: roborock.device_features.DeviceFeatures) -> list[WashTowelModes]:
69def get_wash_towel_modes(features: DeviceFeatures) -> list[WashTowelModes]:
70    """Get the valid wash towel modes for the device"""
71    modes = [WashTowelModes.LIGHT, WashTowelModes.BALANCED, WashTowelModes.DEEP]
72    if features.is_super_deep_wash_supported and not features.is_dirty_replenish_clean_supported:
73        modes.append(WashTowelModes.SUPER_DEEP)
74    elif features.is_dirty_replenish_clean_supported:
75        modes.append(WashTowelModes.SMART)
76    return modes

Get the valid wash towel modes for the device

def get_clean_modes( features: roborock.device_features.DeviceFeatures) -> list[VacuumModes]:
79def get_clean_modes(features: DeviceFeatures) -> list[VacuumModes]:
80    """Get the valid clean modes for the device - also known as 'fan power' or 'suction mode'"""
81    modes = [VacuumModes.QUIET, VacuumModes.BALANCED, VacuumModes.TURBO, VacuumModes.MAX]
82    if features.is_max_plus_mode_supported or features.is_none_pure_clean_mop_with_max_plus:
83        # If the vacuum has max plus mode supported
84        modes.append(VacuumModes.MAX_PLUS)
85    if features.is_pure_clean_mop_supported:
86        # If the vacuum is capable of 'pure mop clean' aka no vacuum
87        modes.append(VacuumModes.OFF)
88    else:
89        # If not, we can add gentle
90        modes.append(VacuumModes.GENTLE)
91    if features.is_smart_clean_mode_set_supported:
92        modes.append(VacuumModes.SMART_MODE)
93    if features.is_customized_clean_supported:
94        modes.append(VacuumModes.CUSTOMIZED)
95    return modes

Get the valid clean modes for the device - also known as 'fan power' or 'suction mode'

def get_clean_routes( features: roborock.device_features.DeviceFeatures, region: str) -> list[CleanRoutes]:
 98def get_clean_routes(features: DeviceFeatures, region: str) -> list[CleanRoutes]:
 99    """The routes that the vacuum will take while mopping"""
100    if features.is_none_pure_clean_mop_with_max_plus:
101        return [CleanRoutes.FAST, CleanRoutes.STANDARD]
102    supported = [CleanRoutes.STANDARD, CleanRoutes.DEEP]
103    if features.is_careful_slow_mop_supported:
104        if not (
105            features.is_corner_clean_mode_supported
106            and features.is_clean_route_deep_slow_plus_supported
107            and region == "cn"
108        ):
109            # for some reason there is a china specific deep plus mode
110            supported.append(CleanRoutes.DEEP_PLUS_CN)
111        else:
112            supported.append(CleanRoutes.DEEP_PLUS)
113
114    if features.is_clean_route_fast_mode_supported:
115        supported.append(CleanRoutes.FAST)
116    if features.is_smart_clean_mode_set_supported:
117        supported.append(CleanRoutes.SMART_MODE)
118    if features.is_customized_clean_supported:
119        supported.append(CleanRoutes.CUSTOMIZED)
120
121    return supported

The routes that the vacuum will take while mopping

def get_water_modes( features: roborock.device_features.DeviceFeatures) -> list[WaterModes]:
124def get_water_modes(features: DeviceFeatures) -> list[WaterModes]:
125    """Get the valid water modes for the device - also known as 'water flow' or 'water level'"""
126    # If the device supports water slide mode, it uses a completely different set of modes. Technically, it can even
127    # support values in between. But for now we will just support the main values.
128    if features.is_water_slide_mode_supported:
129        return [
130            WaterModes.PURE_WATER_FLOW_START,
131            WaterModes.PURE_WATER_FLOW_SMALL,
132            WaterModes.PURE_WATER_FLOW_MIDDLE,
133            WaterModes.PURE_WATER_FLOW_LARGE,
134            WaterModes.PURE_WATER_SUPER_BEGIN,
135            WaterModes.PURE_WATER_FLOW_END,
136        ]
137
138    supported_modes = [WaterModes.OFF]
139    if features.is_mop_shake_module_supported:
140        # For mops that have the vibrating mop pad, they do mild standard intense
141        supported_modes.extend([WaterModes.MILD, WaterModes.STANDARD, WaterModes.INTENSE])
142    else:
143        supported_modes.extend([WaterModes.LOW, WaterModes.MEDIUM, WaterModes.HIGH])
144    if features.is_custom_water_box_distance_supported:
145        # This is for devices that allow you to set a custom water flow from 0-100
146        supported_modes.append(WaterModes.CUSTOM)
147    if features.is_mop_shake_module_supported and features.is_mop_shake_water_max_supported:
148        supported_modes.append(WaterModes.EXTREME)
149    if features.is_smart_clean_mode_set_supported:
150        supported_modes.append(WaterModes.SMART_MODE)
151    if features.is_customized_clean_supported:
152        supported_modes.append(WaterModes.CUSTOMIZED)
153
154    return supported_modes

Get the valid water modes for the device - also known as 'water flow' or 'water level'

def is_mode_customized( clean_mode: VacuumModes, water_mode: WaterModes, mop_mode: CleanRoutes) -> bool:
157def is_mode_customized(clean_mode: VacuumModes, water_mode: WaterModes, mop_mode: CleanRoutes) -> bool:
158    """Check if any of the cleaning modes are set to a custom value."""
159    return (
160        clean_mode == VacuumModes.CUSTOMIZED
161        or water_mode == WaterModes.CUSTOMIZED
162        or mop_mode == CleanRoutes.CUSTOMIZED
163    )

Check if any of the cleaning modes are set to a custom value.

def is_smart_mode_set( water_mode: WaterModes, clean_mode: VacuumModes, mop_mode: CleanRoutes) -> bool:
166def is_smart_mode_set(water_mode: WaterModes, clean_mode: VacuumModes, mop_mode: CleanRoutes) -> bool:
167    """Check if the smart mode is set for the given water mode and clean mode"""
168    return (
169        water_mode == WaterModes.SMART_MODE
170        or clean_mode == VacuumModes.SMART_MODE
171        or mop_mode == CleanRoutes.SMART_MODE
172    )

Check if the smart mode is set for the given water mode and clean mode