@@ -68,6 +68,17 @@ class WashTowelModes(RoborockModeEnum):
6868 SUPER_DEEP = ("super_deep" , 8 )
6969
7070
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+
7182def get_wash_towel_modes (features : DeviceFeatures ) -> list [WashTowelModes ]:
7283 """Get the valid wash towel modes for the device"""
7384 modes = [WashTowelModes .LIGHT , WashTowelModes .BALANCED , WashTowelModes .DEEP ]
@@ -128,17 +139,9 @@ def get_clean_routes(features: DeviceFeatures, region: str) -> list[CleanRoutes]
128139
129140def get_water_modes (features : DeviceFeatures ) -> list [WaterModes ]:
130141 """Get the valid water modes for the device - also known as 'water flow' or 'water level'"""
131- # If the device supports water slide mode, it uses a completely different set of modes. Technically, it can even
132- # support values in between. But for now we will just support the main values.
142+ # Water slide mode supports a separate set of water flow codes.
133143 if features .is_water_slide_mode_supported :
134- return [
135- WaterModes .PURE_WATER_FLOW_START ,
136- WaterModes .PURE_WATER_FLOW_SMALL ,
137- WaterModes .PURE_WATER_FLOW_MIDDLE ,
138- WaterModes .PURE_WATER_FLOW_LARGE ,
139- WaterModes .PURE_WATER_SUPER_BEGIN ,
140- WaterModes .PURE_WATER_FLOW_END ,
141- ]
144+ return list (WATER_SLIDE_MODE_MAPPING .values ())
142145
143146 supported_modes = [WaterModes .OFF ]
144147 if features .is_mop_shake_module_supported :
@@ -159,6 +162,18 @@ def get_water_modes(features: DeviceFeatures) -> list[WaterModes]:
159162 return supported_modes
160163
161164
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+
162177def is_mode_customized (clean_mode : VacuumModes , water_mode : WaterModes , mop_mode : CleanRoutes ) -> bool :
163178 """Check if any of the cleaning modes are set to a custom value."""
164179 return (
0 commit comments