Skip to content

feat: add V1 feature flag bits needed to gate dock and cleaning options - #1054

Merged
allenporter merged 2 commits into
Python-roborock:mainfrom
infy1995:feat/v1-new-feature-bits-from-app
Nov 26, 2026
Merged

allenporter merged 2 commits into
Python-roborock:mainfrom
infy1995:feat/v1-new-feature-bits-from-app

Conversation

@infy1995

@infy1995 infy1995 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds firmware capability flags that DeviceFeatures did not expose yet. Later dock and cleaning mode PRs need them to offer options only on robots that support them.

  • 41 new NewFeatureStrBit members: bit 6 and bits 121-169. Their names are the flag names used in the Roborock app plugins, without a trailing Supported (SmartWaterSupported becomes SMART_WATER). Each has a DeviceFeatures field named is_<bit name>_supported, the same pattern as the existing bits.
  • robotFeatures ids 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_supported is 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_supported is also true for BerylLite and CoralProSAw, which support the pumping wash phase without bit 148.
  • is_smart_water_supported needs 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.md say so:

  • the account region for zone replenish cleaning (bits 132 and 154)
  • the Shell4S or Shell4SA dock for mop changing (bit 129). is_change_mop_supported tells 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.
  • AES encryption support for backup and restore (bit 151)

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_dict returns None when 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

  • A table-driven test sets each new bit by itself and checks that it turns on only its own field. Smart water gets the roller-mop bit too. A second test sets all of them together.
  • Tests for the new robotFeatures ids, the map segment rule, the BerylLite and CoralProSAw rule, and smart water with and without the roller-mop bit.
  • Snapshot updates add the new keys. For devices with known models, is_map_segment_supported is true.
  • docs/V1_DEVICE_FEATURES.md has entries for the new fields. It also adds the is_roller_mop_supported entry, which was missing.

Related issues

Part of #738

@infy1995 infy1995 changed the title feat: add V1 feature flag bits from the Roborock app feat: add V1 feature flag bits needed to gate dock and cleaning options Nov 17, 2026
@Lash-L Lash-L added Data model changes Changes to data models, device info, or feature mappings Feature New feature V1 V1 platform labels Nov 18, 2026

@Lash-L Lash-L left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 NewFeatureStrBit indices (6, 121–169), robotFeatures IDs (111, 112, 114, 116), robotNewFeatures mask (65536), and the model rules for RubySC/RubyPlus (is_map_segment_supported) and BerylLite/CoralProSAw (is_support_wash_phase_pumping_supported) match the Roborock app.
    • 1 issue found: is_smart_water_supported uses |= kwargs["is_roller_mop_supported"] in DeviceFeatures.from_feature_flags, whereas the app's isSmartMopWaterSupported requires both bit 166 (SmartWaterSupported) and isSupportRollerMop (&&, not ||).
  • Layer 2 & 3 (State, Cache & Feature Decoding):
    • DeviceFeatures.from_dict continues 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, and mypy all pass on 7c5fd01e. Snapshot updates consistently add only the new keys (with tests/test_supported_features.py asserting the |= behavior on is_smart_water_supported, which should be updated alongside the fix).

Comment thread roborock/device_features.py Outdated
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"]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_supported had the logic inverted. Map segments are supported on every model except RubySC and RubyPlus, which need robotFeatures 116.
  • is_photo_upload_supported is 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.

@Lash-L Lash-L added the /review run Code review skill (/review) has been run label Nov 18, 2026

