Add Roborock Q10 switch entities - #175731
Conversation
|
Hey there @Lash-L, @allenporter, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
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
Q10SwitchTraitunion and addchild_lockanddust_collectiondescriptions. - Add
RoborockSwitchQ10ButtonLight, a write-onlyassumed_stateswitch that restores its state across restarts. - Refactor Q10 mock traits into reusable
conftesthelpers, 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. |
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.
RoborockSwitchDescriptionQ10list — the description's trait type widens fromDoNotDisturbTraitto aQ10SwitchTraitunion, everything else follows the merged DND pattern (push updates viaadd_update_listener)._attr_assumed_state, state only flips after a successful command, andRestoreEntitykeeps the assumed state across restarts.No dependency bump: targets
python-roborock==5.25.0, whichdevalready pins.Type of change
Testing
unknownwithassumed_state, on/off round-trip, a failed command not flipping the assumed state, and state restore after a restart.conftest.pygained small reusable helpers (attach_update_listeners,make_q10_switch_trait); the existing DND mock was ported onto them (behavior unchanged).test_switchsnapshot regenerated (additions only). Fulltests/components/roborocksuite passes locally (Python 3.14, python-roborock 5.25.0). Ruff, mypy (strict) and hassfest clean.Checklist