Repository navigation
Conversation
|
On hold following the review feedback on #933: please do not review the current cumulative diff. After the read-only and map-control stacks land, this draft will be rebased and repartitioned into focused changes:
Each part will be submitted sequentially against |
allenporter
left a comment
There was a problem hiding this comment.
Note: Conducting this code review following our /review skill using Antigravity (AGY) and Gemini 4 Argon.
I know this PR is marked as draft while waiting on the earlier PRs in the stack, so leaving high-level architectural feedback now to save rework when you rebase and split it:
-
Align
RoomCleaningTraitwith the standard Q10 push pattern:- Similar to the feedback on #937,
RoomCleaningTraitshouldn't emulate a blocking RPC with_write_lock,_pending_confirmation: asyncio.Future,asyncio.shield,_active_taskcancellation inclose(),_map_revision, andmap_changed_callbackwired intoMapsTrait. - Instead, keep
RoomCleaningTraitas a straightforward push-drivenUpdatableTrait:refresh()publishesCUSTOMER_CLEAN_REQUEST(DP 63: 0).set_settings(settings)encodes and publishesCUSTOMER_CLEAN(DP 62) without requiringrefresh()to have completed first or waiting on a confirmation future.clean(settings)publishesCUSTOMER_CLEAN,CLEAN_MODE, andSTART_CLEAN.update_from_dps()updatesself.settingsand notifies listeners.
- Similar to the feedback on #937,
-
Single
Q10RoomCleanSettings(RoborockBase)model without| intunions:- Rather than having separate
Q10RoomCleanSettingsandQ10ReportedRoomCleanSettingsmodels where every enum field is typed asEnumType | int, let's fall back to.UNKNOWNon unrecognized wire codes and use a singleQ10RoomCleanSettingsmodel.
- Rather than having separate
-
Remove hardcoded
model == "roborock.vacuum.ss07"gating:- All Q10 devices are routed by the
ssmodel prefix indevice_manager.py, and existingVacuumTraitmethods (set_clean_mode,set_fan_level,clean_zone,goto_position) are not gated toss07only. Let's removeadvanced_cleaning_supported/_raise_if_advanced_cleaning_unsupported().
- All Q10 devices are routed by the
-
Remove defensive runtime
isinstancechecks on statically typed parameters:- See inline comments in
roborock/protocols/b01_q10_protocol.pyandroborock/devices/traits/b01/q10/vacuum.py.
- See inline comments in
6c8075d to
0594819
Compare
allenporter
left a comment
There was a problem hiding this comment.
Note: Conducting this code review following our /review skill using Antigravity (AGY) and Gemini 4 Argon.
Thanks for the thorough update in 0594819! This is a big improvement—it cleanly addresses all four architectural points from the previous review (push-driven RoomCleaningTrait without confirmation futures/locks, single Q10RoomCleanSettings model, uniform Q10 behavior without ss07 model gating, and removal of runtime isinstance checks), and separating Q10RoomFanLevel (MAX_PLUS = 5) from YXFanLevel (MAX_PLUS = 8) makes complete sense.
I know this branch currently has a small merge conflict with main after #938 landed (around MapContentTrait / VacuumTrait in roborock/devices/traits/b01/q10/__init__.py), so leaving a few remaining review comments now for when you rebase:
- Consolidate
room_cleaning.clean()andvacuum.clean_rooms()ontoVacuumTrait.clean_rooms():- Calling
room_cleaning.clean(settings)directly skipsVacuumTrait.cancel_goto(), leaving any active emulatedgoto_positiontask armed, andRoomCleaningTrait.clean()doesn't read or mutate anyRoomCleaningTraitstate. Moving the 3-step command sequence directly intoVacuumTrait.clean_rooms()gives callers a single canonical task-starting API, guaranteescancel_goto()runs, and avoids addingroom_cleaningtoVacuumTrait.__init__(which also simplifies the rebase conflict inq10/__init__.py).
- Calling
- Use
settings: list[Q10RoomCleanSettings] | None = NoneonRoomCleaning:- Representing unpopulated state as
Noneand an empty push ("AA==") as[]removes the need for a separatesettings_availableboolean, useslistconsistently with other Q10 containers, and keepsas_dict()as{}before any push arrives.
- Representing unpopulated state as
- Fall back to
Q10CleanCount.UNKNOWNinQ10Status.clean_count_mode(and add unit test coverage intest_status.py). - Minor test colocation & cleanup in
test_room_cleaning.py,test_vacuum.py, andtest_b01_q10_protocol.py(see inline comments).
|
@hCoureau This branch has conflicts, |
|
@hCoureau This branch has conflicts |
Add Q10 per-room cleaning settings and customized room cleaning, plus global water level, pass count, and route controls.
room_cleaning.set_settings()publishes settings and requests a full update. Device pushes update typed settings throughDpsDataConverterandRoborockBase.Nonemeans no settings push has arrived;[]means the reported settings are empty. Full pushes replace the list, compact pushes merge reported rooms, and unchanged values do not notify listeners. Unknown firmware codes retain enum fallbacks, and malformed pushes leave cached settings unchanged.vacuum.clean_rooms()publishes settings, selects customized mode, and starts the selected rooms in sequence. A failed send stops subsequent commands; a successful start cancels an active emulated goto. Commands return after publication without changing reported settings.Validation on upstream
main(ed5f8591, 7.22.0):GitHub CI passed on
2f2ed78, including MQTT-broker suites on Python 3.11 and 3.14.No physical-device validation was run for this revision. Related: #767.