Skip to content

fix: treat o3 docks as dryable when the device supports drying - #1065

Open
ryanmac8 wants to merge 1 commit into
Python-roborock:mainfrom
ryanmac8:fix/o3-dock-optional-dryer-module
Open

ryanmac8 wants to merge 1 commit into
Python-roborock:mainfrom
ryanmac8:fix/o3-dock-optional-dryer-module

Conversation

@ryanmac8

Copy link
Copy Markdown

Problem

RoborockDockFeatures.is_dryable is derived from the dock type alone, so docks in _COLLECT_WASH_DOCK_TYPES are 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 advertises is_supported_drying: true.

Today that means MopDryerTrait is never created for these devices, so consumers such as Home Assistant never see the dock drying controls, and the "Mop drying remaining time" sensor stays unknown.

Fixes #1037.

Change

  • RoborockDockFeatures gains an optional supports_drying field, populated from the device's is_supported_drying feature during trait discovery.
  • is_dryable returns 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_dry is still checked first, and devices that don't advertise the feature keep the previous behaviour since the field defaults to None.

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, firmware 02.59.36) with an o3_dock and the HADM02RR module installed.

Before:

is_supported_drying: True
dock_features: RoborockDockFeatures(dock_type=<RoborockDockTypeCode.o3_dock: 3>, has_am=None)
is_dryable: False
mop_dryer trait present: False

After:

is_supported_drying: True
dock_features: RoborockDockFeatures(dock_type=<RoborockDockTypeCode.o3_dock: 3>, has_am=None, supports_drying=True)
is_dryable: True
mop_dryer trait present: True
auto-drying enabled: True | dry_time: 10800

uv run pytest (2365 passed, 53 xfailed), ruff clean, mypy unchanged from main (the 19 reported errors are pre-existing and none are in the touched files).

@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).

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_dryable currently returns True whenever supports_drying is True, even when dock_type is a non-washable or no-dock type (o0_dock, unknown, o1_dock, oc_dock). Because is_supported_drying (new_feature_info upper-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 causes MopDryerTrait to be created for standalone robots (o0_dock) and pure dust-collection docks (o1_dock / oc_dock, e.g., S7 MaxV Plus). Gate the fallback on self.is_washable (self.is_collect_wash_dry or (self.is_washable and self.supports_drying is True)).
    • Otherwise clean: RoborockDockFeatures remains a frozen dataclass with concrete types (bool | None = None, matching has_am), no Any or TYPE_CHECKING hacks, and PropertiesApi.discover_features() refreshes device_features before building dock_features.
  • Priority 2 — Data Lifecycle & State Management: Clean linear flow in PropertiesApi.discover_features(); @cache on RoborockDockFeatures.from_dock_type remains 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. Once is_dryable is gated on self.is_washable, add negative assertions for non-washable docks (o0_dock, unknown, o1_dock, oc_dock) with supports_drying=True (and positive coverage for o2_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.js even displays a "Dryer module sold separately" prompt).
  • Dock.isDryable in the app is strictly this.isCollectWashDry, and dryer settings (app_get_dryer_setting) are only reachable from wash-capable dock screens: DockO2WashTowelSetting (2596.js, gated on Dock.isPureWash in 2441.js) and DockSettingPage / getBasicDockInfoCmdList (2456.js / module_2222.js, gated on !Dock.isOldBelowO3(), i.e. o3_dock or isCollectWashDry), where the app checks FM.isSupportedDrying() || Dock.isCollectWashDry.
  • For o0_dock (no dock) and isPureCollect (o1_dock, oc_dock), dryer settings are never exposed. Gating supports_drying on self.is_washable (o2_dock, o3_dock, or is_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

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.

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:

Suggested change
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

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.

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working /review run Code review skill (/review) has been run Small PR Small pull request (<200 lines) V1 V1 platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

S7 MaxV Ultra: Dock Dryer Module (HADM02RR) on Empty Wash Fill Dock (o3_dock) not detected - no mop dryer trait

2 participants