Repository navigation
feat(v1): expose per-room clean-then-mop via customize clean mode - #984
jevgenijostin wants to merge 3 commits into
Conversation
Follow-up to Python-roborock#959, which models the global get_status seq_type flag but explicitly leaves the per-room get/set_customize_clean_mode layer alone. Adds a CustomizeCleanModeTrait exposing each room's SegmentCleanMode (fan_power/water_box_mode/mop_mode/repeat/seq_type) and a set_clean_then_mop(segment, enabled, ...) setter, mirroring StatusTrait.clean_then_mop at room granularity.
| seq_type = _SEQ_TYPE_CLEAN_THEN_MOP if enabled else 0 | ||
| entry: dict[str, int] = { | ||
| "segment": segment, | ||
| "fan_power": fan_power, |
There was a problem hiding this comment.
is it ok to overwrite this with 0 when not specified? It seems almost like this is intended to be used where you need to pass back the previous state of SegmentCleanMode when you want to make a change.
Just curious: Did you consider trying to make this work with the Rooms trait? I can see it is fairly complex to do so, but ultimately i think to use this effectively its going to need to get the room information from Rooms to get the needed segment information for display, so i think there could be benefit from trying to hide those details, but its not trivial.
There was a problem hiding this comment.
@C:/Users/jevge/AppData/Local/Temp/claude/shots/review-reply2.txt
Tested against a real device: omitting mop_mode makes the device reject
the request outright ("Param error, no mop_mode"), it is not silently
defaulted. Omitting repeat does not preserve the room's existing value
either - the device resets it to 1. Address review feedback on Python-roborock#984.
|
Review assisted by Gemini 4 Argon in Antigravity. Note: it looks like your reply in #984 (comment) posted the literal file path Looking at the updated commit (
|
- Gate CustomizeCleanModeTrait on is_customized_clean_supported (the feature that actually covers get/set_customize_clean_mode) instead of is_clean_then_mop_mode_supported (which only gates the seq_type axis within it) - a device can support per-room custom modes without clean-then-mop specifically. - repeat now defaults to 1 instead of being left out of the wire request when unset: omitting it resets the room's repeat to 1 on the device rather than preserving the previous value, confirmed against a real device, so leaving it Optional was a footgun. - CustomizeCleanModeConverter now rejects a response list containing a non-dict entry instead of silently dropping it. - Corrected the module docstring's claim that the global clean_then_mop flag is per-job and clears after every clean - it's persisted, per StatusTrait.clean_then_mop's own docstring from Python-roborock#959. - Documented that StatusTrait reports sentinel "customized" codes (fan_power=106/water_box_mode=204/mop_mode=302) while a per-room custom mode is active, so it must not be used as a fallback source for those values when calling set_clean_then_mop on a room with no prior override. Addresses review feedback on Python-roborock#984.
|
Thanks, this is a thorough review and all of it checked out. Pushed 4142f21 addressing each point:
Also, sorry again for the garbled first reply, that was a genuine tooling slip on my end posting a literal file path - fixed now with the actual content. |
Summary
Follow-up to #959, which adds the global
clean_then_mopflag fromget_statusbut explicitly leaves the per-room layer alone:This PR models that per-room layer: a
CustomizeCleanModeTraitthat readsget_customize_clean_modeinto a list ofSegmentCleanMode(one per room with an override) and aset_clean_then_mop(segment, enabled, ...)setter that writesset_customize_clean_mode.Verification
Tested against a Roborock QV 35S (
roborock.vacuum.a168).get_customize_clean_modestarts empty ([]) until a room has actually had a custom mode set from the app or API. Round-tripped a write/read on one room:then reset back to
seq_type: 0to leave the room's real setting unchanged.Notes
is_clean_then_mop_mode_supportedas the feature gate, same as feat(v1): expose clean-then-mop status from the device #959's global trait. No device has been found that supports one layer but not the other - the vendor app presents a single "vacuum then mop" toggle that can be applied globally or per room, backed by the same underlying setting.StatusTrait.clean_then_mop/set_clean_then_mop's shape and docstrings at room granularity on purpose, so the two read the same way.uv run pytestpasses locally; new tests intests/devices/traits/v1/test_customize_clean_mode.py.Motivation
Lets a consumer (e.g. Home Assistant) expose "vacuum then mop" as a per-room choice, matching the Roborock app's own room-settings screen, not just the global job-level toggle from #959.