Roborock: Q7 Model Split and Refactor#163769
Conversation
…ha_core into feat/roborock-q7-from-dev
|
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 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.b01toruntime_data.b01_q7throughout the codebase to specifically identify Q7 coordinators - Renamed entity base class from
RoborockCoordinatedEntityB01toRoborockCoordinatedEntityB01Q7to reflect Q7-specific usage - Removed unnecessary
isinstancechecks when iterating over Q7 coordinators sinceb01_q7list only contains Q7 coordinators - Updated test files to use the new
b01_q7attribute 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)
…inatedEntityB01Q7
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_q7coordinator, 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
b01_q7in all relevant modules.RoborockB01Q7UpdateCoordinatorclass definition.__init__.py,coordinator.py,vacuum.py,sensor.py,select.py, and related test files to use the new Q7 structure.devand resolved all conflicts.Motivation
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: