Q10: use readable YXCleanType values (vac_and_mop / vacuum / mop)#794
Conversation
2338ea6 to
ebe029b
Compare
ebe029b to
3720ca6
Compare
There was a problem hiding this comment.
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
YXCleanTypevalues 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.
|
I've addressed the code review comments. |
There was a problem hiding this comment.
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.
…acy alias support
There was a problem hiding this comment.
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.
allenporter
left a comment
There was a problem hiding this comment.
Looks good after reverting the CLI changes
Co-authored-by: Allen Porter <allen.porter@gmail.com>
7410c46 to
7e1a216
Compare
06ae278 to
4491a16
Compare
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Description :
Rename
YXCleanTypeenum 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", 1ONLY_SWEEP → VACUUM = "vacuum", 2ONLY_MOP → MOP = "mop", 3Backward compatibility:
BOTH_WORK,ONLY_SWEEP,ONLY_MOP) are kept as aliases.from_value()is overridden to transparently accept the old string values (bothwork,onlysweep,onlymop).q10_set_clean_modestill accepts legacy choices alongside new ones.