Skip to content

Initial room configuration support for Q10 devices#837

Open
lboue wants to merge 1 commit into
Python-roborock:mainfrom
lboue:q10_rooms
Open

Initial room configuration support for Q10 devices#837
lboue wants to merge 1 commit into
Python-roborock:mainfrom
lboue:q10_rooms

Conversation

@lboue

@lboue lboue commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds initial room configuration support for Q10 (B01 protocol) devices.

Introduces parsing for the CUSTOMER_CLEAN DPS payload and a dedicated RoomsTrait that is wired into Q10PropertiesApi. Room data is refreshed on demand and updated automatically via the subscribe loop.

What Changed

  • b01_q10_containers.py — new dataclasses (Q10RoomVertex, Q10RoomConfig, Q10RoomsConfig) and parse_customer_clean_payload() with upfront layout validation; sentinel values (0xFF / 0xFFFF) map to None; rr_* firmware names normalized via normalize_q10_room_name()
  • rooms.py — new RoomsTrait exposing refresh(), room_map, room_names, get_room(), get_room_name(), and update listener support
  • __init__.py — wires RoomsTrait into Q10PropertiesApi subscribe loop as api.rooms
  • Tests — parsing edge cases (sentinels, name length variants, multiple rooms), streaming updates, listener notifications, refresh request payload

Behaviour

  • Calling await api.rooms.refresh() sends the CUSTOMER_CLEAN_REQUEST DPS; the robot replies with a CUSTOMER_CLEAN update that is parsed automatically
  • api.rooms.room_names returns a dict[int, str] of room id → human-readable name
  • Firmware names like rr_living_room are normalized to Living Room

Validation

  • 13 focused Q10 rooms tests pass locally
  • Smoke-tested against a real Roborock Q10 account via local script

@lboue lboue marked this pull request as ready for review June 3, 2026 18:45
Copilot AI review requested due to automatic review settings June 3, 2026 18:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for reading and refreshing room configuration for Q10 (B01) devices, including parsing the CUSTOMER_CLEAN payload and exposing room helpers on the properties API.

Changes:

  • Introduces RoomsTrait and wires it into Q10PropertiesApi subscribe loop and helper methods.
  • Adds room-config parsing/container models for the CUSTOMER_CLEAN base64 payload.
  • Adds tests covering streaming updates, listener notifications, and refresh requests for room config.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
tests/devices/traits/b01/q10/test_rooms.py Adds integration-style tests for rooms streaming, listener behavior, and refresh request payload.
roborock/devices/traits/b01/q10/rooms.py Implements RoomsTrait to refresh and parse room configuration updates and notify listeners.
roborock/devices/traits/b01/q10/init.py Wires RoomsTrait into Q10PropertiesApi and adds convenience room helper APIs.
roborock/data/b01_q10/b01_q10_containers.py Adds dataclasses and parsing/normalization for the room configuration payload.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread roborock/devices/traits/b01/q10/rooms.py Outdated
Comment thread roborock/data/b01_q10/b01_q10_containers.py Outdated
Comment thread roborock/data/b01_q10/b01_q10_containers.py Outdated
Comment thread roborock/data/b01_q10/b01_q10_containers.py Outdated
Comment thread tests/devices/traits/b01/q10/test_rooms.py Outdated
Comment thread tests/devices/traits/b01/q10/test_rooms.py Outdated
Comment thread roborock/data/b01_q10/b01_q10_containers.py Outdated
Comment thread roborock/data/b01_q10/b01_q10_containers.py Outdated

assert parsed.declared_count == 1
assert parsed.parsed_count == 1
room = parsed.rooms[0]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test for an instance with multiple rooms?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — added test_parse_customer_clean_payload_with_multiple_rooms in tests/data/b01_q10/test_b01_q10_containers.py. It builds two rooms with different ids, names, and vertex counts and asserts both are parsed correctly.

Comment thread roborock/data/b01_q10/b01_q10_containers.py Outdated
Comment thread roborock/devices/traits/b01/q10/__init__.py Outdated
Comment thread roborock/devices/traits/b01/q10/__init__.py Outdated
Comment thread roborock/data/b01_q10/b01_q10_containers.py
Comment thread roborock/data/b01_q10/b01_q10_containers.py Outdated
Comment thread roborock/data/b01_q10/b01_q10_containers.py
Comment thread roborock/data/b01_q10/b01_q10_containers.py Outdated
Comment thread roborock/data/b01_q10/b01_q10_containers.py Outdated
Comment thread roborock/data/b01_q10/b01_q10_containers.py
@Lash-L Lash-L marked this pull request as draft June 19, 2026 11:36
@Lash-L

Lash-L commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Marking as draft, mark it as ready once you have addressed the reviews and we can take another look!

lboue added a commit to lboue/python-roborock that referenced this pull request Jun 26, 2026
- Remove room helper methods from Q10PropertiesApi (room_map, room_names,
  get_room, get_room_name, refresh_room_config) — callers use api.rooms.*
- Change sentinel values from -1 to None (int | None) for clean_order,
  clean_type, fan_level, water_level, material, clean_line
- Replace break-on-error parsing with upfront _validate_customer_clean_layout
  to avoid returning partial room data
- Extract raw_room_name field + room_name property on Q10RoomConfig
- Add _decode_q10_room_name and _u8/_u16_to_optional helpers
- Add test for multiple rooms and update sentinel assertions to check None
- Use iteration instead of exception in RoborockModeEnum.from_code_optional

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lboue lboue force-pushed the q10_rooms branch 2 times, most recently from cf3d03d to c37d4b8 Compare June 26, 2026 19:39
Introduces parsing for the CUSTOMER_CLEAN DPS payload and a RoomsTrait
that integrates into Q10PropertiesApi alongside the existing traits.

- New dataclasses Q10RoomVertex, Q10RoomConfig, Q10RoomsConfig with
  upfront layout validation; sentinel values (0xFF/0xFFFF) map to None
- normalize_q10_room_name() converts firmware rr_* slugs to title case
- RoomsTrait exposes refresh(), room_map, room_names, get_room(),
  get_room_name() and plugs into the _updatable_traits dispatch loop
- 13 tests: parsing edge cases, sentinel values, multiple rooms,
  streaming updates, listener notifications, refresh request payload

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lboue lboue marked this pull request as ready for review June 26, 2026 19:45
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.

4 participants