From a6de89e86b95f0bf160acc88e45d4d070690d9e3 Mon Sep 17 00:00:00 2001 From: anotherdave Date: Sun, 28 Dec 2025 12:09:28 +1300 Subject: [PATCH 1/2] #392 fix wind and water mappings for Q7 Based on actual values sent by Android app 4.54.02, robot firmware V03.01.71 --- roborock/data/b01_q7/b01_q7_code_mappings.py | 16 ++++++++-------- tests/devices/traits/b01/test_init.py | 8 ++++---- tests/test_containers.py | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/roborock/data/b01_q7/b01_q7_code_mappings.py b/roborock/data/b01_q7/b01_q7_code_mappings.py index c0912beb..9d88c8a1 100644 --- a/roborock/data/b01_q7/b01_q7_code_mappings.py +++ b/roborock/data/b01_q7/b01_q7_code_mappings.py @@ -20,19 +20,19 @@ class WorkStatusMapping(RoborockModeEnum): class SCWindMapping(RoborockModeEnum): """Maps suction power levels.""" - SILENCE = ("quiet", 0) - STANDARD = ("balanced", 1) - STRONG = ("turbo", 2) - SUPER_STRONG = ("max", 3) + SILENCE = ("quiet", 1) + STANDARD = ("balanced", 2) + STRONG = ("turbo", 3) + SUPER_STRONG = ("max", 4) + SUPER_STRONG_PLUS = ("max_plus", 5) class WaterLevelMapping(RoborockModeEnum): """Maps water flow levels.""" - LOW = ("low", 0) - MEDIUM = ("medium", 1) - HIGH = ("high", 2) - + LOW = ("low", 1) + MEDIUM = ("medium", 2) + HIGH = ("high", 3) class CleanTypeMapping(RoborockModeEnum): """Maps the type of cleaning (Vacuum, Mop, or both).""" diff --git a/tests/devices/traits/b01/test_init.py b/tests/devices/traits/b01/test_init.py index 5574b1e4..c0277fbd 100644 --- a/tests/devices/traits/b01/test_init.py +++ b/tests/devices/traits/b01/test_init.py @@ -60,10 +60,10 @@ async def test_q7_api_query_values(q7_api: Q7PropertiesApi, fake_channel: FakeCh # We need to construct the expected result based on the mappings # status: 1 -> WAITING_FOR_ORDERS - # wind: 1 -> STANDARD + # wind: 2 -> STANDARD response_data = { "status": 1, - "wind": 1, + "wind": 2, "battery": 100, } @@ -81,10 +81,10 @@ async def test_q7_api_query_values(q7_api: Q7PropertiesApi, fake_channel: FakeCh assert result is not None assert result.status == WorkStatusMapping.WAITING_FOR_ORDERS - # wind might be mapped to SCWindMapping.STANDARD (1) + # wind might be mapped to SCWindMapping.STANDARD (2) # let's verify checking the prop definition in B01Props # wind: SCWindMapping | None = None - # SCWindMapping.STANDARD is 1 ('balanced') + # SCWindMapping.STANDARD is 2 ('balanced') from roborock.data.b01_q7 import SCWindMapping assert result.wind == SCWindMapping.STANDARD diff --git a/tests/test_containers.py b/tests/test_containers.py index 8426ddf4..ba82d9f2 100644 --- a/tests/test_containers.py +++ b/tests/test_containers.py @@ -468,7 +468,7 @@ def test_b01props_deserialization(): assert isinstance(deserialized, B01Props) assert deserialized.fault == B01Fault.F_510 assert deserialized.status == WorkStatusMapping.SWEEP_MOPING_2 - assert deserialized.wind == SCWindMapping.SUPER_STRONG + assert deserialized.wind == SCWindMapping.STRONG assert deserialized.net_status is not None assert deserialized.net_status.ip == "192.168.1.102" From a847696a8cc602329f4c403795fa6234bd31b57b Mon Sep 17 00:00:00 2001 From: anotherdave Date: Mon, 29 Dec 2025 21:07:11 +1300 Subject: [PATCH 2/2] Fix lint --- roborock/data/b01_q7/b01_q7_code_mappings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/roborock/data/b01_q7/b01_q7_code_mappings.py b/roborock/data/b01_q7/b01_q7_code_mappings.py index 9d88c8a1..857b0ca3 100644 --- a/roborock/data/b01_q7/b01_q7_code_mappings.py +++ b/roborock/data/b01_q7/b01_q7_code_mappings.py @@ -34,6 +34,7 @@ class WaterLevelMapping(RoborockModeEnum): MEDIUM = ("medium", 2) HIGH = ("high", 3) + class CleanTypeMapping(RoborockModeEnum): """Maps the type of cleaning (Vacuum, Mop, or both)."""