Repository navigation
Conversation
Also cover code 105 on pure-mop soft-clean devices and SmartPlan codes without SmartPlan support.
…ues to show in each mode
… changes in SmartPlan and custom mode
infy1995
marked this pull request as draft
November 18, 2026 22:40
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #738
Depends on #1055. This branch is built on top of #1055 (SmartPlan and custom cleaning modes, option lists). The first five commits are #1055; this PR's own changes are the last six commits:
feat(v1): report which cleaning settings can be changed and which values to show in each modefeat(v1): send cleaning mode changes with the commands each model supportsfeat(v1): add fan speed, water mode and mop route setters that refuse changes in SmartPlan and custom modedocs(v1): describe cleaning setting rules, setters and per-model commandsfeat(v1): report which cleaning settings each model supportsfix(v1): list supported cleaning settings in a stable orderOnce #1055 merges I will rebase, so only these six remain.
Summary
In SmartPlan the robot picks fan speed, water and mop route itself, and in custom mode they come from the per-room settings, so a consumer must not offer or send those settings. And outside those modes, not every value is valid in every mode: for example the Saros 10R rejects deep route
301in vacuum-and-mop mode with-10005. This PR gives consumers what they need to show and change these settings safely, so a consumer such as Home Assistant only presents what the library reports and never combines feature flags itself:StatusTrait.supported_cleaning_settings: which of fan speed, water mode and mop route the model has at all, from the device features (fan speed always; water mode withis_support_water_mode; mop route with water mode, the shake module, and either a mop-only mode or the fast route). A setting is in this set exactly when it can be changed in at least one cleaning mode. The cleaning mode select exists whencleaning_mode_optionsis not empty.StatusTrait.is_fan_speed_adjustable,is_water_mode_adjustable,is_mop_route_adjustable: whether the setting can be changed in the current cleaning mode.StatusTrait.fan_speed_display_options,water_mode_display_options,mop_route_display_options: the values to show in the current mode. In SmartPlan or custom mode only the SmartPlan or custom value; nothing when the setting doesn't apply; otherwise the mode's list:108) only in vacuum-only mode;StatusTrait.set_fan_speed,set_water_mode,set_mop_route. They raiseRoborockUnsupportedFeatureand send nothing in SmartPlan, custom or unknown mode and for values not offered in the current mode (checked by code, so aliases with the same code pass; any water slide code221–250is accepted). They raiseRoborockExceptionwhen the status is not loaded.DeviceFeatures.is_set_clean_motor_mode_supported(robot feature 118): models that takefan_powerandwater_box_modetogether inset_clean_motor_mode.The per-mode lists and command order were compared with the Roborock app plugin and match what the app shows.
Behavior changes
set_cleaning_modesends the commands each model supports. Before, every model got oneset_clean_motor_modewith three fields:set_clean_motor_modewithfan_power,water_box_mode,mop_mode(unchanged);set_clean_motor_modewithfan_powerandwater_box_mode;set_custom_mode, thenset_water_box_custom_mode;set_custom_mode.set_mop_mode [300]only when leaving SmartPlan or custom mode (route306/302), so the robot is not still reported in that mode.set_cleaning_modeand the new setters updatefan_power,water_box_modeandmop_modelocally and notify listeners once. On an error nothing is updated.105outside mop-only) becomes102, a mop route not offered in the mode becomes300.water_mode_options/water_mode_mappingandmop_route_options/mop_route_mappingare now empty when the model does not support the setting (water mode on devices without a mop; mop route on models without the shake module, or without both a mop-only mode and the fast route). Before, they listed values that could never be set, so a consumer created a selector that was always unavailable.fan_speed_optionsandcleaning_mode_optionsare unchanged.get_cleaning_mode_parametersreturns the same payload as before.current_cleaning_modestaysNone(unchanged), but the display options show the SmartPlan or custom value and the setters refuse, because the robot is in that mode.Testing
pytest: 2750 passed. Each of the first four commits passes the suite and ruff on its own.pre-commit run --all-files(ruff, mypy, codespell) passes.110/209/306) and custom (106/204/302), each setter in vacuum and mop, mop only and vacuum only, the refusals in SmartPlan, custom and for values not offered in the mode, and Max+ and the fast route in vacuum-only mode. Each step was checked in the Roborock app.docs/V1_API_COMMANDS.mdlists the Saros 10R under the tested commands.Conflicts with open PRs
Test-merged (
git merge-tree) against every open PR that touches the same files:CleaningMode.VAC_THEN_MOP)roborock/data/v1/v1_clean_modes.py,roborock/devices/traits/v1/status.py,tests/devices/__snapshots__/test_v1_device.ambr,tests/devices/traits/v1/test_status.pyroborock/devices/traits/v1/status.py,tests/devices/__snapshots__/test_v1_device.ambr,tests/devices/traits/v1/test_status.pyset_cleaning_mode; the local field update follows #959's convention.roborock/data/v1/v1_clean_modes.py,tests/devices/traits/v1/test_status.pydocs/V1_DEVICE_FEATURES.md,roborock/device_features.py,tests/__snapshots__/test_supported_features.ambr,tests/devices/__snapshots__/test_file_cache.ambrtests/__snapshots__/test_supported_features.ambrVacuumModes.OFFcode distinct from GENTLE)tests/data/v1/test_v1_clean_modes.pytests/devices/traits/v1/test_status.pySame files, no text conflict: #1065, #1059, #1026, #1044 (snapshots), #1057 (
status.py,test_status.py), #1046, #1047 (device_features.py, feature docs and tests), #1045, #1036, #1035 (docs/V1_API_COMMANDS.md).