feat: add better dock feature control#867
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors V1 dock-related trait gating to use a centralized dock-capabilities model (RoborockDockFeatures) derived from RoborockDockTypeCode, and updates tests accordingly.
Changes:
- Introduces
RoborockDockFeaturesand updates V1 traits to gate byrequires_dock_featuresrather than dock-type membership lists. - Renames/re-maps
RoborockDockTypeCodemembers to a new naming scheme and adjusts container/tests to match. - Expands/normalizes trait test parametrization to cover capability-based dock support.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_supported_features.py | Adds coverage for RoborockDockFeatures capability flags and AM-variant behavior. |
| tests/devices/traits/v1/test_wash_towel_mode.py | Switches parametrization to capability-based dock support; updates specific dock types used in tests. |
| tests/devices/traits/v1/test_smart_wash_params.py | Switches parametrization to capability-based dock support. |
| tests/devices/traits/v1/test_dust_collection_mode.py | Switches parametrization to capability-based dock support (collectable vs not). |
| tests/devices/traits/v1/helpers.py | Adds helper to generate dock-type parametrizations by RoborockDockFeatures capability. |
| tests/devices/traits/v1/fixtures.py | Updates default dock type fixture value to new enum naming. |
| tests/data/v1/test_v1_containers.py | Updates expected dock type enum members to new names/mappings. |
| roborock/devices/traits/v1/wash_towel_mode.py | Changes trait gating to requires_dock_features based on wash capability. |
| roborock/devices/traits/v1/smart_wash_params.py | Changes trait gating to requires_dock_features based on wash capability. |
| roborock/devices/traits/v1/dust_collection_mode.py | Changes trait gating to requires_dock_features based on collect capability. |
| roborock/devices/traits/v1/init.py | Updates feature discovery to compute RoborockDockFeatures and use it for trait support checks; adjusts dock default. |
| roborock/device_features.py | Adds RoborockDockFeatures and dock capability sets, replacing older dock-type helper functions/constant. |
| roborock/data/v1/v1_containers.py | Adds has_am computed property derived from dss. |
| roborock/data/v1/v1_code_mappings.py | Renames dock type enum members to a new naming scheme. |
Comments suppressed due to low confidence (1)
roborock/device_features.py:849
- This change removes previously public helpers (
is_valid_dock,is_wash_n_fill_dock) and theWASH_N_FILL_DOCK_TYPESconstant. Even if the newRoborockDockFeaturesmodel is preferred internally, keeping thin wrapper aliases helps avoid unnecessary breaking changes for downstream consumers.
@property
def is_special_support_wash_temp(self) -> bool:
return self.dock_type in _SPECIAL_WASH_TEMP_DOCK_TYPES
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
allenporter
left a comment
There was a problem hiding this comment.
Very nice. i didn't totally get what was going on here before so happy to see this.
|
|
||
| class RoborockDockTypeCode(RoborockEnum): | ||
| unknown = -9999 | ||
| no_dock = 0 |
There was a problem hiding this comment.
I believe we'll want to mark this as breaking given its used by callers (e.g. home assistant)
There was a problem hiding this comment.
will tag with breaking on merge! I believe I can just do a comment in the commit description and semantic will tag it.
i.e.
BREAKING CHANGE: RoborockDockTypeCode enum members were renamed, which may require downstream callers to update references
Replaces: #866 #865
This adds more intelligent feature flag control than what we currently have been doing for dock related features. matches our other device features work.