Skip to content

refactor: replace schema code strings with RoborockDataProtocol enums#808

Merged
allenporter merged 3 commits intoPython-roborock:mainfrom
allenporter:schema-code-simplificaiton
Apr 6, 2026
Merged

refactor: replace schema code strings with RoborockDataProtocol enums#808
allenporter merged 3 commits intoPython-roborock:mainfrom
allenporter:schema-code-simplificaiton

Conversation

@allenporter
Copy link
Copy Markdown
Contributor

Update the status containers and add supported_schema_ids helper to use the enum values instead of the string values. This renames the metadata field to "dps" to be prepared to support using this field for more than just if the feature is supported, but also for supporting parsing dynamic streaming updates of field values based on DPS key. This is pulled out of PR #799

This removes the check for dock_error_status since it is not a real DPS value.

Copilot AI review requested due to automatic review settings April 5, 2026 16:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors V1 trait field support detection to use DPS/schema IDs (via RoborockDataProtocol / RoborockEnum integer values) instead of string schema codes, in preparation for DPS-driven parsing/streaming updates.

Changes:

  • Switch DeviceFeaturesTrait.is_field_supported() from requires_schema_code/supported_schema_codes to dps/supported_schema_ids.
  • Add HomeDataProduct.supported_schema_ids helper derived from HomeDataProductSchema.id.
  • Update V1 status/consumable container field metadata to store RoborockDataProtocol enum members under dps.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
roborock/roborock_message.py Adjusts RoborockEnum import source for protocol enums.
roborock/devices/traits/v1/device_features.py Uses dps metadata + supported_schema_ids for field support checks; adds dataclass field lookup helper.
roborock/devices/traits/v1/__init__.py Updates trait-system documentation around field support metadata (needs follow-up corrections per comments).
roborock/data/v1/v1_containers.py Replaces string schema-code metadata with dps enum metadata on V1 containers.
roborock/data/containers.py Improves supported_schema_codes docstring and adds supported_schema_ids.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@allenporter allenporter force-pushed the schema-code-simplificaiton branch from b25650b to 6ca34e0 Compare April 5, 2026 16:21
@allenporter allenporter force-pushed the schema-code-simplificaiton branch from 6ca34e0 to 56a834d Compare April 5, 2026 16:35
@allenporter allenporter merged commit 4fcef24 into Python-roborock:main Apr 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants