Skip to content

Commit 6fe0da7

Browse files
authored
Merge branch 'main' into copilot_review_skill_trick
2 parents b829958 + 5787a6f commit 6fe0da7

14 files changed

Lines changed: 461 additions & 8 deletions

File tree

‎.agents/skills/code-review/SKILL.md‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ All reviews are evaluated against the engineering conventions defined in [AGENTS
1313

1414
## Review Workflow
1515

16-
1. **Classify Changed Files by Layer**:
17-
Group changed files according to the 3-tier architectural hierarchy:
16+
1. **Classify Changed Files & Scope**:
17+
Group changed files according to the 3-tier architectural hierarchy and evaluate PR scoping:
1818
- **Priority 1: Public Trait APIs & Consumer Contracts** (`roborock/devices/traits/`, `roborock/data/containers.py`)
19-
- **Priority 2: Data Lifecycle & State Management** (trait state, callbacks, `RoborockDevice.close()`)
19+
- **Priority 2: Data Lifecycle & State Management** (trait state, callbacks, `RoborockDevice.close()`, map/render pipelines)
2020
- **Priority 3: Wire Protocols, Codecs & Cryptography** (`roborock/protocols/`, `roborock/devices/transport/`, `roborock/devices/rpc/`)
21+
- **PR Scoping**: Flag PRs that mix unrelated subsystems or combine large protocol/parser additions with trait consumption when they should be split into focused PRs.
22+
- **Automated Conformance**: Structural invariants (`RoborockBase` inheritance, `RoborockEnum` fallback members, `RoborockException` rooting, and trait boundary types) are enforced in `tests/conformance/`. Flag any unjustified allowlist exemptions added to `tests/conformance/` and focus deeper review energy on semantic, lifecycle, and design issues.
2123

2224
2. **Evaluate Layer 1: Public Trait APIs & Consumer Contracts**:
2325
- Are trait models subclassing `RoborockBase` with `@dataclass`?
@@ -28,9 +30,11 @@ All reviews are evaluated against the engineering conventions defined in [AGENTS
2830
- Are trait abstractions consumer-agnostic (not hardcoded exclusively to Home Assistant entities)?
2931
- Are transport details (keys, tokens, sockets) cleanly isolated from traits?
3032

31-
3. **Evaluate Layer 2: Lifecycle, State & Simplification**:
33+
3. **Evaluate Layer 2: Lifecycle, State & Concurrency**:
3234
- **Value-Returning Helpers**: Do helper functions return values instead of modifying `self` via hidden side effects?
3335
- **Direct Flow**: Is the execution path straightforward and direct, avoiding unnecessary indirection or ping-ponging between methods?
36+
- **Render & Cache Immutability**: Are cached telemetry state and raw packets kept immutable during presentation/rendering? When caching derived state (e.g., parsed maps or calibration), is cache invalidation handled accurately across out-of-order or concurrent updates?
37+
- **Event Loop Safety**: Are CPU-intensive operations (e.g., heavy map decompression or PIL image rendering) kept off the `asyncio` event loop (such as via `asyncio.to_thread`) with proper concurrency/staleness guards?
3438
- **Concurrency**: Does 1:1 async command-response matching use `asyncio.Future` correlated by protocol request/sequence ID (`request_id` or `msg_id`)?
3539
- **Teardown**: Are all tasks, event listeners, and channels cleanly unhooked in `RoborockDevice.close()`?
3640
- **Capability Gating**: Is capability gating checking protocol version, category (appropriate for device family), and device feature flags?
@@ -52,3 +56,6 @@ All reviews are evaluated against the engineering conventions defined in [AGENTS
5256
- **Issue / Anti-Pattern Identified**
5357
- **Grounded Rationale** (citing protocol resilience, consumer stability, or maintainability)
5458
- **Concrete Before / After Diff or Suggested Fix**
59+
Keep feedback high-signal: focus on architectural violations, state/concurrency bugs, protocol safety, and test gaps; avoid nitpicking formatting or style already enforced by Ruff and Mypy.
60+
- **Interactive / Summary Reviews**: Group findings by Priority Layer (1 → 3) with file references, the anti-pattern identified, grounded rationale (citing protocol resilience, consumer stability, or maintainability), and a concrete before/after diff or suggested fix.
61+
- **Inline PR Review Comments**: State the issue, grounded rationale (citing `AGENTS.md` conventions), and suggested fix concisely right on the affected lines.

‎CHANGELOG.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
<!-- version list -->
44

5+
## v7.13.0 (2026-10-17)
6+
7+
### Features
8+
9+
- Register P30 Pro and decode water and dock status
10+
([#983](https://github.com/Python-roborock/python-roborock/pull/983),
11+
[`e46d5ad`](https://github.com/Python-roborock/python-roborock/commit/e46d5ad6885f96dc049deba074295bd1f2cd2ae7))
12+
13+
514
## v7.12.4 (2026-10-17)
615

716
### Bug Fixes

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "python-roborock"
3-
version = "7.12.4"
3+
version = "7.13.0"
44
description = "A package to control Roborock vacuums."
55
authors = [{ name = "humbertogontijo", email = "humbertogontijo@users.noreply.github.com" }, {name="Lash-L"}, {name="allenporter"}]
66
requires-python = ">=3.11, <4"

‎roborock/const.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
ROBOROCK_S8_PRO_ULTRA = "roborock.vacuum.a70"
4848
ROBOROCK_S8 = "roborock.vacuum.a51"
4949
ROBOROCK_P10 = "roborock.vacuum.a75" # also known as q_revo
50+
ROBOROCK_P30_PRO = "roborock.vacuum.a306"
5051
ROBOROCK_S8_MAXV_ULTRA = "roborock.vacuum.a97"
5152
ROBOROCK_QREVO_S = "roborock.vacuum.a104"
5253
ROBOROCK_QREVO_PRO = "roborock.vacuum.a101"
@@ -77,6 +78,7 @@
7778
ROBOROCK_S4_MAX,
7879
ROBOROCK_S7,
7980
ROBOROCK_P10,
81+
ROBOROCK_P30_PRO,
8082
ROBOROCK_Q10,
8183
ROCKROBO_G10_SG,
8284
]

‎roborock/data/v1/v1_clean_modes.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class WaterModes(RoborockModeEnum):
5555
CUSTOM = ("custom_water_flow", 207)
5656
EXTREME = ("extreme", 208)
5757
SMART_MODE = ("smart_mode", 209)
58+
SMART_WATER = ("smart_water", 210)
5859
PURE_WATER_FLOW_START = ("slight", 221)
5960
PURE_WATER_FLOW_SMALL = ("low", 225)
6061
PURE_WATER_FLOW_GENTLE = ("gentle", 230)
@@ -207,6 +208,8 @@ def _resolve_water_slide_mode(code: int) -> WaterModes | None:
207208
"""Resolve a raw slider code to the water mode for its app range."""
208209
if code == 200:
209210
return WaterModes.OFF
211+
if code == WaterModes.SMART_WATER.code:
212+
return WaterModes.SMART_WATER
210213
position = code - 220
211214
if position < 1:
212215
return None

‎roborock/data/v1/v1_code_mappings.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ class RoborockDockTypeCode(RoborockEnum):
386386
f1s_dock = 44
387387
o7h_dock = 45
388388
f1c_dock = 46
389+
type_49_dock = 49
389390

390391

391392
class RoborockDockDustCollectionModeCode(RoborockEnum):

‎tests/__snapshots__/test_supported_features.ambr‎

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,183 @@
11
# serializer version: 1
2+
# name: test_device_features_from_home_data[home_data_device_p30_pro.json]
3+
dict({
4+
'is_activate_video_charging_and_standby_supported': True,
5+
'is_ai_recognition_obstacle_supported': True,
6+
'is_ai_recognition_setting_supported': True,
7+
'is_analysis_supported': False,
8+
'is_any_state_transit_goto_supported': True,
9+
'is_auto_collection_2_supported': True,
10+
'is_auto_delivery_field_in_global_status_supported': True,
11+
'is_auto_tear_down_mop_supported': False,
12+
'is_avoid_collision_mode_supported': True,
13+
'is_avoid_collision_supported': True,
14+
'is_back_charge_auto_wash_supported': True,
15+
'is_back_wash_new_smart_supported': True,
16+
'is_careful_slow_mop_supported': True,
17+
'is_carpet_custom_clean_supported': True,
18+
'is_carpet_deep_clean_supported': True,
19+
'is_carpet_long_haired_ex_supported': False,
20+
'is_carpet_long_haired_supported': False,
21+
'is_carpet_pressure_use_origin_paras_supported': False,
22+
'is_carpet_shape_type_supported': True,
23+
'is_carpet_show_on_map': True,
24+
'is_carpet_supported': True,
25+
'is_ces_2022_supported': False,
26+
'is_clean_count_setting_supported': True,
27+
'is_clean_direct_status_supported': True,
28+
'is_clean_efficiency_supported': True,
29+
'is_clean_fluid_delivery_supported': True,
30+
'is_clean_history_time_line_supported': True,
31+
'is_clean_route_deep_slow_plus_supported': False,
32+
'is_clean_route_fast_mode_supported': True,
33+
'is_clean_route_setting_supported': True,
34+
'is_clean_then_mop_mode_supported': True,
35+
'is_clean_time_line_supported': True,
36+
'is_collect_dust_count_show_supported': True,
37+
'is_collect_dust_mode_supported': True,
38+
'is_corner_clean_mode_supported': False,
39+
'is_corner_mop_stretch_supported': True,
40+
'is_ctm_with_repeat_supported': True,
41+
'is_current_map_restore_enabled': True,
42+
'is_custom_clean_mode_count_supported': True,
43+
'is_custom_mode_supported': True,
44+
'is_custom_water_box_distance_supported': True,
45+
'is_customized_clean_supported': True,
46+
'is_detect_wire_carpet_supported': True,
47+
'is_dirty_object_detect_supported': True,
48+
'is_dirty_replenish_clean_supported': True,
49+
'is_dry_interval_timer_supported': True,
50+
'is_dss_believable': True,
51+
'is_dual_band_wi_fi_supported': True,
52+
'is_dust_collection_setting_supported': True,
53+
'is_dynamically_add_clean_zones_supported': True,
54+
'is_dynamically_skip_clean_zone_supported': True,
55+
'is_egg_dance_mode_supported': True,
56+
'is_egg_mode_supported_from_new_features': False,
57+
'is_exact_custom_mode_supported': True,
58+
'is_exhibition_function_supported': False,
59+
'is_floor_dir_clean_any_time_supported': True,
60+
'is_flow_led_setting_supported': False,
61+
'is_follow_low_obs_supported': False,
62+
'is_full_duples_switch_supported': True,
63+
'is_fw_filter_obstacle_supported': True,
64+
'is_gap_deep_clean_supported': False,
65+
'is_goto_pure_clean_path_supported': True,
66+
'is_hot_wash_towel_supported': True,
67+
'is_identify_room_supported': True,
68+
'is_ignore_unknown_map_object_supported': True,
69+
'is_lds_lifting_supported': True,
70+
'is_led_status_switch_supported': False,
71+
'is_left_water_drain_supported': True,
72+
'is_low_area_access_supported': True,
73+
'is_main_brush_up_down_supported_from_str': True,
74+
'is_map_beautify_internal_debug_supported': True,
75+
'is_map_carpet_add_support': True,
76+
'is_map_eraser_supported': True,
77+
'is_matter_supported': True,
78+
'is_max_plus_mode_supported': True,
79+
'is_max_zone_opened_supported': True,
80+
'is_mechanical_arm_mode_supported': False,
81+
'is_midway_back_to_dock_supported': True,
82+
'is_min_battery_15_to_clean_task_supported': True,
83+
'is_mop_forbidden_supported': False,
84+
'is_mop_path_supported': True,
85+
'is_mop_shake_module_supported': False,
86+
'is_mop_shake_water_max_supported': True,
87+
'is_multi_floor_supported': False,
88+
'is_multi_map_segment_timer_supported': True,
89+
'is_new_ai_recognition_supported': True,
90+
'is_new_data_for_clean_history': True,
91+
'is_new_data_for_clean_history_detail': True,
92+
'is_new_endpoint_supported': True,
93+
'is_new_remote_view_supported': True,
94+
'is_no_need_carpet_press_set_supported': True,
95+
'is_none_pure_clean_mop_with_max_plus': False,
96+
'is_object_detect_check_supported': True,
97+
'is_offline_map_supported': True,
98+
'is_optimize_battery_supported': False,
99+
'is_order_clean_supported': False,
100+
'is_over_sea_ctm_supported': True,
101+
'is_pet_snapshot_supported': True,
102+
'is_pet_supplies_deep_clean_supported': True,
103+
'is_program_mode_supported': False,
104+
'is_pumping_water_supported': False,
105+
'is_pure_clean_mop_supported': True,
106+
'is_re_segment_supported': True,
107+
'is_record_allowed': True,
108+
'is_remote_supported': False,
109+
'is_right_brush_stretch_supported': False,
110+
'is_roller_mop_supported': True,
111+
'is_room_name_supported': True,
112+
'is_rpc_retry_supported': True,
113+
'is_rubber_brush_carpet_supported': False,
114+
'is_set_child_supported': True,
115+
'is_setting_carpet_first_supported': True,
116+
'is_shake_mop_set_supported': True,
117+
'is_should_show_arm_over_load_supported': True,
118+
'is_show_clean_finish_reason_supported': True,
119+
'is_show_general_obstacle_supported': False,
120+
'is_show_obstacle_photo_supported': False,
121+
'is_side_brush_lift_carpet_supported': True,
122+
'is_small_side_mop_supported': False,
123+
'is_smart_clean_mode_set_supported': True,
124+
'is_soak_and_wash_supported': True,
125+
'is_soft_clean_mode_supported': False,
126+
'is_sr_map_supported': False,
127+
'is_super_deep_wash_supported': True,
128+
'is_support_api_app_stop_grasp_supported': True,
129+
'is_support_backup_map': True,
130+
'is_support_clean_estimate': True,
131+
'is_support_cliff_zone': True,
132+
'is_support_custom_carpet': False,
133+
'is_support_custom_dnd': True,
134+
'is_support_custom_door_sill': True,
135+
'is_support_custom_mode_in_cleaning': True,
136+
'is_support_fetch_timer_summary': False,
137+
'is_support_floor_direction': True,
138+
'is_support_floor_edit': True,
139+
'is_support_furniture': True,
140+
'is_support_get_particular_status_supported': True,
141+
'is_support_incremental_map': True,
142+
'is_support_main_brush_up_down_supported': True,
143+
'is_support_mop_back_pwm_set': False,
144+
'is_support_quick_map_builder': True,
145+
'is_support_remote_control_in_call': True,
146+
'is_support_room_tag': True,
147+
'is_support_set_switch_map_mode': True,
148+
'is_support_set_volume_in_call': True,
149+
'is_support_side_brush_up_down_supported': False,
150+
'is_support_smart_door_sill': True,
151+
'is_support_smart_global_clean_with_custom_mode': True,
152+
'is_support_smart_scene': True,
153+
'is_support_stuck_zone': True,
154+
'is_support_voice_control_debug': False,
155+
'is_support_water_mode': True,
156+
'is_supported_download_test_voice': True,
157+
'is_supported_drying': True,
158+
'is_supported_valley_electricity': True,
159+
'is_sync_server_name_supported': True,
160+
'is_three_d_mapping_inner_test_supported': False,
161+
'is_tidyup_zones_supported': False,
162+
'is_two_gears_no_collision_supported': True,
163+
'is_two_key_real_time_video_supported': True,
164+
'is_two_key_rtv_in_charging_supported': True,
165+
'is_type_identify_supported': False,
166+
'is_unsave_map_reason_supported': True,
167+
'is_uvc_sterilize_supported': False,
168+
'is_video_monitor_supported': True,
169+
'is_video_patrol_supported': True,
170+
'is_video_setting_supported': True,
171+
'is_voice_control_led_supported': False,
172+
'is_voice_control_supported': True,
173+
'is_wash_then_charge_cmd_supported': True,
174+
'is_water_leak_check_supported': True,
175+
'is_water_slide_mode_supported': True,
176+
'is_water_up_down_drain_supported': True,
177+
'is_wifi_manage_supported': True,
178+
'is_workday_holiday_supported': True,
179+
})
180+
# ---
2181
# name: test_device_features_from_home_data[home_data_device_pearls.json]
3182
dict({
4183
'is_activate_video_charging_and_standby_supported': False,

‎tests/devices/traits/v1/__snapshots__/test_device_features.ambr‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
# serializer version: 1
2+
# name: test_is_attribute_supported[home_data_device_p30_pro.json]
3+
dict({
4+
'battery': True,
5+
'charge_status': True,
6+
'clean_fluid_status': False,
7+
'clean_percent': True,
8+
'clear_water_box_status': True,
9+
'dirty_water_box_status': True,
10+
'dock_error_status': True,
11+
'dry_status': True,
12+
'error_code': True,
13+
'fan_power': True,
14+
'rdt': True,
15+
'state': True,
16+
'water_box_carriage_status': True,
17+
'water_box_mode': True,
18+
'water_box_status': True,
19+
'water_shortage_status': True,
20+
})
21+
# ---
222
# name: test_is_attribute_supported[home_data_device_pearls.json]
323
dict({
424
'battery': True,
@@ -139,6 +159,13 @@
139159
'water_shortage_status': True,
140160
})
141161
# ---
162+
# name: test_is_consumable_field_supported[home_data_device_p30_pro.json]
163+
dict({
164+
'filter_work_time': True,
165+
'main_brush_work_time': True,
166+
'side_brush_work_time': True,
167+
})
168+
# ---
142169
# name: test_is_consumable_field_supported[home_data_device_pearls.json]
143170
dict({
144171
'filter_work_time': True,

‎tests/devices/traits/v1/test_status.py‎

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
get_current_cleaning_mode,
1717
resolve_cleaning_mode,
1818
)
19-
from roborock.data import SHORT_MODEL_TO_ENUM, RoborockProductNickname
19+
from roborock.data import SHORT_MODEL_TO_ENUM, HomeDataDevice, RoborockProductNickname
2020
from roborock.data.v1 import (
2121
RoborockChargeStatus,
2222
RoborockDockErrorCode,
2323
RoborockDockState,
24+
RoborockDockTypeCode,
2425
RoborockErrorCode,
2526
RoborockStateCode,
2627
)
@@ -87,6 +88,35 @@ async def test_refresh_status_dict_response(status_trait: StatusTrait, mock_rpc_
8788
mock_rpc_channel.send_command.assert_called_once_with(RoborockCommand.GET_STATUS)
8889

8990

91+
@pytest.mark.parametrize("device_info", [HomeDataDevice.from_dict(mock_data.P30_PRO_DEVICE_DATA)])
92+
@pytest.mark.parametrize(
93+
("water_box_mode", "expected_name"),
94+
[(210, "smart_water"), (230, "gentle")],
95+
)
96+
async def test_refresh_status_p30_pro(
97+
device_info: HomeDataDevice,
98+
discover_features_fixture: None,
99+
status_trait: StatusTrait,
100+
mock_rpc_channel: AsyncMock,
101+
water_box_mode: int,
102+
expected_name: str,
103+
) -> None:
104+
"""Test refreshing P30 Pro status with smart water or a manual slider value."""
105+
mock_rpc_channel.send_command.return_value = [
106+
{**STATUS, "fan_power": 103, "water_box_mode": water_box_mode, "mop_mode": 300, "dock_type": 49}
107+
]
108+
109+
await status_trait.refresh()
110+
111+
assert status_trait.fan_speed_name == "turbo"
112+
assert status_trait.water_box_mode == water_box_mode
113+
assert status_trait.water_mode_name == expected_name
114+
assert status_trait.mop_route_name == "standard"
115+
assert status_trait.current_cleaning_mode == CleaningMode.VAC_AND_MOP
116+
assert status_trait.dock_type == RoborockDockTypeCode.type_49_dock
117+
mock_rpc_channel.send_command.assert_awaited_once_with(RoborockCommand.GET_STATUS)
118+
119+
90120
async def test_refresh_status_propagates_exception(status_trait: StatusTrait, mock_rpc_channel: AsyncMock) -> None:
91121
"""Test that exceptions from RPC channel are propagated."""
92122
mock_rpc_channel.send_command.side_effect = RoborockException("Communication error")
@@ -769,6 +799,7 @@ def test_water_slide_mode_mapping() -> None:
769799
("water_box_mode", "expected_name"),
770800
[
771801
(200, "off"),
802+
(210, "smart_water"),
772803
(221, "slight"),
773804
(223, "slight"),
774805
(224, "low"),

‎tests/mock_data.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
Q10_DEVICE_DATA = DEVICES["home_data_device_q10.json"]
148148
ZEO_ONE_DEVICE_DATA = DEVICES["home_data_device_zeo_one.json"]
149149
SAROS_10R_DEVICE_DATA = DEVICES["home_data_device_saros_10r.json"]
150+
P30_PRO_DEVICE_DATA = DEVICES["home_data_device_p30_pro.json"]
150151

151152
# All testdata devices joined with their matching product (keyed by device filename).
152153
# Devices whose productId has no corresponding product file are omitted.
@@ -176,6 +177,7 @@
176177
"product-id-a123": RoborockDockTypeCode.pearl_plus_dock, # PearlS Lite / Q Revo (Wash/Empty)
177178
"product-saros-10": RoborockDockTypeCode.o4_dock, # Saros 10 / Q Revo Pro (Wash/Empty/Auto Fluid)
178179
"product-saros-10r": RoborockDockTypeCode.o6_dock, # JC / Q Revo Master (Wash/Empty/Hot water)
180+
"product-id-a306": RoborockDockTypeCode.type_49_dock, # P30 Pro (Wash/Empty/Dry)
179181
}
180182

181183

0 commit comments

Comments
 (0)