Skip to content

Q10: use readable YXCleanType values (vac_and_mop / vacuum / mop)#794

Merged
allenporter merged 12 commits intoPython-roborock:mainfrom
lboue:feat/yxcleantype-readable-values
Mar 22, 2026
Merged

Q10: use readable YXCleanType values (vac_and_mop / vacuum / mop)#794
allenporter merged 12 commits intoPython-roborock:mainfrom
lboue:feat/yxcleantype-readable-values

Conversation

@lboue
Copy link
Contributor

@lboue lboue commented Mar 22, 2026

Description :

Rename YXCleanType enum values to human-readable names that match the keys already used in the Q7 integration (vac_and_mop, vacuum, mop), instead of the raw protocol strings (bothwork, onlysweep, onlymop).

This follows the same pattern applied to YXFanLevel (v1 naming convention) and makes it possible to use the enum values directly as HA state keys, removing the need for a mapping layer in Home Assistant.

Changes:

  • BOTH_WORK → VAC_AND_MOP = "vac_and_mop", 1
  • ONLY_SWEEP → VACUUM = "vacuum", 2
  • ONLY_MOP → MOP = "mop", 3

Backward compatibility:

  • Legacy attribute names (BOTH_WORK, ONLY_SWEEP, ONLY_MOP) are kept as aliases.
  • from_value() is overridden to transparently accept the old string values (bothwork, onlysweep, onlymop).
  • CLI q10_set_clean_mode still accepts legacy choices alongside new ones.

@lboue lboue force-pushed the feat/yxcleantype-readable-values branch from 2338ea6 to ebe029b Compare March 22, 2026 15:00
@lboue lboue force-pushed the feat/yxcleantype-readable-values branch from ebe029b to 3720ca6 Compare March 22, 2026 15:01
@lboue lboue marked this pull request as ready for review March 22, 2026 15:02
Copilot AI review requested due to automatic review settings March 22, 2026 15:02
Copy link
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 updates the B01/Q10 clean-mode enum to use human-readable values (vac_and_mop, vacuum, mop) that align with existing integration state keys, while preserving backwards compatibility via aliases and legacy string parsing.

Changes:

  • Renames YXCleanType values to readable strings and keeps legacy member names as aliases.
  • Overrides YXCleanType.from_value() to accept legacy protocol strings (bothwork, onlysweep, onlymop).
  • Updates the Q10 CLI clean-mode option to accept both new and legacy strings; updates the Q10 vacuum test to use the new enum member.

Reviewed changes

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

File Description
tests/devices/traits/b01/q10/test_vacuum.py Updates the test to use YXCleanType.VAC_AND_MOP.
roborock/data/b01_q10/b01_q10_code_mappings.py Renames YXCleanType values, adds legacy aliases, and adds legacy-aware from_value().
roborock/cli.py Expands CLI --mode choices to include both new and legacy clean-mode strings.

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

@lboue
Copy link
Contributor Author

lboue commented Mar 22, 2026

I've addressed the code review comments.

Copy link
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 4 out of 4 changed files in this pull request and generated 1 comment.


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

Copy link
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 3 out of 3 changed files in this pull request and generated 4 comments.


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

Copy link
Contributor

@allenporter allenporter left a comment

Choose a reason for hiding this comment

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

Looks good after reverting the CLI changes

Co-authored-by: Allen Porter <allen.porter@gmail.com>
@lboue lboue force-pushed the feat/yxcleantype-readable-values branch from 7410c46 to 7e1a216 Compare March 22, 2026 16:40
@lboue lboue requested a review from allenporter March 22, 2026 17:21
@lboue lboue force-pushed the feat/yxcleantype-readable-values branch from 06ae278 to 4491a16 Compare March 22, 2026 17:23
Copy link
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 4 out of 4 changed files in this pull request and generated 1 comment.


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

Copy link
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 4 out of 4 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 7baeb65 into Python-roborock:main Mar 22, 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