roborock-cli 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- roborock_cli/__init__.py +3 -0
- roborock_cli/__main__.py +76 -0
- roborock_cli/_vendor/VERSION +6 -0
- roborock_cli/_vendor/__init__.py +0 -0
- roborock_cli/_vendor/roborock/__init__.py +27 -0
- roborock_cli/_vendor/roborock/broadcast_protocol.py +114 -0
- roborock_cli/_vendor/roborock/callbacks.py +130 -0
- roborock_cli/_vendor/roborock/cli.py +1338 -0
- roborock_cli/_vendor/roborock/const.py +84 -0
- roborock_cli/_vendor/roborock/data/__init__.py +9 -0
- roborock_cli/_vendor/roborock/data/b01_q10/__init__.py +2 -0
- roborock_cli/_vendor/roborock/data/b01_q10/b01_q10_code_mappings.py +213 -0
- roborock_cli/_vendor/roborock/data/b01_q10/b01_q10_containers.py +102 -0
- roborock_cli/_vendor/roborock/data/b01_q7/__init__.py +2 -0
- roborock_cli/_vendor/roborock/data/b01_q7/b01_q7_code_mappings.py +303 -0
- roborock_cli/_vendor/roborock/data/b01_q7/b01_q7_containers.py +302 -0
- roborock_cli/_vendor/roborock/data/code_mappings.py +198 -0
- roborock_cli/_vendor/roborock/data/containers.py +530 -0
- roborock_cli/_vendor/roborock/data/dyad/__init__.py +2 -0
- roborock_cli/_vendor/roborock/data/dyad/dyad_code_mappings.py +102 -0
- roborock_cli/_vendor/roborock/data/dyad/dyad_containers.py +28 -0
- roborock_cli/_vendor/roborock/data/v1/__init__.py +3 -0
- roborock_cli/_vendor/roborock/data/v1/v1_clean_modes.py +192 -0
- roborock_cli/_vendor/roborock/data/v1/v1_code_mappings.py +644 -0
- roborock_cli/_vendor/roborock/data/v1/v1_containers.py +800 -0
- roborock_cli/_vendor/roborock/data/zeo/__init__.py +2 -0
- roborock_cli/_vendor/roborock/data/zeo/zeo_code_mappings.py +138 -0
- roborock_cli/_vendor/roborock/data/zeo/zeo_containers.py +0 -0
- roborock_cli/_vendor/roborock/device_features.py +668 -0
- roborock_cli/_vendor/roborock/devices/README.md +41 -0
- roborock_cli/_vendor/roborock/devices/__init__.py +11 -0
- roborock_cli/_vendor/roborock/devices/cache.py +143 -0
- roborock_cli/_vendor/roborock/devices/device.py +240 -0
- roborock_cli/_vendor/roborock/devices/device_manager.py +269 -0
- roborock_cli/_vendor/roborock/devices/file_cache.py +79 -0
- roborock_cli/_vendor/roborock/devices/rpc/__init__.py +14 -0
- roborock_cli/_vendor/roborock/devices/rpc/a01_channel.py +94 -0
- roborock_cli/_vendor/roborock/devices/rpc/b01_q10_channel.py +57 -0
- roborock_cli/_vendor/roborock/devices/rpc/b01_q7_channel.py +101 -0
- roborock_cli/_vendor/roborock/devices/rpc/v1_channel.py +457 -0
- roborock_cli/_vendor/roborock/devices/traits/__init__.py +28 -0
- roborock_cli/_vendor/roborock/devices/traits/a01/__init__.py +191 -0
- roborock_cli/_vendor/roborock/devices/traits/b01/__init__.py +12 -0
- roborock_cli/_vendor/roborock/devices/traits/b01/q10/__init__.py +76 -0
- roborock_cli/_vendor/roborock/devices/traits/b01/q10/command.py +32 -0
- roborock_cli/_vendor/roborock/devices/traits/b01/q10/common.py +115 -0
- roborock_cli/_vendor/roborock/devices/traits/b01/q10/status.py +32 -0
- roborock_cli/_vendor/roborock/devices/traits/b01/q10/vacuum.py +81 -0
- roborock_cli/_vendor/roborock/devices/traits/b01/q7/__init__.py +136 -0
- roborock_cli/_vendor/roborock/devices/traits/b01/q7/clean_summary.py +75 -0
- roborock_cli/_vendor/roborock/devices/traits/traits_mixin.py +64 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/__init__.py +344 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/child_lock.py +29 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/clean_summary.py +83 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/command.py +38 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/common.py +172 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/consumeable.py +48 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/device_features.py +74 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/do_not_disturb.py +41 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/dust_collection_mode.py +13 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/flow_led_status.py +29 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/home.py +285 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/led_status.py +43 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/map_content.py +83 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/maps.py +80 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/network_info.py +55 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/rooms.py +105 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/routines.py +26 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/smart_wash_params.py +13 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/status.py +101 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/valley_electricity_timer.py +44 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/volume.py +27 -0
- roborock_cli/_vendor/roborock/devices/traits/v1/wash_towel_mode.py +13 -0
- roborock_cli/_vendor/roborock/devices/transport/__init__.py +8 -0
- roborock_cli/_vendor/roborock/devices/transport/channel.py +32 -0
- roborock_cli/_vendor/roborock/devices/transport/local_channel.py +295 -0
- roborock_cli/_vendor/roborock/devices/transport/mqtt_channel.py +118 -0
- roborock_cli/_vendor/roborock/diagnostics.py +166 -0
- roborock_cli/_vendor/roborock/exceptions.py +95 -0
- roborock_cli/_vendor/roborock/map/__init__.py +7 -0
- roborock_cli/_vendor/roborock/map/map_parser.py +123 -0
- roborock_cli/_vendor/roborock/mqtt/__init__.py +10 -0
- roborock_cli/_vendor/roborock/mqtt/health_manager.py +60 -0
- roborock_cli/_vendor/roborock/mqtt/roborock_session.py +463 -0
- roborock_cli/_vendor/roborock/mqtt/session.py +108 -0
- roborock_cli/_vendor/roborock/protocol.py +558 -0
- roborock_cli/_vendor/roborock/protocols/__init__.py +3 -0
- roborock_cli/_vendor/roborock/protocols/a01_protocol.py +74 -0
- roborock_cli/_vendor/roborock/protocols/b01_q10_protocol.py +87 -0
- roborock_cli/_vendor/roborock/protocols/b01_q7_protocol.py +81 -0
- roborock_cli/_vendor/roborock/protocols/v1_protocol.py +271 -0
- roborock_cli/_vendor/roborock/py.typed +0 -0
- roborock_cli/_vendor/roborock/roborock_message.py +246 -0
- roborock_cli/_vendor/roborock/roborock_typing.py +382 -0
- roborock_cli/_vendor/roborock/util.py +54 -0
- roborock_cli/_vendor/roborock/web_api.py +761 -0
- roborock_cli/cli.py +715 -0
- roborock_cli/connection.py +202 -0
- roborock_cli/helpers.py +71 -0
- roborock_cli/server.py +759 -0
- roborock_cli/setup_auth.py +92 -0
- roborock_cli-0.1.1.dist-info/METADATA +172 -0
- roborock_cli-0.1.1.dist-info/RECORD +106 -0
- roborock_cli-0.1.1.dist-info/WHEEL +4 -0
- roborock_cli-0.1.1.dist-info/entry_points.txt +2 -0
- roborock_cli-0.1.1.dist-info/licenses/LICENSE +674 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..code_mappings import RoborockModeEnum
|
|
6
|
+
|
|
7
|
+
if typing.TYPE_CHECKING:
|
|
8
|
+
from roborock_cli._vendor.roborock.device_features import DeviceFeatures
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class 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
|
+
OFF_RAISE_MAIN_BRUSH = ("off_raise_main_brush", 109)
|
|
20
|
+
CUSTOMIZED = ("custom", 106)
|
|
21
|
+
SMART_MODE = ("smart_mode", 110)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class 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)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class VacuumModesOld(RoborockModeEnum):
|
|
35
|
+
QUIET = ("quiet", 38)
|
|
36
|
+
BALANCED = ("balanced", 60)
|
|
37
|
+
TURBO = ("turbo", 75)
|
|
38
|
+
MAX = ("max", 100)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class 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
|
+
MIN = ("min", 205)
|
|
50
|
+
MAX = ("max", 206)
|
|
51
|
+
CUSTOMIZED = ("custom", 204)
|
|
52
|
+
CUSTOM = ("custom_water_flow", 207)
|
|
53
|
+
EXTREME = ("extreme", 208)
|
|
54
|
+
SMART_MODE = ("smart_mode", 209)
|
|
55
|
+
PURE_WATER_FLOW_START = ("slight", 221)
|
|
56
|
+
PURE_WATER_FLOW_SMALL = ("low", 225)
|
|
57
|
+
PURE_WATER_FLOW_MIDDLE = ("medium", 235)
|
|
58
|
+
PURE_WATER_FLOW_LARGE = ("moderate", 245)
|
|
59
|
+
PURE_WATER_SUPER_BEGIN = ("high", 248)
|
|
60
|
+
PURE_WATER_FLOW_END = ("extreme", 250)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class WashTowelModes(RoborockModeEnum):
|
|
64
|
+
SMART = ("smart", 10)
|
|
65
|
+
LIGHT = ("light", 0)
|
|
66
|
+
BALANCED = ("balanced", 1)
|
|
67
|
+
DEEP = ("deep", 2)
|
|
68
|
+
SUPER_DEEP = ("super_deep", 8)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
WATER_SLIDE_MODE_MAPPING: dict[int, WaterModes] = {
|
|
72
|
+
200: WaterModes.OFF,
|
|
73
|
+
221: WaterModes.PURE_WATER_FLOW_START,
|
|
74
|
+
225: WaterModes.PURE_WATER_FLOW_SMALL,
|
|
75
|
+
235: WaterModes.PURE_WATER_FLOW_MIDDLE,
|
|
76
|
+
245: WaterModes.PURE_WATER_FLOW_LARGE,
|
|
77
|
+
248: WaterModes.PURE_WATER_SUPER_BEGIN,
|
|
78
|
+
250: WaterModes.PURE_WATER_FLOW_END,
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def get_wash_towel_modes(features: DeviceFeatures) -> list[WashTowelModes]:
|
|
83
|
+
"""Get the valid wash towel modes for the device"""
|
|
84
|
+
modes = [WashTowelModes.LIGHT, WashTowelModes.BALANCED, WashTowelModes.DEEP]
|
|
85
|
+
if features.is_super_deep_wash_supported and not features.is_dirty_replenish_clean_supported:
|
|
86
|
+
modes.append(WashTowelModes.SUPER_DEEP)
|
|
87
|
+
elif features.is_dirty_replenish_clean_supported:
|
|
88
|
+
modes.append(WashTowelModes.SMART)
|
|
89
|
+
return modes
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def get_clean_modes(features: DeviceFeatures) -> list[VacuumModes]:
|
|
93
|
+
"""Get the valid clean modes for the device - also known as 'fan power' or 'suction mode'"""
|
|
94
|
+
modes = [VacuumModes.QUIET, VacuumModes.BALANCED, VacuumModes.TURBO, VacuumModes.MAX]
|
|
95
|
+
if features.is_max_plus_mode_supported or features.is_none_pure_clean_mop_with_max_plus:
|
|
96
|
+
# If the vacuum has max plus mode supported
|
|
97
|
+
modes.append(VacuumModes.MAX_PLUS)
|
|
98
|
+
if features.is_pure_clean_mop_supported:
|
|
99
|
+
# If the vacuum is capable of 'pure mop clean' aka no vacuum
|
|
100
|
+
if features.is_support_main_brush_up_down_supported:
|
|
101
|
+
modes.append(VacuumModes.OFF_RAISE_MAIN_BRUSH)
|
|
102
|
+
else:
|
|
103
|
+
modes.append(VacuumModes.OFF)
|
|
104
|
+
else:
|
|
105
|
+
# If not, we can add gentle
|
|
106
|
+
modes.append(VacuumModes.GENTLE)
|
|
107
|
+
if features.is_smart_clean_mode_set_supported:
|
|
108
|
+
modes.append(VacuumModes.SMART_MODE)
|
|
109
|
+
if features.is_customized_clean_supported:
|
|
110
|
+
modes.append(VacuumModes.CUSTOMIZED)
|
|
111
|
+
return modes
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def get_clean_routes(features: DeviceFeatures, region: str) -> list[CleanRoutes]:
|
|
115
|
+
"""The routes that the vacuum will take while mopping"""
|
|
116
|
+
if features.is_none_pure_clean_mop_with_max_plus:
|
|
117
|
+
return [CleanRoutes.FAST, CleanRoutes.STANDARD]
|
|
118
|
+
supported = [CleanRoutes.STANDARD, CleanRoutes.DEEP]
|
|
119
|
+
if features.is_careful_slow_mop_supported:
|
|
120
|
+
if not (
|
|
121
|
+
features.is_corner_clean_mode_supported
|
|
122
|
+
and features.is_clean_route_deep_slow_plus_supported
|
|
123
|
+
and region == "cn"
|
|
124
|
+
):
|
|
125
|
+
# for some reason there is a china specific deep plus mode
|
|
126
|
+
supported.append(CleanRoutes.DEEP_PLUS_CN)
|
|
127
|
+
else:
|
|
128
|
+
supported.append(CleanRoutes.DEEP_PLUS)
|
|
129
|
+
|
|
130
|
+
if features.is_clean_route_fast_mode_supported:
|
|
131
|
+
supported.append(CleanRoutes.FAST)
|
|
132
|
+
if features.is_smart_clean_mode_set_supported:
|
|
133
|
+
supported.append(CleanRoutes.SMART_MODE)
|
|
134
|
+
if features.is_customized_clean_supported:
|
|
135
|
+
supported.append(CleanRoutes.CUSTOMIZED)
|
|
136
|
+
|
|
137
|
+
return supported
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def get_water_modes(features: DeviceFeatures) -> list[WaterModes]:
|
|
141
|
+
"""Get the valid water modes for the device - also known as 'water flow' or 'water level'"""
|
|
142
|
+
# Water slide mode supports a separate set of water flow codes.
|
|
143
|
+
if features.is_water_slide_mode_supported:
|
|
144
|
+
return list(WATER_SLIDE_MODE_MAPPING.values())
|
|
145
|
+
|
|
146
|
+
supported_modes = [WaterModes.OFF]
|
|
147
|
+
if features.is_mop_shake_module_supported:
|
|
148
|
+
# For mops that have the vibrating mop pad, they do mild standard intense
|
|
149
|
+
supported_modes.extend([WaterModes.MILD, WaterModes.STANDARD, WaterModes.INTENSE])
|
|
150
|
+
else:
|
|
151
|
+
supported_modes.extend([WaterModes.LOW, WaterModes.MEDIUM, WaterModes.HIGH])
|
|
152
|
+
if features.is_custom_water_box_distance_supported:
|
|
153
|
+
# This is for devices that allow you to set a custom water flow from 0-100
|
|
154
|
+
supported_modes.append(WaterModes.CUSTOM)
|
|
155
|
+
if features.is_mop_shake_module_supported and features.is_mop_shake_water_max_supported:
|
|
156
|
+
supported_modes.append(WaterModes.EXTREME)
|
|
157
|
+
if features.is_smart_clean_mode_set_supported:
|
|
158
|
+
supported_modes.append(WaterModes.SMART_MODE)
|
|
159
|
+
if features.is_customized_clean_supported:
|
|
160
|
+
supported_modes.append(WaterModes.CUSTOMIZED)
|
|
161
|
+
|
|
162
|
+
return supported_modes
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def get_water_mode_mapping(features: DeviceFeatures) -> dict[int, str]:
|
|
166
|
+
"""Get water mode mapping by supported feature set.
|
|
167
|
+
|
|
168
|
+
WaterModes contains aliases for multiple codes that share the same value
|
|
169
|
+
string (e.g. low can be 201 or 225). For water slide mode devices we need
|
|
170
|
+
explicit code mapping to preserve those slide-specific codes.
|
|
171
|
+
"""
|
|
172
|
+
if features.is_water_slide_mode_supported:
|
|
173
|
+
return {code: mode.value for code, mode in WATER_SLIDE_MODE_MAPPING.items()}
|
|
174
|
+
return {mode.code: mode.value for mode in get_water_modes(features)}
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def is_mode_customized(clean_mode: VacuumModes, water_mode: WaterModes, mop_mode: CleanRoutes) -> bool:
|
|
178
|
+
"""Check if any of the cleaning modes are set to a custom value."""
|
|
179
|
+
return (
|
|
180
|
+
clean_mode == VacuumModes.CUSTOMIZED
|
|
181
|
+
or water_mode == WaterModes.CUSTOMIZED
|
|
182
|
+
or mop_mode == CleanRoutes.CUSTOMIZED
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def is_smart_mode_set(water_mode: WaterModes, clean_mode: VacuumModes, mop_mode: CleanRoutes) -> bool:
|
|
187
|
+
"""Check if the smart mode is set for the given water mode and clean mode"""
|
|
188
|
+
return (
|
|
189
|
+
water_mode == WaterModes.SMART_MODE
|
|
190
|
+
or clean_mode == VacuumModes.SMART_MODE
|
|
191
|
+
or mop_mode == CleanRoutes.SMART_MODE
|
|
192
|
+
)
|