Repository navigation
Conversation
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).
Summary by Architectural Layer
- Priority 1 — Public Trait APIs & Consumer Contracts (
roborock/device_features.py,roborock/devices/traits/v1/__init__.py):- Action required:
RoborockDockFeatures.is_dryablecurrently returnsTruewheneversupports_drying is True, even whendock_typeis a non-washable or no-dock type (o0_dock,unknown,o1_dock,oc_dock). Becauseis_supported_drying(new_feature_infoupper-32-bit flag 15) is a robot firmware capability bit—set on all S7 MaxV (roborock.vacuum.a27) and newer models regardless of attached dock—this causesMopDryerTraitto be created for standalone robots (o0_dock) and pure dust-collection docks (o1_dock/oc_dock, e.g., S7 MaxV Plus). Gate the fallback onself.is_washable(self.is_collect_wash_dry or (self.is_washable and self.supports_drying is True)). - Otherwise clean:
RoborockDockFeaturesremains a frozen dataclass with concrete types (bool | None = None, matchinghas_am), noAnyorTYPE_CHECKINGhacks, andPropertiesApi.discover_features()refreshesdevice_featuresbefore buildingdock_features.
- Action required:
- Priority 2 — Data Lifecycle & State Management: Clean linear flow in
PropertiesApi.discover_features();@cacheonRoborockDockFeatures.from_dock_typeremains bounded and hashable. - Priority 3 — Wire Protocols, Codecs & Resilient Enums: No wire protocol or enum changes.
- Tests (
tests/test_supported_features.py,tests/devices/traits/v1/test_mop_dryer.py): Properly colocated and parametrized. Onceis_dryableis gated onself.is_washable, add negative assertions for non-washable docks (o0_dock,unknown,o1_dock,oc_dock) withsupports_drying=True(and positive coverage foro2_dock).
RR_API Cross-Verification
Verified against the Roborock Tanos app bundles (nonhermes/com.roborock.tanos/output/402.js, 412.js, 2441.js, 2456.js, 2596.js, and hermes/com.roborock.tanos/output/module_443.js, module_1570.js, module_2222.js, module_3242.js):
FM.isSupportedDrying()reads((robotNewFeatures / 2**32) >> 15) & 1(a robot firmware bit, not dynamic dryer-module hardware detection;2596.jseven displays a "Dryer module sold separately" prompt).Dock.isDryablein the app is strictlythis.isCollectWashDry, and dryer settings (app_get_dryer_setting) are only reachable from wash-capable dock screens:DockO2WashTowelSetting(2596.js, gated onDock.isPureWashin2441.js) andDockSettingPage/getBasicDockInfoCmdList(2456.js/module_2222.js, gated on!Dock.isOldBelowO3(), i.e.o3_dockorisCollectWashDry), where the app checksFM.isSupportedDrying() || Dock.isCollectWashDry.- For
o0_dock(no dock) andisPureCollect(o1_dock,oc_dock), dryer settings are never exposed. Gatingsupports_dryingonself.is_washable(o2_dock,o3_dock, oris_collect_wash_dry) matches the Roborock app's exact dock-type eligibility.
| @property | ||
| def is_dryable(self) -> bool: | ||
| return self.is_collect_wash_dry | ||
| return self.is_collect_wash_dry or self.supports_drying is True |
There was a problem hiding this comment.
Priority 1 — Capability Gating (AGENTS.md §3 Compound Capability & Feature Gating)
is_supported_drying (new_feature_info upper-32-bit flag 15) is a robot firmware capability bit rather than dynamic hardware detection of an installed dryer module—for example, tests/__snapshots__/test_supported_features.ambr shows is_supported_drying: True on S7 MaxV (roborock.vacuum.a27) and newer models regardless of which dock is attached.
With self.is_collect_wash_dry or self.supports_drying is True, a standalone robot with no dock (o0_dock / unknown) or a dust-only Auto-Empty Dock (o1_dock / oc_dock, such as S7 MaxV Plus) will report is_dryable == True and instantiate MopDryerTrait even though has_dock or is_washable is False.
In the Roborock app (RR_API), FM.isSupportedDrying() is only consulted on wash-capable dock screens (o2_dock via isPureWash, and o3_dock / isCollectWashDry via !isOldBelowO3()), never for o0_dock or pure-collect docks. Gating on self.is_washable fixes o3_dock (and o2_dock) without falsely enabling drying on dockless or collect-only setups:
| return self.is_collect_wash_dry or self.supports_drying is True | |
| return self.is_collect_wash_dry or (self.is_washable and self.supports_drying is True) |
| ) | ||
| assert RoborockDockFeatures.from_dock_type(RoborockDockTypeCode.o3_dock, supports_drying=True).is_dryable is True | ||
| # Dock families that dry on their own are unaffected by the flag. | ||
| assert RoborockDockFeatures.from_dock_type(RoborockDockTypeCode.o4_dock, supports_drying=False).is_dryable is True |
There was a problem hiding this comment.
Test Gap: Please also assert that non-washable docks (o0_dock, unknown, o1_dock, oc_dock) remain is_dryable is False even when supports_drying=True, and that o2_dock behaves consistently with o3_dock.
Problem
RoborockDockFeatures.is_dryableis derived from the dock type alone, so docks in_COLLECT_WASH_DOCK_TYPESare never considered dryable.o3_dock(the Empty Wash Fill dock used by the S7 MaxV Ultra) is one of them, but it supports the separately sold dryer module (HADM02RR). A device with that module installed advertisesis_supported_drying: true.Today that means
MopDryerTraitis never created for these devices, so consumers such as Home Assistant never see the dock drying controls, and the "Mop drying remaining time" sensor staysunknown.Fixes #1037.
Change
RoborockDockFeaturesgains an optionalsupports_dryingfield, populated from the device'sis_supported_dryingfeature during trait discovery.is_dryablereturns true for dry-capable dock families as before, or when the device advertises drying support.Dock families that dry on their own are unaffected, because
is_collect_wash_dryis still checked first, and devices that don't advertise the feature keep the previous behaviour since the field defaults toNone.Verification
Unit tests added for the capability matrix (
tests/test_supported_features.py) and for the trait gate (tests/devices/traits/v1/test_mop_dryer.py).Verified against a real S7 MaxV (
roborock.vacuum.a27, firmware02.59.36) with ano3_dockand the HADM02RR module installed.Before:
After:
uv run pytest(2365 passed, 53 xfailed),ruffclean,mypyunchanged frommain(the 19 reported errors are pre-existing and none are in the touched files).