@Lash-L Lash-L left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 on f75284d (delta from 7c5fd01)

  • Scope & Stacking: Still stacked on #1046 (0a153be, b2b0258, ccf43c0); PR #1054's own commits are 7c5fd01 and f75284d.
  • Prior Finding Resolved:
    • is_smart_water_supported now uses &= with is_roller_mop_supported (roborock/device_features.py), matching the app's isSmartMopWaterSupported (isNewFeatureStrSupport(SmartWaterSupported) && isSupportRollerMop()). All four bit combinations ([], [128], [166], [128, 166]) are covered in tests/test_supported_features.py.
  • Additional Changes in f75284d Verified:
    • is_map_segment_supported now uses product_nickname not in _MAP_SEGMENT_FEATURE_REQUIRED_MODELS ({RUBYSC, RUBYPLUS}), matching the app's !DM.is(RubySC) && !DM.is(RubyPlus) || isSupportFeature(116) rule, with tests covering both model fallback and robotFeatures 116.
    • is_photo_upload_supported (mask 65536) is cleanly removed across code, docs, tests, and snapshots — appropriate given the app gates it on CN region and non-Mi app for three legacy models.
    • All 41 added NewFeatureStrBit indices (6, 121–169), robotFeatures IDs (111, 112, 114, 116), and is_support_wash_phase_pumping_supported model rules match the app plugins.
  • CI & Verdict: All CI checks (lint, Lint Commit Messages, test & test-mqtt on 3.11/3.14, Build Package, Test Semantic Release) are green on f75284d. No remaining findings — passes /review (ready to merge once #1046 lands).

@Lash-L Lash-L added the Passed /review Passed the /review skill check label Nov 21, 2026
@infy1995
infy1995 force-pushed the feat/v1-new-feature-bits-from-app branch from f75284d to 84c1058 Compare November 22, 2026 09:53
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.
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.

@Lash-L Lash-L left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (9e5ce30, delta from f75284d)

Verdict: Passes /review.

What changed since f75284d. The branch was rebased onto main (merge base 321c6d5) and is no longer stacked on #1046. The commits were reworded to 49f7485 + 9e5ce30. roborock/device_features.py, docs/V1_DEVICE_FEATURES.md, tests/test_supported_features.py and tests/__snapshots__/test_supported_features.ambr are byte-identical to f75284d. The only other change is the regenerated device snapshots (test_device_manager, test_file_cache, test_v1_device). It merges cleanly with current main.

Earlier findings. The smart water |= → &= fix from the first review is still in (roborock/device_features.py:850). The map segment and photo upload corrections are also still in. There are no open threads.

Re-check against the app plugins

I re-checked every new flag against the decoded V1 plugins in RR_API. All 11 hermes plugins that carry the NewFeatureStr table agree, with no index conflicts. The reference used here is hermes/no_package/Qrevo Edge 2 Flow/output/module_459.js:175.

  • Confirmed: all 41 NewFeatureStrBit members. These are bit 6 (SupportSilentOta) and bits 121, 122, 125, 129–156, 158, 160, 161, 164–169. Each index and app name matches the PR (device_features.py:12-131). The app reads them through isNewFeatureStrSupport, which the library maps to new_feature_info_str. The PR's SOUND_RECORD comes from the app's SoundRecordSupported and SMART_WATER from SmartWaterSupported, with the Supported suffix dropped as the PR body says.

  • Confirmed: robotFeatures 111, 112 and 114. They match isSupportFDSEndPoint → isSupportFeature(111) (module_459.js:2627-2630), isSupportAutoSplitSegments → 112 (:2636-2639) and isSupportOrderSegmentClean → 114 (:2645-2648).

  • Confirmed: map segments (robotFeatures 116). The app's isMapSegmentSupported is !RubySC && !RubyPlus || isSupportFeature(116) (module_459.js:190-223). The PR implements this at device_features.py:322-325,847, and an unknown model gets True in both.

  • Confirmed: wash phase pumping. The app's isSupportWashPhasePumping is BerylLite || CoralProSAw || bit 148 (module_459.js:5513-5541), which matches device_features.py:848.

  • Confirmed: smart water. The app's isSmartMopWaterSupported is bit 166 && isSupportRollerMop() (module_459.js:1514-1525), and isSupportRollerMop is bit 128 (:4525-4529). This matches device_features.py:850.

  • Confirmed: conditions the library leaves to the consumer.

    • The zone replenish flags (132 and 154) also need serverCode !== 'de' (module_459.js:3897-3920, 5596-5602).
    • Backup and restore (151) also needs isSupportAESEncrypt (:5578-5586).
    • isSupportChangeMop is isChangeMopMachine() (bit 129) plus a Shell4S or Shell4SA dock (:3837-3870).

    The code comments and docs describe each of these accurately.

Priority 1–3

No findings. The new fields follow the existing new_feature_str_bit / robot_features metadata pattern. The three derived rules are done in from_feature_flags with no new state, and no telemetry decoding is gated.

Tests & PR hygiene

  • uv run pytest -q on 9e5ce30 (Python 3.13): 2742 passed, 47 xfailed, 168 snapshots passed. ruff check and ruff format --check are clean. mypy reports 1 error in tests/map/test_b01_q10_render.py:502, which this PR does not touch, and the same error shows up on origin/main with the same local toolchain. CI is green on 9e5ce30.
  • Heads-up for the merge order: #1055 and #1064 are not stacked on this branch, and both conflict with it textually. #1055 conflicts in tests/__snapshots__/test_supported_features.ambr. #1064 conflicts in roborock/device_features.py, docs/V1_DEVICE_FEATURES.md and two snapshot files, because of its new robotFeatures 118 field next to the 111–116 block. The conflicts are not semantic, so whichever PR lands second needs a rebase and a snapshot refresh.

This is an automated review and can be incorrect, so please reply if any finding looks wrong.

@allenporter
allenporter merged commit 1fe37e4 into Python-roborock:main Nov 26, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Data model changes Changes to data models, device info, or feature mappings Feature New feature Passed /review Passed the /review skill check /review run Code review skill (/review) has been run V1 V1 platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants