Skip to content

Conversation

@allenporter
Copy link
Contributor

Add initial Q10 device support. This device works a bit different than q7 so the protocol and channel are forked.

  • Add CLI support for sending commands
  • Subscribe to messages with basic parsing/printing the debug log, but no capturing state
  • Listen to messages with a message stream and a while loop rather than callbacks (aiomqtt like)
  • Add trait commands for start clean/stop/pause/resume/return to dock/etc.

Copilot AI review requested due to automatic review settings December 27, 2025 05:04
Copy link
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 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant