diff --git a/docs/V1_DEVICE_FEATURES.md b/docs/V1_DEVICE_FEATURES.md index f9b0b9e10..be4a7141b 100644 --- a/docs/V1_DEVICE_FEATURES.md +++ b/docs/V1_DEVICE_FEATURES.md @@ -1296,7 +1296,8 @@ These features are enabled/disabled based on specific device model whitelists or --- ### is_soft_clean_mode_supported -**Model Whitelist:** TANOSV, TANOSE, TANOS +**Model Whitelist:** TANOSV, TANOSE, TANOS, RUBYSC, RUBYSLITE, RUBYSE +**Source:** Roborock app `isSoftCleanModeSupportedInMain` **Feature:** Soft Clean Mode **Description:** Gentle cleaning mode for delicate floors. **Impact:** Reduced suction and brush speed for sensitive surfaces. @@ -1304,7 +1305,8 @@ These features are enabled/disabled based on specific device model whitelists or --- ### is_custom_mode_supported -**Model Blacklist:** TANOS (all except TANOS) +**Model Blacklist:** TANOS, RUBYPLUS, RUBYSC, RUBYSE (all except these) +**Source:** Roborock app `isCustomModeSupported` **Feature:** Custom Cleaning Mode **Description:** User-defined custom cleaning modes. **Impact:** Create personalized cleaning modes with specific parameters. diff --git a/roborock/data/v1/v1_clean_modes.py b/roborock/data/v1/v1_clean_modes.py index 7d1e1fe05..2ba52e380 100644 --- a/roborock/data/v1/v1_clean_modes.py +++ b/roborock/data/v1/v1_clean_modes.py @@ -131,16 +131,8 @@ def get_clean_modes(features: DeviceFeatures) -> list[VacuumModes]: if features.is_max_plus_mode_supported or features.is_none_pure_clean_mop_with_max_plus: # If the vacuum has max plus mode supported modes.append(VacuumModes.MAX_PLUS) - if features.is_pure_clean_mop_supported: - # If the vacuum is capable of 'pure mop clean' aka no vacuum - modes.append(VacuumModes.OFF) - else: - # If not, we can add gentle + if features.is_soft_clean_mode_supported: modes.append(VacuumModes.GENTLE) - if features.is_smart_clean_mode_set_supported: - modes.append(VacuumModes.SMART_MODE) - if features.is_customized_clean_supported: - modes.append(VacuumModes.CUSTOMIZED) return modes @@ -165,10 +157,6 @@ def get_clean_routes(features: DeviceFeatures, region: str) -> list[CleanRoutes] if features.is_clean_route_fast_mode_supported: supported.append(CleanRoutes.FAST) - if features.is_smart_clean_mode_set_supported: - supported.append(CleanRoutes.SMART_MODE) - if features.is_customized_clean_supported: - supported.append(CleanRoutes.CUSTOMIZED) return supported @@ -190,14 +178,54 @@ def get_water_modes(features: DeviceFeatures) -> list[WaterModes]: supported_modes.append(WaterModes.CUSTOM) if features.is_mop_shake_module_supported and features.is_mop_shake_water_max_supported: supported_modes.append(WaterModes.EXTREME) - if features.is_smart_clean_mode_set_supported: - supported_modes.append(WaterModes.SMART_MODE) - if features.is_customized_clean_supported: - supported_modes.append(WaterModes.CUSTOMIZED) return supported_modes +def get_fan_speed_name(code: int, features: DeviceFeatures) -> str | None: + """Name a fan power code: selectable modes first, then SmartPlan, custom and code 105.""" + for mode in get_clean_modes(features): + if mode.code == code: + return mode.value + if code == VacuumModes.SMART_MODE.code: + return VacuumModes.SMART_MODE.value + if code == VacuumModes.CUSTOMIZED.code: + return VacuumModes.CUSTOMIZED.value + if code == VacuumModes.GENTLE.code: + # 105 is the mop-only code on pure-mop devices and "gentle" elsewhere. + return VacuumModes.OFF.value if features.is_pure_clean_mop_supported else VacuumModes.GENTLE.value + return None + + +def get_water_mode_name(code: int, features: DeviceFeatures) -> str | None: + """Name a water box code: selectable modes (or slide ranges) first, then SmartPlan and custom.""" + if features.is_water_slide_mode_supported: + slide_mode = _resolve_water_slide_mode(code) + if slide_mode is not None: + return slide_mode.display_name + else: + for mode in get_water_modes(features): + if mode.code == code: + return mode.display_name + if code == WaterModes.SMART_MODE.code: + return WaterModes.SMART_MODE.display_name + if code == WaterModes.CUSTOMIZED.code: + return WaterModes.CUSTOMIZED.display_name + return None + + +def get_mop_route_name(code: int, features: DeviceFeatures, region: str) -> str | None: + """Name a mop route code: selectable routes first, then SmartPlan and custom.""" + for route in get_clean_routes(features, region): + if route.code == code: + return route.display_name + if code == CleanRoutes.SMART_MODE.code: + return CleanRoutes.SMART_MODE.display_name + if code == CleanRoutes.CUSTOMIZED.code: + return CleanRoutes.CUSTOMIZED.display_name + return None + + def get_water_slide_mode_name(code: int) -> str | None: """Get the app's range name for a water slide code, or None if out of range.""" mode = _resolve_water_slide_mode(code) @@ -239,13 +267,14 @@ def get_cleaning_mode_options(features: DeviceFeatures) -> list[CleaningMode]: if not features.is_support_water_mode: return [] - supported_water_modes = get_water_modes(features) options = [CleaningMode.VACUUM, CleaningMode.VAC_AND_MOP] if features.is_pure_clean_mop_supported: options.append(CleaningMode.MOP) - if features.is_customized_clean_supported and WaterModes.CUSTOMIZED in supported_water_modes: + # The customized-clean flag stays required until the app's custom switch + # condition is verified; without it electronic-mop models would gain CUSTOM. + if features.is_custom_mode_supported and features.is_customized_clean_supported: options.append(CleaningMode.CUSTOM) - if features.is_smart_clean_mode_set_supported and WaterModes.SMART_MODE in supported_water_modes: + if features.is_smart_clean_mode_set_supported: options.append(CleaningMode.SMART_MODE) return options @@ -347,7 +376,10 @@ def get_current_cleaning_mode( mop_mode: int | CleanRoutes | None, features: DeviceFeatures, ) -> CleaningMode | None: - """Classify the current high-level cleaning mode from individual mode codes.""" + """Classify the current high-level cleaning mode from individual mode codes. + + The result is None when the classified mode is not in get_cleaning_mode_options(features). + """ if not features.is_support_water_mode: return None clean_mode_enum = _resolve_clean_mode(clean_mode, features) @@ -356,17 +388,30 @@ def get_current_cleaning_mode( if clean_mode_enum is None or water_mode_enum is None: return None - if is_smart_mode_set(water_mode_enum, clean_mode_enum, mop_mode_enum): - return CleaningMode.SMART_MODE - if is_mode_customized(clean_mode_enum, water_mode_enum, mop_mode_enum): + mode = _classify_cleaning_mode(clean_mode_enum, water_mode_enum, mop_mode_enum, features) + if mode not in get_cleaning_mode_options(features): + return None + return mode + + +def _classify_cleaning_mode( + clean_mode: VacuumModes, + water_mode: WaterModes, + mop_mode: CleanRoutes | None, + features: DeviceFeatures, +) -> CleaningMode: + """Classify resolved mode enums, checking custom before SmartPlan like the app.""" + if is_mode_customized(clean_mode, water_mode, mop_mode): return CleaningMode.CUSTOM - if water_mode_enum != WaterModes.OFF: + if is_smart_mode_set(water_mode, clean_mode, mop_mode): + return CleaningMode.SMART_MODE + if water_mode != WaterModes.OFF: try: - if clean_mode_enum == get_mop_only_vacuum_mode(features): + if clean_mode == get_mop_only_vacuum_mode(features): return CleaningMode.MOP except RoborockUnsupportedFeature: pass - if water_mode_enum == WaterModes.OFF: + if water_mode == WaterModes.OFF: return CleaningMode.VACUUM return CleaningMode.VAC_AND_MOP diff --git a/roborock/device_features.py b/roborock/device_features.py index 160d14cc5..b9c710f1c 100644 --- a/roborock/device_features.py +++ b/roborock/device_features.py @@ -511,10 +511,22 @@ class DeviceFeatures(RoborockBase): RoborockProductNickname.TANOSV, RoborockProductNickname.TANOSE, RoborockProductNickname.TANOS, + RoborockProductNickname.RUBYSC, + RoborockProductNickname.RUBYSLITE, + RoborockProductNickname.RUBYSE, + ] + } + ) + is_custom_mode_supported: bool = field( + metadata={ + "model_blacklist": [ + RoborockProductNickname.TANOS, + RoborockProductNickname.RUBYPLUS, + RoborockProductNickname.RUBYSC, + RoborockProductNickname.RUBYSE, ] } ) - is_custom_mode_supported: bool = field(metadata={"model_blacklist": [RoborockProductNickname.TANOS]}) is_support_custom_carpet: bool = field(metadata={"model_whitelist": [RoborockProductNickname.ULTRONLITE]}) is_show_general_obstacle_supported: bool = field(metadata={"model_whitelist": [RoborockProductNickname.TANOSSPLUS]}) is_show_obstacle_photo_supported: bool = field( diff --git a/roborock/devices/traits/v1/status.py b/roborock/devices/traits/v1/status.py index 01eed9a55..f0ea9d2c3 100644 --- a/roborock/devices/traits/v1/status.py +++ b/roborock/devices/traits/v1/status.py @@ -15,9 +15,11 @@ get_cleaning_mode_parameters, get_current_cleaning_mode, get_dock_state, + get_fan_speed_name, + get_mop_route_name, get_water_mode_mapping, + get_water_mode_name, get_water_modes, - get_water_slide_mode_name, resolve_cleaning_mode, ) from roborock.devices.traits.common import DpsDataConverter, TraitUpdateListener @@ -50,11 +52,12 @@ class StatusTrait(StatusV2, common.V1TraitMixin, TraitUpdateListener): - Water Mode - Mop Route - You should use the _options version of the attribute to know which are - supported for your device (i.e. fan_speed_options) - Then you can use the _mapping to convert an int value to the actual Enum. - (i.e. fan_speed_mapping) - You can use the _name property to get the str value of the enum. (i.e. fan_speed_name) + The _options and _mapping versions of the attribute (i.e. fan_speed_options, + fan_speed_mapping) hold only the user-selectable values, i.e. what you can + write to the device. They do not include SmartPlan or custom codes. + Use the _name property (i.e. fan_speed_name), or get_fan_speed_name, + get_water_mode_name and get_mop_route_name, to name the current value, + including SmartPlan and custom codes. """ @@ -115,21 +118,19 @@ def cleaning_mode_options(self) -> list[CleaningMode]: def fan_speed_name(self) -> str | None: if self.fan_power is None: return None - return self.fan_speed_mapping.get(self.fan_power) + return get_fan_speed_name(self.fan_power, self._device_features_trait) @property def water_mode_name(self) -> str | None: if self.water_box_mode is None: return None - if self._device_features_trait.is_water_slide_mode_supported: - return get_water_slide_mode_name(self.water_box_mode) - return self.water_mode_mapping.get(self.water_box_mode) + return get_water_mode_name(self.water_box_mode, self._device_features_trait) @property def mop_route_name(self) -> str | None: if self.mop_mode is None: return None - return self.mop_route_mapping.get(self.mop_mode) + return get_mop_route_name(self.mop_mode, self._device_features_trait, self._region or "us") @property def current_cleaning_mode(self) -> CleaningMode | None: diff --git a/tests/__snapshots__/test_supported_features.ambr b/tests/__snapshots__/test_supported_features.ambr index 834cc350e..0a5b4b569 100644 --- a/tests/__snapshots__/test_supported_features.ambr +++ b/tests/__snapshots__/test_supported_features.ambr @@ -1375,7 +1375,7 @@ 'is_small_side_mop_supported': False, 'is_smart_clean_mode_set_supported': False, 'is_soak_and_wash_supported': False, - 'is_soft_clean_mode_supported': False, + 'is_soft_clean_mode_supported': True, 'is_sr_map_supported': False, 'is_super_deep_wash_supported': False, 'is_support_api_app_stop_grasp_supported': False, diff --git a/tests/devices/__snapshots__/test_v1_device.ambr b/tests/devices/__snapshots__/test_v1_device.ambr index bc0d8fdb3..d56b54f01 100644 --- a/tests/devices/__snapshots__/test_v1_device.ambr +++ b/tests/devices/__snapshots__/test_v1_device.ambr @@ -876,7 +876,7 @@ }) # --- # name: test_device_trait_command_parsing[status] - StatusTrait(adbumper_status=None, auto_dust_collection=None, avoid_count=None, back_type=None, battery=100, camera_status=None, charge_status=None, clean_area=91287500, clean_fluid_status=None, clean_percent=None, clean_time=5405, cleaning_mode_options=[, , , ], clear_water_box_status=None, collision_avoid_status=None, command=, common_status=None, converter=DefaultConverter, corner_clean_mode=None, current_cleaning_mode=, current_cleaning_mode_name='custom', current_map=0, debug_mode=None, dirty_water_box_status=None, distance_off=0, dnd_enabled=1, dock_cool_fan_status=None, dock_error_status=None, dock_state=, dock_type=None, dry_status=None, dss=None, dust_bag_status=None, dust_collection_status=None, error_code=, error_code_name='none', fan_power=106, fan_speed_mapping={101: 'quiet', 102: 'balanced', 103: 'turbo', 104: 'max', 108: 'max_plus', 105: 'off', 106: 'custom'}, fan_speed_name='custom', fan_speed_options=[, , , , , , ], has_am=None, hatch_door_status=None, home_sec_enable_password=None, home_sec_status=None, in_cleaning=, in_fresh_state=1, in_returning=0, in_warmup=None, is_battery_charging=False, is_exploring=None, is_locating=0, kct=None, lab_status=1, last_clean_t=None, lock_status=0, map_present=1, map_status=3, mop_forbidden_enable=0, mop_mode=None, mop_route_mapping={300: 'standard', 301: 'deep', 302: 'custom'}, mop_route_name=None, mop_route_options=[, , ], msg_seq=515, msg_ver=2, rdt=None, repeat=None, replenish_mode=None, rss=None, square_meter_clean_area=91.3, state=, state_name='charging', subdivision_sets=None, switch_map_mode=None, unsave_map_flag=0, unsave_map_reason=4, wash_phase=None, wash_ready=None, wash_status=None, water_box_carriage_status=0, water_box_filter_status=None, water_box_mode=204, water_box_status=0, water_mode_mapping={200: 'off', 201: 'mild', 202: 'standard', 203: 'intense', 207: 'custom_water_flow', 204: 'custom'}, water_mode_name='custom', water_mode_options=[, , , , , ], water_shortage_status=None) + StatusTrait(adbumper_status=None, auto_dust_collection=None, avoid_count=None, back_type=None, battery=100, camera_status=None, charge_status=None, clean_area=91287500, clean_fluid_status=None, clean_percent=None, clean_time=5405, cleaning_mode_options=[, , , ], clear_water_box_status=None, collision_avoid_status=None, command=, common_status=None, converter=DefaultConverter, corner_clean_mode=None, current_cleaning_mode=, current_cleaning_mode_name='custom', current_map=0, debug_mode=None, dirty_water_box_status=None, distance_off=0, dnd_enabled=1, dock_cool_fan_status=None, dock_error_status=None, dock_state=, dock_type=None, dry_status=None, dss=None, dust_bag_status=None, dust_collection_status=None, error_code=, error_code_name='none', fan_power=106, fan_speed_mapping={101: 'quiet', 102: 'balanced', 103: 'turbo', 104: 'max', 108: 'max_plus'}, fan_speed_name='custom', fan_speed_options=[, , , , ], has_am=None, hatch_door_status=None, home_sec_enable_password=None, home_sec_status=None, in_cleaning=, in_fresh_state=1, in_returning=0, in_warmup=None, is_battery_charging=False, is_exploring=None, is_locating=0, kct=None, lab_status=1, last_clean_t=None, lock_status=0, map_present=1, map_status=3, mop_forbidden_enable=0, mop_mode=None, mop_route_mapping={300: 'standard', 301: 'deep'}, mop_route_name=None, mop_route_options=[, ], msg_seq=515, msg_ver=2, rdt=None, repeat=None, replenish_mode=None, rss=None, square_meter_clean_area=91.3, state=, state_name='charging', subdivision_sets=None, switch_map_mode=None, unsave_map_flag=0, unsave_map_reason=4, wash_phase=None, wash_ready=None, wash_status=None, water_box_carriage_status=0, water_box_filter_status=None, water_box_mode=204, water_box_status=0, water_mode_mapping={200: 'off', 201: 'mild', 202: 'standard', 203: 'intense', 207: 'custom_water_flow'}, water_mode_name='custom', water_mode_options=[, , , , ], water_shortage_status=None) # --- # name: test_device_trait_command_parsing[status].1 dict({ diff --git a/tests/devices/traits/v1/test_status.py b/tests/devices/traits/v1/test_status.py index 72274ca68..1f092b4e9 100644 --- a/tests/devices/traits/v1/test_status.py +++ b/tests/devices/traits/v1/test_status.py @@ -595,7 +595,7 @@ def test_get_cleaning_mode_parameters_qrevo_edge_2() -> None: "mop_mode": CleanRoutes.STANDARD.code, } ] - assert VacuumModes.OFF in status_trait.fan_speed_options + assert 105 not in {mode.code for mode in status_trait.fan_speed_options} assert VacuumModes.OFF_RAISE_MAIN_BRUSH not in status_trait.fan_speed_options @@ -688,7 +688,9 @@ def test_current_cleaning_mode_water_slide_legacy_codes( water_box_mode: int | None, expected_mode: CleaningMode | None ) -> None: """Keep legacy and unknown status decoding on water-slide devices.""" - status_trait = _create_cleaning_mode_status_trait(is_water_slide_mode_supported=True) + status_trait = _create_cleaning_mode_status_trait( + is_water_slide_mode_supported=True, is_smart_clean_mode_set_supported=True + ) status_trait.fan_power = 102 status_trait.water_box_mode = water_box_mode status_trait.mop_mode = 300 @@ -787,21 +789,80 @@ async def test_set_cleaning_mode_water_slide_wire_payload( mock_rpc_channel.send_command.assert_called_once_with(RoborockCommand.SET_CLEAN_MOTOR_MODE, params=[expected]) -def test_cleaning_mode_options_water_slide_device() -> None: - """Water-slide devices should not expose unsupported custom or smart water modes.""" +@pytest.mark.parametrize("water_slide", [False, True]) +@pytest.mark.parametrize( + ("custom", "smart", "extra"), + [ + (True, True, [CleaningMode.CUSTOM, CleaningMode.SMART_MODE]), + (False, True, [CleaningMode.SMART_MODE]), + (True, False, [CleaningMode.CUSTOM]), + (False, False, []), + ], +) +def test_cleaning_mode_options_follow_app_flags( + water_slide: bool, custom: bool, smart: bool, extra: list[CleaningMode] +) -> None: + """Custom and SmartPlan options depend only on their feature flags, also on water-slide devices.""" status_trait = _create_cleaning_mode_status_trait( - is_water_slide_mode_supported=True, - is_customized_clean_supported=True, - is_smart_clean_mode_set_supported=True, + is_water_slide_mode_supported=water_slide, + is_custom_mode_supported=custom, # the helper keeps is_customized_clean_supported=True + is_smart_clean_mode_set_supported=smart, ) assert status_trait.cleaning_mode_options == [ CleaningMode.VACUUM, CleaningMode.VAC_AND_MOP, CleaningMode.MOP, + *extra, ] +def test_cleaning_mode_options_custom_needs_customized_clean() -> None: + """Custom mode is not offered without the customized-clean feature, even if the model allows it.""" + status_trait = _create_cleaning_mode_status_trait( + is_custom_mode_supported=True, + is_customized_clean_supported=False, + ) + + assert CleaningMode.CUSTOM not in status_trait.cleaning_mode_options + + +def test_mixed_custom_and_smart_codes_are_custom() -> None: + """Custom wins over SmartPlan when the codes mix both.""" + trait = _create_cleaning_mode_status_trait(is_custom_mode_supported=True, is_smart_clean_mode_set_supported=True) + trait.fan_power, trait.water_box_mode, trait.mop_mode = 106, 209, 300 + + assert trait.current_cleaning_mode == CleaningMode.CUSTOM + + +@pytest.mark.parametrize( + ("features", "codes"), + [ + ({"is_custom_mode_supported": False}, (106, 204, 302)), + ({"is_smart_clean_mode_set_supported": False}, (110, 209, 306)), + ], +) +def test_current_mode_outside_options_is_none(features: dict[str, bool], codes: tuple[int, int, int]) -> None: + """A mode that the device does not offer is not reported as the current mode.""" + trait = _create_cleaning_mode_status_trait(**features) + trait.fan_power, trait.water_box_mode, trait.mop_mode = codes + + assert trait.current_cleaning_mode is None + + +def test_saros_10r_smartplan_is_listed() -> None: + """The Saros 10R SmartPlan codes classify as SmartPlan, which is among the options.""" + trait = _create_cleaning_mode_status_trait( + is_water_slide_mode_supported=True, + is_custom_mode_supported=True, + is_smart_clean_mode_set_supported=True, + ) + trait.fan_power, trait.water_box_mode, trait.mop_mode = 110, 209, 306 + + assert trait.current_cleaning_mode == CleaningMode.SMART_MODE + assert trait.current_cleaning_mode in trait.cleaning_mode_options + + def test_current_cleaning_mode_gentle_not_mop_without_pure_mop() -> None: """Test code 105 is not treated as mop-only on devices without pure mop.""" status_trait = _create_cleaning_mode_status_trait(is_pure_clean_mop_supported=False) @@ -884,6 +945,66 @@ def test_water_slide_mode_name_covers_slider_positions(water_box_mode: int, expe assert status_trait.water_mode_name == expected_name +def test_option_lists_exclude_special_codes() -> None: + """SmartPlan and custom codes are never offered as fan, water or mop route choices.""" + trait = _create_cleaning_mode_status_trait(is_smart_clean_mode_set_supported=True) + special = {106, 110, 204, 209, 302, 306} + assert special.isdisjoint(m.code for m in trait.fan_speed_options) + assert special.isdisjoint(m.code for m in trait.water_mode_options) + assert special.isdisjoint(m.code for m in trait.mop_route_options) + assert special.isdisjoint(trait.fan_speed_mapping) + assert special.isdisjoint(trait.water_mode_mapping) + assert special.isdisjoint(trait.mop_route_mapping) + + +@pytest.mark.parametrize("water_slide", [False, True]) +@pytest.mark.parametrize( + ("fan", "water", "mop", "names"), + [ + (110, 209, 306, ("smart_mode", "smart_mode", "smart_mode")), + (106, 204, 302, ("custom", "custom", "custom")), + ], +) +def test_special_code_names(water_slide: bool, fan: int, water: int, mop: int, names: tuple[str, str, str]) -> None: + """Special codes are still named even though they are not selectable.""" + trait = _create_cleaning_mode_status_trait( + is_smart_clean_mode_set_supported=True, is_water_slide_mode_supported=water_slide + ) + trait.fan_power, trait.water_box_mode, trait.mop_mode = fan, water, mop + assert (trait.fan_speed_name, trait.water_mode_name, trait.mop_route_name) == names + + +def test_water_slide_raw_position_name_unchanged() -> None: + """Raw slider positions keep resolving to their app range name.""" + trait = _create_cleaning_mode_status_trait(is_water_slide_mode_supported=True) + trait.water_box_mode = 227 + assert trait.water_mode_name == "low" + + +@pytest.mark.parametrize( + ("soft", "pure_mop", "in_list", "name"), + [ + (True, False, True, "gentle"), + (True, True, True, "gentle"), + (False, True, False, "off"), + (False, False, False, "gentle"), + ], +) +def test_fan_code_105(soft: bool, pure_mop: bool, in_list: bool, name: str) -> None: + """Code 105 is only selectable as gentle on soft-clean devices but is always named.""" + trait = _create_cleaning_mode_status_trait(is_soft_clean_mode_supported=soft, is_pure_clean_mop_supported=pure_mop) + trait.fan_power = 105 + assert (105 in {m.code for m in trait.fan_speed_options}) is in_list + assert trait.fan_speed_name == name + + +def test_unknown_codes_have_no_name() -> None: + """Codes that are neither selectable nor special have no name.""" + trait = _create_cleaning_mode_status_trait() + trait.fan_power, trait.water_box_mode, trait.mop_mode = 999, 999, 999 + assert (trait.fan_speed_name, trait.water_mode_name, trait.mop_route_name) == (None, None, None) + + def test_update_from_dps(status_trait: StatusTrait) -> None: """Test updating status from data protocol push message.""" assert status_trait.battery is None diff --git a/tests/test_supported_features.py b/tests/test_supported_features.py index b427ccc5d..fb4aabe39 100644 --- a/tests/test_supported_features.py +++ b/tests/test_supported_features.py @@ -416,3 +416,24 @@ def test_device_features_from_home_data( ) feature_dict = {k: v for k, v in asdict(device_features).items() if isinstance(v, bool)} assert feature_dict == snapshot + + +@pytest.mark.parametrize( + ("nickname", "custom", "soft"), + [ + (RoborockProductNickname.TANOS, False, True), + (RoborockProductNickname.RUBYPLUS, False, False), + (RoborockProductNickname.RUBYSC, False, True), + (RoborockProductNickname.RUBYSE, False, True), + (RoborockProductNickname.RUBYSLITE, True, True), + (RoborockProductNickname.TANOSV, True, True), + (RoborockProductNickname.PEARL, True, False), + ], +) +def test_custom_and_soft_clean_mode_model_lists(nickname: RoborockProductNickname, custom: bool, soft: bool) -> None: + """Custom and soft clean mode model lists match the Roborock app.""" + features = DeviceFeatures.from_feature_flags( + new_feature_info=0, new_feature_info_str="", feature_info=[], product_nickname=nickname + ) + assert features.is_custom_mode_supported is custom + assert features.is_soft_clean_mode_supported is soft