Skip to content

Commit 8d4902b

Browse files
authored
feat: add support for roborock qrevo maxv code mappings (#385)
* test: fix typo in util test name * fix: correct keepalive log message * fix: correct typos in log messages * feat: add Qrevo MaxV code mappings
1 parent 150de05 commit 8d4902b

File tree

6 files changed

+49
-6
lines changed

6 files changed

+49
-6
lines changed

roborock/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def should_keepalive(self) -> bool:
8585

8686
async def validate_connection(self) -> None:
8787
if not self.should_keepalive():
88-
self._logger.info("Resetting Roborock connection due to kepalive timeout")
88+
self._logger.info("Resetting Roborock connection due to keepalive timeout")
8989
await self.async_disconnect()
9090
await self.async_connect()
9191

roborock/code_mappings.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,17 @@ class RoborockFanSpeedQRevoCurv(RoborockFanPowerCode):
267267
smart_mode = 110
268268

269269

270+
class RoborockFanSpeedQRevoMaxV(RoborockFanPowerCode):
271+
off = 105
272+
quiet = 101
273+
balanced = 102
274+
turbo = 103
275+
max = 104
276+
custom = 106
277+
max_plus = 108
278+
smart_mode = 110
279+
280+
270281
class RoborockFanSpeedP10(RoborockFanPowerCode):
271282
off = 105
272283
quiet = 101
@@ -275,6 +286,7 @@ class RoborockFanSpeedP10(RoborockFanPowerCode):
275286
max = 104
276287
custom = 106
277288
max_plus = 108
289+
smart_mode = 110
278290

279291

280292
class RoborockFanSpeedS8MaxVUltra(RoborockFanPowerCode):
@@ -316,6 +328,7 @@ class RoborockMopModeS8ProUltra(RoborockMopModeCode):
316328
deep_plus = 303
317329
fast = 304
318330
custom = 302
331+
smart_mode = 306
319332

320333

321334
class RoborockMopModeS8MaxVUltra(RoborockMopModeCode):
@@ -337,6 +350,15 @@ class RoborockMopModeQRevoMaster(RoborockMopModeCode):
337350
smart_mode = 306
338351

339352

353+
class RoborockMopModeQRevoMaxV(RoborockMopModeCode):
354+
standard = 300
355+
deep = 301
356+
custom = 302
357+
deep_plus = 303
358+
fast = 304
359+
smart_mode = 306
360+
361+
340362
class RoborockMopIntensityCode(RoborockEnum):
341363
"""Describes the mop intensity of the vacuum cleaner."""
342364

@@ -383,6 +405,16 @@ class RoborockMopIntensityQRevoCurv(RoborockMopIntensityCode):
383405
smart_mode = 209
384406

385407

408+
class RoborockMopIntensityQRevoMaxV(RoborockMopIntensityCode):
409+
off = 200
410+
low = 201
411+
medium = 202
412+
high = 203
413+
custom = 204
414+
custom_water_flow = 207
415+
smart_mode = 209
416+
417+
386418
class RoborockMopIntensityP10(RoborockMopIntensityCode):
387419
"""Describes the mop intensity of the vacuum cleaner."""
388420

@@ -392,6 +424,7 @@ class RoborockMopIntensityP10(RoborockMopIntensityCode):
392424
high = 203
393425
custom = 204
394426
custom_water_flow = 207
427+
smart_mode = 209
395428

396429

397430
class RoborockMopIntensityS8MaxVUltra(RoborockMopIntensityCode):

roborock/containers.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
RoborockFanSpeedQ7Max,
2323
RoborockFanSpeedQRevoCurv,
2424
RoborockFanSpeedQRevoMaster,
25+
RoborockFanSpeedQRevoMaxV,
2526
RoborockFanSpeedS6Pure,
2627
RoborockFanSpeedS7,
2728
RoborockFanSpeedS7MaxV,
@@ -33,13 +34,15 @@
3334
RoborockMopIntensityQ7Max,
3435
RoborockMopIntensityQRevoCurv,
3536
RoborockMopIntensityQRevoMaster,
37+
RoborockMopIntensityQRevoMaxV,
3638
RoborockMopIntensityS5Max,
3739
RoborockMopIntensityS6MaxV,
3840
RoborockMopIntensityS7,
3941
RoborockMopIntensityS8MaxVUltra,
4042
RoborockMopModeCode,
4143
RoborockMopModeQRevoCurv,
4244
RoborockMopModeQRevoMaster,
45+
RoborockMopModeQRevoMaxV,
4346
RoborockMopModeS7,
4447
RoborockMopModeS8MaxVUltra,
4548
RoborockMopModeS8ProUltra,
@@ -599,6 +602,13 @@ class QRevoCurvStatus(Status):
599602
mop_mode: RoborockMopModeQRevoCurv | None = None
600603

601604

605+
@dataclass
606+
class QRevoMaxVStatus(Status):
607+
fan_power: RoborockFanSpeedQRevoMaxV | None = None
608+
water_box_mode: RoborockMopIntensityQRevoMaxV | None = None
609+
mop_mode: RoborockMopModeQRevoMaxV | None = None
610+
611+
602612
@dataclass
603613
class S6MaxVStatus(Status):
604614
fan_power: RoborockFanSpeedS7MaxV | None = None
@@ -672,7 +682,7 @@ class S8MaxvUltraStatus(Status):
672682
# but i am currently unable to do my typical reverse engineering/ get any data from users on this,
673683
# so this will be here in the mean time.
674684
ROBOROCK_QREVO_S: P10Status,
675-
ROBOROCK_QREVO_MAXV: P10Status,
685+
ROBOROCK_QREVO_MAXV: QRevoMaxVStatus,
676686
ROBOROCK_QREVO_PRO: P10Status,
677687
ROBOROCK_S8_MAXV_ULTRA: S8MaxvUltraStatus,
678688
}

roborock/mqtt/roborock_session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ async def _run_task(self, start_future: asyncio.Future[None] | None) -> None:
118118
if start_future:
119119
_LOGGER.debug("MQTT loop was cancelled")
120120
start_future.set_exception(err)
121-
_LOGGER.debug("MQTT loop was cancelled whiel starting")
121+
_LOGGER.debug("MQTT loop was cancelled while starting")
122122
return
123123
# Catch exceptions to avoid crashing the loop
124124
# and to allow the loop to retry.
@@ -160,7 +160,7 @@ async def _mqtt_client(self, params: MqttParams) -> aiomqtt.Client:
160160
async with self._client_lock:
161161
self._client = client
162162
for topic in self._listeners:
163-
_LOGGER.debug("Re-establising subscription to topic %s", topic)
163+
_LOGGER.debug("Re-establishing subscription to topic %s", topic)
164164
# TODO: If this fails it will break the whole connection. Make
165165
# this retry again in the background with backoff.
166166
await client.subscribe(topic)

tests/mqtt_packet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def gen_publish(
111111
properties = prop_finalise(properties)
112112
rl += len(properties)
113113
# This will break if len(properties) > 127
114-
pack_format = pack_format + "%ds" % (len(properties))
114+
pack_format = f"{pack_format}{len(properties)}s"
115115

116116
if payload is not None:
117117
# payload = payload.encode("utf-8")

tests/test_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_start_date_lower_than_now_lower_than_end_date():
2121

2222

2323
# start_date > now > end_date
24-
def test_start_date_greater_than_now_greater_tat_end_date():
24+
def test_start_date_greater_than_now_greater_than_end_date():
2525
start, end = parse_time_to_datetime(
2626
(datetime.datetime.now() + datetime.timedelta(hours=1)).time(),
2727
(datetime.datetime.now() + datetime.timedelta(hours=2)).time(),

0 commit comments

Comments
 (0)