-
Notifications
You must be signed in to change notification settings - Fork 56
feat: Add initial Q10 support #709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 adds initial support for Q10 devices using the B01 protocol. The implementation forks the Q7 protocol and channel code to accommodate differences in how Q10 devices handle commands and responses, introduces a message streaming pattern for asynchronous message processing, and provides CLI support for sending commands.
Key Changes
- Forked B01 protocol implementation into separate Q7 and Q10 modules with distinct message encoding/decoding logic
- Added streaming message subscription pattern (
subscribe_stream) as an alternative to callback-based subscriptions - Implemented Q10 trait commands (start/pause/resume/stop clean, return to dock) with basic message processing loop
Reviewed changes
Copilot reviewed 24 out of 27 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/protocols/testdata/b01_protocol/q10/*.json | Test data files containing sample Q10 protocol messages for different device states |
| tests/protocols/test_b01_q10_protocol.py | Protocol encoding/decoding tests for Q10 messages |
| tests/protocols/test_b01_q07_protocol.py | Updated imports to use refactored Q7-specific protocol module |
| tests/protocols/snapshots/test_b01_q10_protocol.ambr | Snapshot assertions for Q10 protocol message decoding |
| tests/fixtures/channel_fixtures.py | Added subscribe_stream method to FakeChannel for testing streaming patterns |
| tests/devices/traits/b01/q7/test_init.py | Updated imports to use refactored Q7-specific modules |
| tests/devices/traits/b01/q10/test_init.py | Tests for Q10 trait API (subscription, command sending) |
| tests/devices/test_mqtt_channel.py | Test for subscribe_stream functionality |
| tests/data/test_code_mappings.py | Tests for new enum helper methods (from_code, from_name, from_value) |
| roborock/protocols/b01_q7_protocol.py | Refactored Q7 protocol with method-based command encoding |
| roborock/protocols/b01_q10_protocol.py | New Q10 protocol with simpler code-based command encoding (no padding) |
| roborock/devices/traits/traits_mixin.py | Added b01_q10_properties trait field |
| roborock/devices/traits/b01/q7/init.py | Updated imports for refactored Q7 channel module |
| roborock/devices/traits/b01/q10/init.py | Q10 trait implementation with command methods and message processing loop |
| roborock/devices/traits/b01/init.py | Exported Q10PropertiesApi |
| roborock/devices/mqtt_channel.py | Added subscribe_stream method for async iteration over messages |
| roborock/devices/device_manager.py | Added Q10 device detection and trait creation for "ss" model variants |
| roborock/devices/device.py | Added Q10 properties lifecycle management (start/close) |
| roborock/devices/b01_q7_channel.py | Updated imports for refactored Q7 protocol module |
| roborock/devices/b01_q10_channel.py | New channel wrapper for Q10 with send_command and stream_decoded_responses |
| roborock/data/code_mappings.py | Added from_name and from_value helper methods to RoborockModeEnum |
| roborock/cli.py | Added B01_Q10 command support with command parsing and error handling improvements |
Comments suppressed due to low confidence (1)
tests/devices/traits/b01/q7/test_init.py:19
- Incorrect import: B01_VERSION is being imported from roborock.protocols.b01_q10_protocol instead of roborock.protocols.b01_q7_protocol. This should be importing from the Q7 protocol module to match the refactored code structure where Q7 and Q10 have separate protocol implementations.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add initial Q10 device support. This device works a bit different than q7 so the protocol and channel are forked.