Skip to content

Commit 01f84ae

Browse files
fix: S6MaxVStatus and minor changes
1 parent ac430d5 commit 01f84ae

File tree

6 files changed

+21
-18
lines changed

6 files changed

+21
-18
lines changed

roborock/api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
QUEUE_TIMEOUT = 4
6060
COMMANDS_SECURED = [
6161
RoborockCommand.GET_MAP_V1,
62+
RoborockCommand.GET_MULTI_MAP,
6263
]
6364

6465

@@ -149,7 +150,7 @@ def on_message_received(self, messages: list[RoborockMessage]) -> None:
149150
queue.resolve((result, None))
150151
elif data.payload and protocol == 301:
151152
payload = data.payload[0:24]
152-
[endpoint, _, request_id, _] = struct.unpack("<15sBH6s", payload)
153+
[endpoint, _, request_id, _] = struct.unpack("<8s8sH6s", payload)
153154
if endpoint.decode().startswith(self._endpoint):
154155
decrypted = Utils.decrypt_cbc(data.payload[24:], self._nonce)
155156
decompressed = Utils.decompress(decrypted)

roborock/code_mappings.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,11 @@ class RoborockFanSpeedV3(RoborockFanPowerCode):
131131

132132

133133
class RoborockFanSpeedE2(RoborockFanPowerCode):
134-
quiet = 101
135-
balanced = 102
136-
turbo = 103
137-
max = 104
138-
gentle = 105
134+
gentle = 41
135+
silent = 50
136+
standard = 68
137+
medium = 79
138+
turbo = 100
139139

140140

141141
class RoborockFanSpeedS7(RoborockFanPowerCode):

roborock/containers.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
RoborockDockWashTowelModeCode,
1616
RoborockErrorCode,
1717
RoborockFanPowerCode,
18-
RoborockFanSpeedE2,
1918
RoborockFanSpeedQ7Max,
2019
RoborockFanSpeedS6Pure,
2120
RoborockFanSpeedS7,
@@ -284,8 +283,8 @@ class Q7MaxStatus(Status):
284283

285284
@dataclass
286285
class S6MaxVStatus(Status):
287-
fan_power: Optional[RoborockFanSpeedE2] = None
288-
water_box_mode: Optional[RoborockMopIntensityV2] = None
286+
fan_power: Optional[RoborockFanSpeedS7MaxV] = None
287+
water_box_mode: Optional[RoborockMopIntensityS7] = None
289288

290289

291290
@dataclass

roborock/local_api.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from .exceptions import CommandVacuumError, RoborockConnectionException, RoborockException
1313
from .protocol import MessageParser
1414
from .roborock_message import RoborockMessage, RoborockMessageProtocol
15-
from .roborock_typing import CommandInfoMap, RoborockCommand
15+
from .roborock_typing import RoborockCommand
1616
from .util import get_running_loop_or_create_one
1717

1818
_LOGGER = logging.getLogger(__name__)
@@ -87,12 +87,6 @@ def build_roborock_message(self, method: RoborockCommand, params: Optional[list
8787
secured = True if method in COMMANDS_SECURED else False
8888
request_id, timestamp, payload = self._get_payload(method, params, secured)
8989
_LOGGER.debug(f"id={request_id} Requesting method {method} with {params}")
90-
command_info = CommandInfoMap.get(method)
91-
if not command_info:
92-
raise RoborockException(f"Request {method} have unknown prefix. Can't execute in offline mode")
93-
command = CommandInfoMap.get(method)
94-
if command is None:
95-
raise RoborockException(f"No prefix found for {method}")
9690
request_protocol = 4
9791
return RoborockMessage(
9892
timestamp=timestamp,

roborock/roborock_message.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ class RoborockMessage:
2828
timestamp: int = math.floor(time.time())
2929

3030
def get_request_id(self) -> int | None:
31-
protocol = self.protocol
32-
if self.payload and protocol in [4, 101, 102]:
31+
if self.payload:
3332
payload = json.loads(self.payload.decode())
3433
for data_point_number, data_point in payload.get("dps").items():
3534
if data_point_number in ["101", "102"]:

roborock/roborock_typing.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,16 @@ class RoborockCommand(str, Enum):
127127
UPD_SERVER_TIMER = "upd_server_timer"
128128

129129

130+
CacheableCommands = [
131+
attribute
132+
for attribute in [
133+
command.removeprefix("get_").removeprefix("set_").removeprefix("change_").upper() for command in RoborockCommand
134+
]
135+
if "GET_" + attribute in RoborockCommand.__members__
136+
and ("SET_" + attribute in RoborockCommand.__members__ or "CHANGE_" + attribute in RoborockCommand.__members__)
137+
]
138+
139+
130140
@dataclass
131141
class CommandInfo:
132142
params: Optional[list | dict] = None

0 commit comments

Comments
 (0)