Repository navigation
Conversation
Add the 41 new_feature_str bits, robotFeatures 111/112/114/116 and robotNewFeatures 65536 that the newest app plugins read, with the app's extra rules for map segments, wash phase pumping and smart mop water.
Lash-L
left a comment
There was a problem hiding this comment.
Automated code review by Gemini 4 Hydrogen in Antigravity using our /review (/code-review) skill (.agents/skills/code-review/SKILL.md / AGENTS.md).
Scope & Stacking
This PR is stacked on #1046 (0a153bee, b2b0258f, ccf43c0f). This review covers only PR #1054's own commit 7c5fd01e.
Summary by Architectural Layer
- Layer 1 (Public Trait APIs & Capability Model —
roborock/device_features.py,docs/V1_DEVICE_FEATURES.md):- All 41 new
NewFeatureStrBitindices (6,121–169),robotFeaturesIDs (111,112,114,116),robotNewFeaturesmask (65536), and the model rules forRubySC/RubyPlus(is_map_segment_supported) andBerylLite/CoralProSAw(is_support_wash_phase_pumping_supported) match the Roborock app. - 1 issue found:
is_smart_water_supporteduses|= kwargs["is_roller_mop_supported"]inDeviceFeatures.from_feature_flags, whereas the app'sisSmartMopWaterSupportedrequires both bit 166 (SmartWaterSupported) andisSupportRollerMop(&&, not||).
- All 41 new
- Layer 2 & 3 (State, Cache & Feature Decoding):
DeviceFeatures.from_dictcontinues to reject stale cached entries missing new boolean fields, triggering clean re-discovery.
- Tests & Snapshots (
tests/test_supported_features.py,tests/**/__snapshots__/*.ambr):- Targeted tests (
test_supported_features.py,test_device_manager.py,test_file_cache.py,test_v1_device.py,tests/conformance/— 664 passed, 53 xfailed, 99 snapshots passed),ruff check, andmypyall pass on7c5fd01e. Snapshot updates consistently add only the new keys (withtests/test_supported_features.pyasserting the|=behavior onis_smart_water_supported, which should be updated alongside the fix).
- Targeted tests (
| kwargs["is_map_segment_supported"] |= product_nickname in _MAP_SEGMENT_MODELS | ||
| kwargs["is_support_wash_phase_pumping_supported"] |= product_nickname in _WASH_PHASE_PUMPING_MODELS | ||
| # The app offers smart mop water for roller mops even without the smart-water bit. | ||
| kwargs["is_smart_water_supported"] |= kwargs["is_roller_mop_supported"] |
There was a problem hiding this comment.
Layer 1 — Capability Gating (is_smart_water_supported uses OR instead of AND with roller mop)
In the app, isSmartMopWaterSupported requires both NewFeatureStrBit 166 (SmartWaterSupported) and isSupportRollerMop (bit 128), i.e. logical &&, not ||. Using |= here enables is_smart_water_supported for any roller-mop device even when bit 166 is unset.
Suggested fix: Either remove |= so is_smart_water_supported reports bit 166 directly (like is_change_mop_supported for bit 129) and note in the field comment and docs/V1_DEVICE_FEATURES.md that consumers should also check is_roller_mop_supported, or gate it with &=:
# Option A: report bit 166 directly (keeps single-bit tests passing; document that app also requires is_roller_mop_supported)
# (remove lines 849-850)
# Option B: match app's isSmartMopWaterSupported directly (update test_new_feature_str_bits_from_app & test_mop_support_from_roller_mop_bit)
kwargs["is_smart_water_supported"] &= kwargs["is_roller_mop_supported"]There was a problem hiding this comment.
Thanks, you are right. Smart mop water needs both bit 166 and the roller-mop bit. Fixed in f75284d with &=, and there is a test for all four combinations of bits 128 and 166.
While checking this against the app plugin I found two more rules that were wrong, and the same commit fixes them:
is_map_segment_supportedhad the logic inverted. Map segments are supported on every model except RubySC and RubyPlus, which need robotFeatures 116.is_photo_upload_supportedis removed. The 65536 mask only applies to three older models in the China app, and the library cannot check the app region.
The PR description is updated to match.
Smart mop water needs both bit 166 and the roller-mop bit. Map segments are supported on every model except RubySC and RubyPlus, which need robotFeatures 116. The photo-upload mask only applies to three older models in the China app, so it is removed.
Depends on #1046 because it uses the BerylLite and CoralProSAw nicknames that #1046 adds. Until #1046 is merged, this diff also contains its commits. Only the commits after them are new here.
Summary
Adds firmware capability flags that
DeviceFeaturesdid not expose yet. Later dock and cleaning mode PRs need them to offer options only on robots that support them.NewFeatureStrBitmembers: bit 6 and bits 121-169. Their names are the flag names used in the Roborock app plugins, without a trailingSupported(SmartWaterSupportedbecomesSMART_WATER). Each has aDeviceFeaturesfield namedis_<bit name>_supported, the same pattern as the existing bits.robotFeaturesids 111 (is_fds_endpoint_supported), 112 (is_auto_split_segments_supported), 114 (is_order_segment_clean_supported) and 116 (is_map_segment_supported).No existing bit, id or field changes meaning. The bit numbers were compared with all 24 Roborock app V1 plugins; none of them disagrees with another plugin or with the library.
Model rules
Three fields combine the firmware flag with another signal, so a consumer can use the field directly:
is_map_segment_supportedis true for every model except RubySC and RubyPlus. Those two older models support map segments only when they report feature id 116. It is also true when the model is unknown.is_support_wash_phase_pumping_supportedis also true for BerylLite and CoralProSAw, which support the pumping wash phase without bit 148.is_smart_water_supportedneeds both bit 166 and the roller-mop bit (128), because smart mop water is a roller-mop option.Some flags only apply together with conditions the library cannot check, so those fields report the firmware signal alone. Comments in the code and
docs/V1_DEVICE_FEATURES.mdsay so:is_change_mop_supportedtells whether the robot can change mops. Changing them also needs one of those docks, so a consumer that shows a mop-change control should check the dock too.The photo-upload mask in
robotNewFeatures(65536) is left out. It only applies to three older models in the China app, and the library cannot check the app region.Cache
DeviceFeatures.from_dictreturnsNonewhen a cached entry is missing any bool field. So after upgrading, cached features are discovered again from the device once. This is the existing behavior for new fields.Tests
robotFeaturesids, the map segment rule, the BerylLite and CoralProSAw rule, and smart water with and without the roller-mop bit.is_map_segment_supportedis true.docs/V1_DEVICE_FEATURES.mdhas entries for the new fields. It also adds theis_roller_mop_supportedentry, which was missing.Related issues
is_support_only_smart_wash_towel_supported), which the wash towel mode options need to offer Smart on the Qrevo 2 Pro (Smart mop-washing mode missing from Qrevo 2 Pro options #1032).Part of #738