Skip to content

Add select entities for Roborock q10 s5+#166142

Merged
allenporter merged 38 commits intohome-assistant:devfrom
lboue:feat/roborock-q10-s5-plus-vacuum-select
Apr 7, 2026
Merged

Add select entities for Roborock q10 s5+#166142
allenporter merged 38 commits intohome-assistant:devfrom
lboue:feat/roborock-q10-s5-plus-vacuum-select

Conversation

@lboue
Copy link
Copy Markdown
Contributor

@lboue lboue commented Mar 21, 2026

Proposed change

This PR adds a cleaning mode select entity for the Roborock Q10 S5+ integration.

  • Added RoborockQ10CleanModeSelectEntity to expose cleaning mode selection in Home Assistant.
  • Mapped Q10 modes to existing keys for consistency:
    • BOTH_WORKvac_and_mop
    • ONLY_SWEEPvacuum
    • ONLY_MOPmop
  • Reused existing translation labels (no duplicate mode names).
  • YXCleanType.UNKNOWN is filtered out directly in the options property and treated as None in current_option, keeping the entity consistent with other select entities in the integration.
  • Added tests for current option, successful updates, and error handling.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

lboue added 3 commits March 21, 2026 20:52
Add select entity support for Q10 devices with:
- RoborockQ10CleanModeSelectEntity for setting cleaning mode
- Helper function _get_q10_cleaning_mode to extract current mode from Q10 data
- Integration with Q10UpdateCoordinator for push-based updates
- Support for YXCleanType enum modes (vacuum, vac_and_mop, mop, auto, etc.)
- Async command sending with set_clean_mode via Q10 vacuum trait

All existing select tests pass (18/18) for V1, Q7, and Zeo devices.
Add test coverage for the new RoborockQ10CleanModeSelectEntity:
- test_q10_cleaning_mode_select_current_option: Verify entity exists with valid options
- test_q10_cleaning_mode_select_update_success: Test setting a valid cleaning mode
- test_q10_cleaning_mode_select_update_failure: Test error handling when API call fails

All select tests pass (21/18 - 3 new Q10 tests added).
Add translation keys for Q10 specific cleaning modes:
- both_work: Vacuum and mop
- only_sweep: Vacuum only
- only_mop: Mop only

Keep existing Q7 mode translations for backward compatibility.
@home-assistant
Copy link
Copy Markdown

Hey there @Lash-L, @allenporter, mind taking a look at this pull request as it has been labeled with an integration (roborock) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of roborock can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign roborock Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

- Add _map_q10_clean_mode_to_state_key() function to map YXCleanType enum values to existing Q7 keys
- BOTH_WORK → vac_and_mop
- ONLY_SWEEP → vacuum
- ONLY_MOP → mop
- Remove duplicate translations from strings.json (both_work, only_sweep, only_mop)
- Update Q10 entity to use mapped state keys instead of enum names
- Update tests to use correct mapped option names
- All 21 select tests passing (18 existing + 3 Q10)
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

Adds a new select entity to the Roborock integration to control Q10 S5+ cleaning mode, with corresponding translations and tests.

Changes:

  • Add RoborockQ10CleanModeSelectEntity and wire it into async_setup_entry for Q10 coordinators.
  • Extend strings.json with additional cleaning_mode state translations used by Q10.
  • Add initial tests covering entity existence and service calls for the new Q10 select.

Reviewed changes

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

File Description
homeassistant/components/roborock/select.py Adds a Q10 cleaning mode select entity and setup wiring.
homeassistant/components/roborock/strings.json Adds translations for new Q10 cleaning mode option keys.
tests/components/roborock/test_select.py Adds tests for Q10 cleaning mode select existence and service behavior.

Comment thread homeassistant/components/roborock/select.py Outdated
Comment thread tests/components/roborock/test_select.py Outdated
Comment thread tests/components/roborock/test_select.py Outdated
Comment thread tests/components/roborock/test_select.py Outdated
Comment thread tests/components/roborock/test_select.py Outdated
Copilot AI review requested due to automatic review settings March 21, 2026 20:11
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 4 comments.

Comment thread homeassistant/components/roborock/select.py Outdated
Comment thread homeassistant/components/roborock/select.py Outdated
Comment thread tests/components/roborock/test_select.py Outdated
Comment thread tests/components/roborock/test_select.py Outdated
Copilot AI review requested due to automatic review settings March 21, 2026 21:19
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 2 comments.

Comment thread tests/components/roborock/test_select.py Outdated
Comment thread tests/components/roborock/test_select.py Outdated
@lboue lboue marked this pull request as ready for review March 21, 2026 21:24
@lboue lboue requested a review from allenporter as a code owner March 21, 2026 21:24
Comment thread homeassistant/components/roborock/select.py Outdated
Copilot AI review requested due to automatic review settings April 3, 2026 17:10
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 1 comment.

Comment thread homeassistant/components/roborock/select.py
Replace manual loop with next() + walrus operator.
YXCleanType is a StrEnum so members compare equal to their string values.
Copilot AI review requested due to automatic review settings April 3, 2026 17:28
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 1 comment.

Comment thread homeassistant/components/roborock/select.py
@lboue lboue marked this pull request as ready for review April 3, 2026 19:48
@home-assistant home-assistant bot requested a review from allenporter April 3, 2026 19:48
@lboue lboue requested a review from Copilot April 3, 2026 19:49
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 1 comment.

Comment thread homeassistant/components/roborock/select.py Outdated
Copy link
Copy Markdown
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.

One last change i think we need to make in the main library before we can submit this since there is a problem with the initial import (my mistake)

Comment thread homeassistant/components/roborock/select.py Outdated
@home-assistant home-assistant bot marked this pull request as draft April 5, 2026 22:37
Q10Status.clean_mode is now correctly typed as YXCleanType in the
library, so the intermediate from_code_optional lookup is no longer
needed.
Copilot AI review requested due to automatic review settings April 6, 2026 14:59
@lboue lboue marked this pull request as ready for review April 6, 2026 15:01
@home-assistant home-assistant bot requested a review from allenporter April 6, 2026 15: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

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

@allenporter
Copy link
Copy Markdown
Contributor

Nice work @lboue thank you!

@allenporter allenporter merged commit 7495796 into home-assistant:dev Apr 7, 2026
33 checks passed
@lboue lboue deleted the feat/roborock-q10-s5-plus-vacuum-select branch April 7, 2026 14:36
@github-actions github-actions bot locked and limited conversation to collaborators Apr 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants