Skip to content

Add Roborock Q10 switch entities - #175731

Merged
joostlek merged 1 commit into
home-assistant:devfrom
tubededentifrice:roborock-q10-switch
Jul 6, 2026
Merged

Add Roborock Q10 switch entities#175731
joostlek merged 1 commit into
home-assistant:devfrom
tubededentifrice:roborock-q10-switch

Conversation

@tubededentifrice

Copy link
Copy Markdown
Contributor

Proposed change

Adds the remaining switch entities for the Roborock Q10 (B01/ss07), following the merged Q10 DND switch pattern. Split out to one platform per PR as requested in #173883; number and image are separate PRs.

  • Child lock and dust collection (dock auto-empty) extend the existing RoborockSwitchDescriptionQ10 list — the description's trait type widens from DoNotDisturbTrait to a Q10SwitchTrait union, everything else follows the merged DND pattern (push updates via add_update_listener).
  • Indicator / button light: the device never reports the light state, so this switch is write-only — _attr_assumed_state, state only flips after a successful command, and RestoreEntity keeps the assumed state across restarts.

No dependency bump: targets python-roborock==5.25.0, which dev already pins.

Type of change

  • New feature (which adds functionality to an existing integration)

Testing

  • The Q10 switch tests are parametrized across DND / child lock / dust collection (on/off round-trip through the trait listener, and failure paths asserting the translated error).
  • Dedicated button-light tests: starts unknown with assumed_state, on/off round-trip, a failed command not flipping the assumed state, and state restore after a restart.
  • The Q10 mock trait in conftest.py gained small reusable helpers (attach_update_listeners, make_q10_switch_trait); the existing DND mock was ported onto them (behavior unchanged).
  • test_switch snapshot regenerated (additions only). Full tests/components/roborock suite passes locally (Python 3.14, python-roborock 5.25.0). Ruff, mypy (strict) and hassfest clean.

Checklist

  • The code change is tested and works locally.
  • Local 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.
  • Tests have been added to verify that the new code works.

Copilot AI review requested due to automatic review settings July 6, 2026 04:57
@home-assistant home-assistant Bot added cla-signed has-tests integration: roborock new-feature Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage labels Jul 6, 2026
@home-assistant

home-assistant Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

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 mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from 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 update-branch Update the pull request branch with the base branch.
  • @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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds the remaining B01 Q10 (ss07) switch entities to the Roborock integration, following the previously merged Q10 Do-Not-Disturb switch pattern. Child lock and dust collection are added by extending the existing Q10_SWITCH_DESCRIPTIONS list (the description's trait type widens from DoNotDisturbTrait to a new Q10SwitchTrait union), reusing the push-based trait-listener update model. A separate indicator / button light switch is added as a write-only, assumed-state entity backed by RestoreEntity, since the device never reports the light's state. Test fixtures, parametrized tests, snapshots, translations, and icons are updated accordingly. No dependency bump is included (python-roborock==5.25.0 is already pinned).

Changes:

  • Widen the Q10 switch description trait type to a Q10SwitchTrait union and add child_lock and dust_collection descriptions.
  • Add RoborockSwitchQ10ButtonLight, a write-only assumed_state switch that restores its state across restarts.
  • Refactor Q10 mock traits into reusable conftest helpers, add parametrized/dedicated tests, snapshots, strings, and icons.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
homeassistant/components/roborock/switch.py Adds trait union, child lock/dust collection descriptions, and the write-only button light switch entity.
homeassistant/components/roborock/strings.json Adds button_light and dust_collection name translations.
homeassistant/components/roborock/icons.json Adds icons for button_light and dust_collection.
tests/components/roborock/conftest.py Adds reusable Q10 mock trait helpers and new child lock/dust collection/button light traits.
tests/components/roborock/test_switch.py Parametrizes Q10 switch success/failure tests and adds button light assumed-state, restore, and failure tests.
tests/components/roborock/snapshots/test_switch.ambr Adds registry/state snapshots for the three new Q10 switch entities.

Comment thread homeassistant/components/roborock/switch.py
@joostlek
joostlek merged commit cf3562b into home-assistant:dev Jul 6, 2026
33 checks passed
@tubededentifrice
tubededentifrice deleted the roborock-q10-switch branch July 6, 2026 14:18
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed has-tests integration: roborock new-feature Quality Scale: silver Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants