Repository navigation
Conversation
b46f05e to
a11dc97
Compare
Lash-L
left a comment
There was a problem hiding this comment.
Automated code review by Gemini 4 Neon in Antigravity using our /review (/code-review) skill (.agents/skills/code-review/SKILL.md / AGENTS.md).
Scope & Stacking
Stacked on #1055 (af53ca3); this review covers PR #1064's own commits 1056001..a11dc97 (12 files changed, all CI checks green).
Architectural Review (Priority 1 → 3)
-
Priority 1 — Public Trait APIs & Consumer Contracts (
status.py,v1_clean_modes.py,device_features.py):- Strongly typed, consumer-agnostic surface (
CleaningSetting,supported_cleaning_settings,is_*_adjustable,*_display_options,set_fan_speed,set_water_mode,set_mop_route). NoTypedDict, noAnyon public trait boundaries, and no newtests/conformance/exemptions. - All error paths raise
RoborockUnsupportedFeature/RoborockException. - One minor non-blocking suggestion inline on
get_display_optionsfor direct helper callers passing rawget_water_modes/get_clean_routesinSMART_MODE/CUSTOM.
- Strongly typed, consumer-agnostic surface (
-
Priority 2 — Lifecycle, State & Concurrency (
status.py,v1_clean_modes.py):- Helpers in
v1_clean_modes.pyare pure value-returning functions with direct linear flow intoStatusTrait. _apply_motor_modeexecutes commands sequentially and updates cachedfan_power/water_box_mode/mop_modewith a single_notify_update()only after all commands succeed, leaving cached state untouched on RPC error.
- Helpers in
-
Priority 3 — Wire Protocols, Codecs &
RR_APICross-Verification:- Feature 118 (
is_set_clean_motor_mode_supported) & per-model command order: Verified against the Roborock app (nonhermes/com.roborock.tanos383.js:1651-1683,2581.js:809-842;hermes/com.roborock.tanosmodule_2219.js:7858-7905):isShakeMopSetSupported()→ 3-fieldset_clean_motor_mode; feature118→ 2-fieldset_clean_motor_mode; fallback →set_custom_modethenset_water_box_custom_mode; plusset_mop_mode [300]only when resetting a SmartPlan/custom route (306/302). - Mode-tab visibility & per-mode option filtering: Verified against
nonhermes1870.js:84-110, 251-254, 299-311andhermesmodule_1632.js:832-884, 1925-1960— Max+ (108) gating (isMaxPlusModeSupportedvsisNonePureCleanMopWithMaxPlus), stripping wateroff(200) whenisPureCleanMopSupported, mop route tab filtering (isShakeMopSetSupported,isCleanEfficiencySupported,isCleanRouteFastModeSupported), and Custom-before-SmartPlan locking all match the app. CleaningSetting(StrEnum)is an internal enum not decoding wire codes, compliant withAGENTS.md.
- Feature 118 (
-
Tests & Documentation:
- Thoroughly colocated in
tests/data/v1/test_v1_clean_modes.py,tests/devices/traits/v1/test_status.py, andtests/test_supported_features.py, including an exhaustive feature-flag grid verifyingget_supported_settingsagainstget_adjustable_settings.
- Thoroughly colocated in
Verdict
Passes /review — no blocking issues; ready to approve (with one optional cleanup suggestion on get_display_options).
| return [cast(ModeEnumT, custom_value)] | ||
| if setting in get_adjustable_settings(mode, features): | ||
| return get_mode_options(setting, mode, features, options) | ||
| if setting not in get_supported_settings(features) or current_code is None: |
There was a problem hiding this comment.
[Priority 1 — Minor / Non-blocking] Checking setting not in get_supported_settings(features) up front (right after if not options:) both removes the redundant is_shake_mop_set_supported special case on line 316 and ensures direct callers of the public helper get_display_options (e.g., passing get_water_modes(features) on a vacuum-only device or get_clean_routes(features, region) on a shake-mop device without pure-mop or fast-route) also get [] in SMART_MODE/CUSTOM rather than [SMART_MODE]/[CUSTOMIZED] (matching StatusTrait, where water_mode_options/mop_route_options already return []).
if not options or setting not in get_supported_settings(features):
return []
smart_value, custom_value = _SMART_AND_CUSTOM_VALUES[setting]
if mode == CleaningMode.SMART_MODE:
return [cast(ModeEnumT, smart_value)]
if mode == CleaningMode.CUSTOM:
return [cast(ModeEnumT, custom_value)]
if setting in get_adjustable_settings(mode, features):
return get_mode_options(setting, mode, features, options)
if current_code is None:
return []There was a problem hiding this comment.
Thanks, adopted in 92d2fb4. get_display_options now returns [] up front when the options are empty or the setting is not in get_supported_settings(features), so the separate shake-module check for the mop route is gone. Direct callers that pass the model lists (get_water_modes on a vacuum-only device, get_clean_routes on a model without the shake module or without both a mop-only mode and the fast route) now get [] in SmartPlan and custom mode too, same as StatusTrait. test_get_display_options_special_values_need_a_supported_setting covers those cases.
Lash-L
left a comment
There was a problem hiding this comment.
Automated code review by Gemini 4 Neon in Antigravity using our /review (/code-review) skill (.agents/skills/code-review/SKILL.md / AGENTS.md).
Follow-Up Review (92d2fb4, delta from a11dc97)
- Addressed:
get_display_optionsinroborock/data/v1/v1_clean_modes.pynow guardsnot options or setting not in get_supported_settings(features)up front, removing the separateis_shake_mop_set_supportedcheck and aligning direct callers withStatusTraitinSMART_MODEandCUSTOMmodes. - Tests & CI:
test_get_display_options_special_values_need_a_supported_settingintests/data/v1/test_v1_clean_modes.pycovers the unsupported-setting cases for bothWATER_MODEandMOP_ROUTE, and all CI checks pass on92d2fb4. - Findings: None — no regressions introduced.
Verdict
Passes /review — clean and ready to approve.
badb006 to
8e7c3fe
Compare
8e7c3fe to
0c71b12
Compare
Lash-L
left a comment
There was a problem hiding this comment.
Automated code review by Claude Opus 5.5 in Claude Code using our /review (/code-review) skill (.agents/skills/code-review/SKILL.md / AGENTS.md).
Follow-Up Review (0c71b12, delta from 92d2fb4)
Verdict: Passes /review with nits.
What changed since 92d2fb4: the branch was rebased onto a newer main and onto the updated #1055 (4e06396, which adds 336e8be and reworks ccdc202). git range-diff shows this PR's own commits are unchanged apart from rebase fixups in tests and imports (cf90384, 218499e, 3b20252). The only new commit is 0c71b12, which handles set_clean_motor_mode in V1VacuumSimulator and adds end-to-end setter tests that run against the simulator. The earlier review had no blocking findings, and the get_display_options suggestion is still in place.
Per-model command dispatch, checked against the app (roborock/data/v1/v1_clean_modes.py:544-573):
- Shake module: one 3-field
set_clean_motor_mode(fan_power,water_box_mode,mop_mode). Confirmed inRR_API/nonhermes/com.roborock.tanos/output/383.js:1651-1658→448.js:1337-1354(setCleanMopMode). The hermes bundle shows the same:hermes/com.roborock.tanos/output/module_2219.js:7859,7894. - Robot feature
118: a 2-fieldset_clean_motor_mode. Confirmed in383.js:1665-1670→448.js:816-827,2581.js:823-829andmodule_2219.js:7864,7886. - Fallback:
set_custom_modefollowed byset_water_box_custom_mode. Confirmed in383.js:1677-1681,2581.js:834-839andmodule_2219.js:7867-7876. - The
is_set_clean_motor_mode_supportedflag usesrobot_features: 118, which matchesRSM.isSupportFeature(118). The118inNewFeatureStrBit(TWO_GEARS_NO_COLLISION) is a separate namespace, so the two do not clash. - Simulator handler (
roborock/testing/v1_simulator.py:345-350): it accepts the 2-field and 3-field payload shapes the app sends, and it keepsmop_modeunchanged when the payload has no route.
Priority 3: Wire protocol
- Nit / unverifiable,
v1_clean_modes.py:519-522and:571-572. On models without the shake module, leaving SmartPlan or custom mode sends an extraset_mop_mode [300]when the current route is306or302. The app does not do this. Its non-shake path (383.js:1665-1681,2581.js:823-839) sends only the fan and water commands. The only place the app callsset_mop_modeis the user route picker (383.js:1219,module_2219.js:7424). The earlier review described this as verified, but I could not find it in either bundle. The extra command is probably harmless, since a model that reports306or302has the route setting. Still, it goes beyond what the app does. One fix is to only reset the route whenfeatures.is_clean_route_setting_supportedis true. If the reset came from a real device trace, a comment citing that device would be enough instead.
Tests & PR hygiene
- The new simulator tests sit in the right places (
tests/devices/traits/v1/test_status.py,tests/testing/test_v1_simulator.py). They useV1VacuumSimulatorand parametrize, as the skill asks. The "refused in SmartPlan" test checks that no RPC is sent and that the simulator state is unchanged. Good. - Local run on
0c71b12:pytestpassed 3276 (46 xfailed, 168 snapshots passed),ruff checkandruff format --checkare clean, and CI is green. The local mypy errors are missing stubs in my environment and are unrelated to this PR. - The PR is stacked on #1055, so #1055 has to merge first. It merges cleanly into the current
main(cfa413e), but it is based on an oldermain.
This is an automated review and can be incorrect, so please reply if any finding looks wrong.
0c71b12 to
cd44caf
Compare
|
You're right, thanks: compared with the app plugin, models without the shake module send only the fan and water commands, and I found no path that sends the route for them (the one exception is the clean-then-mop sequence, which this PR doesn't touch). So the extra I kept it on purpose. The library reads a route left at |
Lash-L
left a comment
There was a problem hiding this comment.
Automated code review by Claude Opus 5.5 in Claude Code using our /review (/code-review) skill (.agents/skills/code-review/SKILL.md / AGENTS.md).
Follow-Up Review (cd44caf, delta from 0c71b12)
Verdict: Passes /review.
What changed since 0c71b12: the branch is now stacked on the updated #1055 (f46683c). This PR's nine commits were squashed into five (2ef6dc6, 4358adb, db40ab2, 685183a, cd44caf). Apart from the base change, the code is the same, with one exception: git diff 4e06396..0c71b12 and git diff f46683c..cd44caf differ only by a two-line comment added in 4358adb. Tests, docs and snapshots are unchanged apart from rebase context.
Earlier findings
- Priority 3 nit (extra
set_mop_mode [300]on models without the shake module): addressed by documenting it. The author replied in the PR thread and explained why the reset stays. The library reads a leftover306as SmartPlan and a leftover302as custom, so without the reset, leaving those modes could still read as the old mode. A route code of306or302matters whateveris_clean_route_setting_supportedreports, so the reset is not gated on it. The new comment atroborock/data/v1/v1_clean_modes.py:519-520says that this goes beyond the app and is untested on such a model. That is the "cite it in a comment" option the earlier review offered, so I consider this resolved. - The
get_display_optionscleanup from the first review is still in place.
New in this delta
- Only the comment at
v1_clean_modes.py:519-520. It sits between theifbody and theelifit describes, which is fine for ruff and easy to read.
Priority 1 / 2 / 3 findings
- None blocking. Optional wording nit for
v1_clean_modes.py:520: "Compared with the app plugin, which does not send it" would read better as "The app plugin does not send it", since the comment's point is that the app does not send this command.
Checked again at cd44caf
- Per-model dispatch (
v1_clean_modes.py:546-573) is unchanged and still matches the app: shake module → one 3-fieldset_clean_motor_mode; feature118→ a 2-fieldset_clean_motor_mode; fallback →set_custom_mode+set_water_box_custom_mode. - Simulator
set_clean_motor_mode(roborock/testing/v1_simulator.py:345-350) matches what the a87's own plugin sends (prtest/a87_plugin/output.js:238895-238931).setCleanMopModesends{fan_power, water_box_mode}plus a route argument, andsetCleanMotorModesends{fan_power, water_box_mode}. The handler requires both fields and falls back to the currentmop_modewhen no route is sent. That matches both shapes. - Stacking and merge: this PR's own commits are
f46683c..cd44caf. #1050 has merged intomain(2a051f2).git merge-treeofcd44cafwithorigin/mainis clean, and the full test suite passes on the merged tree (3327 passed, 46 xfailed). #1055 still has to merge first.
Live test on a Qrevo MaxV 2
Model a87, firmware 02.34.04, US, at cd44caf. Starting state: vac_and_mop, fan 101, water 202, route 300.
- Fan speed
101→102→ back to101. The device read back each value. - Water mode
202→201→ back to202. The device read back each value. - Mop route
300→304→ back to300. The device read back each value. set_fan_speed(MAX_PLUS)invac_and_mopwas refused withRoborockUnsupportedFeaturebefore anything was sent.- Not exercised: the setters while the robot is in SmartPlan or custom mode. The unit tests and the simulator tests cover those cases.
Local results
pytestoncd44caf: 3306 passed, 46 xfailed, 168 snapshots passed.pytestoncd44cafmerged withorigin/main: 3327 passed, 46 xfailed.ruff check: all checks passed.ruff format --check: 285 files already formatted.- CI (
gh pr checks): everything passes (lint, test 3.11/3.14, test-mqtt 3.11/3.14, Build Package, Lint Commit Messages, Test Semantic Release, labeler).releaseis skipped.
This is an automated review and can be incorrect, so please reply if any finding looks wrong.
cd44caf to
93fc93a
Compare
…ices Water-slide devices report flow as slider positions, so get_water_modes() has no CUSTOMIZED (204) or SMART_MODE (209) entry for them and get_cleaning_mode_options() dropped CUSTOM and SMART_MODE even when the feature flags are set. get_current_cleaning_mode() still classifies those states, so consumers such as Home Assistant showed an unknown cleaning mode whenever the device was in custom or SmartPlan mode. Gate both options on the feature flags alone for water-slide devices. Verified on a Qrevo Edge 3 Pro (roborock.vacuum.a296): writing 106/204/302 and 110/209/306 with set_clean_motor_mode is accepted and read back as 106/204/300 and 110/209/306. Fixes Python-roborock#977 Co-Authored-By: Claude Opus 5.5 <[email protected]>
RubyPlus, RubySC and RubySE do not support the custom cleaning mode, and RubySC, RubySLite and RubySE support the soft clean (gentle) fan mode. The model lists were compared with the app plugin.
SmartPlan and custom no longer depend on the water mode list, which never contains their codes on water-slide devices, so those devices now get both modes. Custom depends on the model supporting it and no longer on a shake or spin mop module, so electronic water tank models such as the S6 MaxV get it too. Custom codes are checked before SmartPlan codes, and a recognized mode the device does not offer is reported as None.
Also cover code 105 on pure-mop soft-clean devices and SmartPlan codes without SmartPlan support.
…ues to show in each mode Consumers need to know whether a setting can be changed and which values to show, because the robot controls the settings itself in SmartPlan and custom mode and rejects some values in the other modes.
…ports Models accept the cleaning mode only through different commands, so a single set_clean_motor_mode payload does not work on all of them.
… changes in SmartPlan and custom mode Lets consumers change one setting safely: the setters refuse where the robot decides the value and do not send values the mode rejects.
… the current value of the others Consumers present only what the library reports, without combining feature flags themselves. Settings a model lacks have empty lists; settings the current mode controls show the current value read-only.
The shared simulator lets the cleaning setting setters be tested end to end.
93fc93a to
fa799c5
Compare
Part of #738
Depends on #1055. This branch is built on top of #1055 (SmartPlan and custom cleaning modes, option lists). The first six commits are #1055; this PR's own changes are the last five 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 modefeat(v1): report which cleaning settings each model supports and show the current value of the othersfeat(v1): handle set_clean_motor_mode in the V1 simulatorOnce #1055 merges I will rebase, so only these five 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. When the model has the setting but the current mode sets it (for example the fan in mop-only mode, or water in vacuum-only mode), only the current value, read-only, so a consumer can still show it. Nothing when the model doesn't have the setting or the current value is unknown. 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 mode is not still read as the one it left. Compared with the app plugin: it does not send this. Not tested on such a model.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.105,200) appears only this way, read-only; it stays a choosable value only in the water list of models without a mop-only mode. The setters still refuse a change there, including the shown value.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.Size
This PR's own commits add about 490 lines of library code (
v1_clean_modes.py,status.py, one feature field, a simulator handler), about 50 lines of docs and about 1,800 lines of tests. The tests are table-driven across device families and cleaning modes, which is where most of the size comes from. The six #1055 commits at the start of the branch disappear from the diff once #1055 merges and this branch is rebased.Testing
pytest: 3779 passed (also with differentPYTHONHASHSEEDvalues). Every commit passes the test suite and ruff on its own. The setters are also tested end to end againstV1VacuumSimulator, which now handlesset_clean_motor_mode.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.VacuumModes.OFFcode distinct from GENTLE)roborock/devices/traits/v1/customize_clean_mode.py(also conflicts with #1055),tests/data/v1/test_v1_clean_modes.pyget_setting_change_codesandget_cleaning_mode_codessendget_mop_only_vacuum_mode(features).codefor mop-only mode; with #1066 that isOFF.code(107), so they must sendvacuum_mode_wire_code(...)(105) instead.tests/__snapshots__/test_supported_features.ambr,tests/devices/__snapshots__/test_device_manager.ambr,tests/devices/__snapshots__/test_file_cache.ambr,tests/devices/__snapshots__/test_v1_device.ambr,tests/test_supported_features.pySame files, no text conflict: #1087, #1065, #1045, #1044 (snapshots).