Skip to content

Roborock: Q7 Model Split and Refactor#163769

Merged
allenporter merged 3 commits intohome-assistant:devfrom
lboue:feat/roborock-q7-from-dev
Feb 22, 2026
Merged

Roborock: Q7 Model Split and Refactor#163769
allenporter merged 3 commits intohome-assistant:devfrom
lboue:feat/roborock-q7-from-dev

Conversation

@lboue
Copy link
Copy Markdown
Contributor

@lboue lboue commented Feb 22, 2026

Proposed change

This PR separates and refactors all logic related to the Roborock Q7 model in the Home Assistant integration. The Q7-specific code is now unified under the b01_q7 coordinator, and all platform files (vacuum.py, sensor.py, select.py, etc.) have been updated to use this new structure. Duplicate class definitions have been removed, and all references to Q7 coordinators are now consistent.
To prepare for #163112.

Key Changes

  • Unified Q7 coordinator access under b01_q7 in all relevant modules.
  • Removed duplicate RoborockB01Q7UpdateCoordinator class definition.
  • Updated __init__.py, coordinator.py, vacuum.py, sensor.py, select.py, and related test files to use the new Q7 structure.
  • Fixed all import and attribute errors related to the Q7 split.
  • Ensured all tests pass after the refactor.
  • Merged latest changes from dev and resolved all conflicts.

Motivation

  • Improve maintainability and clarity by isolating Q7 logic.
  • Prepare for future Q7-specific features and bugfixes.
  • Ensure a clean and consistent codebase for both Q7 and other Roborock models.

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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

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:

Lash-L and others added 2 commits February 22, 2026 09:15
@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.

@lboue lboue marked this pull request as ready for review February 22, 2026 08:22
@lboue lboue requested a review from allenporter as a code owner February 22, 2026 08:22
Copilot AI review requested due to automatic review settings February 22, 2026 08:22
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

This PR refactors the Roborock integration to separate Q7-specific logic from the generic B01 protocol implementation. The Q7 coordinator and entities are now accessed via a dedicated b01_q7 attribute in the runtime data structure, making the codebase cleaner and preparing for the addition of other B01 protocol devices (like Q10) in the future. The refactor maintains RoborockDataUpdateCoordinatorB01 as a base class that can be extended by specific B01 device coordinators.

Changes:

  • Renamed runtime_data.b01 to runtime_data.b01_q7 throughout the codebase to specifically identify Q7 coordinators
  • Renamed entity base class from RoborockCoordinatedEntityB01 to RoborockCoordinatedEntityB01Q7 to reflect Q7-specific usage
  • Removed unnecessary isinstance checks when iterating over Q7 coordinators since b01_q7 list only contains Q7 coordinators
  • Updated test files to use the new b01_q7 attribute when accessing Q7 coordinators

Reviewed changes

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

Show a summary per file
File Description
coordinator.py Updated RoborockCoordinators dataclass to use b01_q7 field instead of b01 for Q7 coordinators
init.py Updated coordinator filtering logic to populate b01_q7_coords list and pass it to RoborockCoordinators
entity.py Renamed RoborockCoordinatedEntityB01 to RoborockCoordinatedEntityB01Q7 with specific Q7 coordinator typing
vacuum.py Updated Q7 vacuum entity to use RoborockCoordinatedEntityB01Q7 base class and iterate over b01_q7 coordinators
sensor.py Updated Q7 sensor entities to use new base class and coordinator type, iterating over b01_q7 coordinators
select.py Updated Q7 select entities to use new base class and removed unnecessary isinstance check
test_vacuum.py Updated test references from runtime_data.b01[0] to runtime_data.b01_q7[0]
Comments suppressed due to low confidence (1)

homeassistant/components/roborock/entity.py:150

  • There is a duplicate call to CoordinatorEntity.__init__. It's called on line 144 and again on line 150. Remove one of these duplicate calls - the second one on line 150 should be removed.
        CoordinatorEntity.__init__(self, coordinator=coordinator)
        RoborockEntity.__init__(
            self,
            unique_id=unique_id,
            device_info=coordinator.device_info,
        )
        CoordinatorEntity.__init__(self, coordinator=coordinator)

@allenporter allenporter merged commit b7fd127 into home-assistant:dev Feb 22, 2026
33 checks passed
@lboue lboue deleted the feat/roborock-q7-from-dev branch February 22, 2026 15:54
@github-actions github-actions bot locked and limited conversation to collaborators Feb 23, 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