Skip to content

refactor(q10): harmonize enum state values across Q10 modes#797

Closed
lboue wants to merge 3 commits intoPython-roborock:mainfrom
lboue:feat/q10-enum-value-harmonization
Closed

refactor(q10): harmonize enum state values across Q10 modes#797
lboue wants to merge 3 commits intoPython-roborock:mainfrom
lboue:feat/q10-enum-value-harmonization

Conversation

@lboue
Copy link
Contributor

@lboue lboue commented Mar 22, 2026

Proposed change

  • Harmonize Q10 state values exposed by python-roborock to make automation behavior more consistent across device variants.
  • Update YXDeviceState: FAULT_STATE changes from fault to error.
  • Update YXBackType: backdusting/backcharging become back_dusting/back_charging.
  • Update YXDeviceWorkMode: bothwork/onlysweep/onlymop become vac_and_mop/vacuum/mop, and saveworry/sweepmop become save_worry/sweep_mop.
  • Update YXDeviceCleanTask: divideareas/creatingmap become divide_areas/creating_map.

Tests

  • Added targeted tests in test_code_mappings.py to lock the new harmonized values.
  • Ran locally: uv run pytest tests/data/test_code_mappings.py
  • Result: 26 passed.

Notes

  • No backward-compatibility alias layer is included: exposed values intentionally move to the new harmonized labels.

@lboue lboue marked this pull request as ready for review March 22, 2026 16:25
Copilot AI review requested due to automatic review settings March 22, 2026 16:25
@allenporter allenporter requested a review from Lash-L March 22, 2026 16:26
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 Q10 (B01) code-mapping enums to expose more consistent, readable, cross-device state labels from python-roborock, and adds tests to lock the new values in place.

Changes:

  • Harmonize YXDeviceState.FAULT_STATE value from "fault" to "error".
  • Convert several Q10 enum string values to clearer snake_case / canonical labels (e.g., back_dusting, vac_and_mop, creating_map).
  • Add targeted unit tests asserting the updated enum .value strings.

Reviewed changes

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

File Description
roborock/data/b01_q10/b01_q10_code_mappings.py Updates Q10 enum exposed string values for fault/back type/work mode/clean task to harmonized labels.
tests/data/b01_q10/test_b01_q10_code_mappings.py Updates expected canonical status mapping to match FAULT_STATE="error".
tests/data/test_code_mappings.py Adds focused assertions for the newly harmonized Q10 enum values.

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

assert product.category == RoborockCategory.UNKNOWN


def test_yx_device_state_fault_uses_error_value() -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure these tests are super meaningful, plus we'd probably want them in the q10 directory instead of randomly split across the two directories. Please just revert.

@lboue lboue closed this Mar 25, 2026
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