Skip to content

fix: use YXCleanType for Q10Status.clean_mode instead of YXDeviceWorkMode#810

Merged
allenporter merged 2 commits intoPython-roborock:mainfrom
lboue:fix/q10-clean-mode-type
Apr 6, 2026
Merged

fix: use YXCleanType for Q10Status.clean_mode instead of YXDeviceWorkMode#810
allenporter merged 2 commits intoPython-roborock:mainfrom
lboue:fix/q10-clean-mode-type

Conversation

@lboue
Copy link
Copy Markdown
Contributor

@lboue lboue commented Apr 6, 2026

DPS 137 (CLEAN_MODE) reports clean type values (1=vac+mop, 2=vacuum, 3=mop) which correspond to YXCleanType, not YXDeviceWorkMode.
Using the wrong type forced consumers to extract the raw code and re-interpret it through YXCleanType.from_code_optional, which is unnecessary complexity.

This fix corrects the field type directly in Q10Status so that clean_mode is already a YXCleanType when read.

…Mode

DPS 137 (CLEAN_MODE) reports clean type values (1=vac+mop, 2=vacuum,
3=mop) which map to YXCleanType, not YXDeviceWorkMode.
@lboue lboue marked this pull request as ready for review April 6, 2026 13:58
Copilot AI review requested due to automatic review settings April 6, 2026 13:58
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

This PR corrects the Q10 (B01) status model so DPS 137 (CLEAN_MODE) is represented as YXCleanType (vac+mop / vacuum / mop) rather than YXDeviceWorkMode, aligning the decoded status type with the actual device-reported values.

Changes:

  • Switch Q10Status.clean_mode type from YXDeviceWorkMode to YXCleanType.
  • Update imports accordingly in the Q10 container module.

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

filter_life: int | None = field(default=None, metadata={"dps": B01_Q10_DP.FILTER_LIFE})
sensor_life: int | None = field(default=None, metadata={"dps": B01_Q10_DP.SENSOR_LIFE})
clean_mode: YXDeviceWorkMode | None = field(default=None, metadata={"dps": B01_Q10_DP.CLEAN_MODE})
clean_mode: YXCleanType | None = field(default=None, metadata={"dps": B01_Q10_DP.CLEAN_MODE})
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

clean_mode changed to YXCleanType, but existing Q10 status tests don't assert that DPS 137 is converted into the new enum type. Add/extend a test (e.g., test_status_trait_refresh, whose fixture data already includes DPS 137=1) to assert q10_api.status.clean_mode == YXCleanType.VAC_AND_MOP so regressions in enum mapping are caught.

Copilot uses AI. Check for mistakes.
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.

Test updated

… test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


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

@allenporter allenporter merged commit 66fcb83 into Python-roborock:main Apr 6, 2026
10 of 11 checks passed
@lboue lboue deleted the fix/q10-clean-mode-type branch April 6, 2026 14:18
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.

4 participants