feat(clean): expose clean settings as HA entities (work mode / fan / water / mop strength / passes)#50
feat(clean): expose clean settings as HA entities (work mode / fan / water / mop strength / passes)#50jgus wants to merge 3 commits into
Conversation
Greptile SummaryThis PR adds Home Assistant
Confidence Score: 5/5Safe to merge; the new entity layer is well-isolated, restore logic is straightforward, and the protobuf payload changes are covered by real-device validation and 167 passing tests. The change introduces a clean shared-state design (CleanSettings dataclass) that three independent entity types write to and the clean-start path reads from. The FanLevel enum realignment is intentional and correctly handled through both the backward-compat alias map and the _FAN_LABELS reverse map. The whole-house start rerouting through start_rooms is architecturally sound. No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "fix(clean): whole-house start cleans all..." | Re-trigger Greptile |
…CleanParam (sjmotew#25, sjmotew#37) Room cleans were sent to clean/plan/start, but on Flow firmware that is StartWithPlan{planId, mapId} — it starts a saved plan by id and ignores any room payload, so the robot undocked and wandered instead of cleaning the selection. Switch start_rooms() to clean/start_clean (StartClean → CleanTask). Track the active map id (MapData.map_id, get_map field 2.1), which the CleanTask requires. clean/start_clean only works docked; from STANDBY the robot returns a new code 4 (CommandResult.NOT_READY) — retry briefly while docked. Build the CleanParam from named parameters: start_rooms() takes work_mode/fan/water/mop_strength/passes with defaults at the call site (vacuum-and-mop, standard suction/water/mop, single pass). Names and enums match the app's CleanTask proto: WorkMode (= robot_work_mode_*, whose value is CleanTask.taskType), corrected FanLevel/MopHumidity, added MopStrengthLevel; fan_speed labels use the app's user-visible suction names (quiet/standard/strong/super powerful/ultra powerful). Pre-rename fan_speed values (normal/max) remain accepted for back-compat. Validated live on a Flow 2: room clean returns SUCCESS and the robot cleans the selected rooms (confirmed via clean/current_clean_task/get). Both client copies synced. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…water / mop strength / passes) Adds Home Assistant controls for the room-clean parameters, backed by a CleanSettings dataclass on the coordinator (the single source the clean-start path reads): - select entities: work mode (Vacuum / Mop / Vacuum then mop / Vacuum and mop), mopping humidity (Slightly dry / Normal / Slightly wet), mop strength (Normal / High); - number entity: cleaning passes (1-3); - the vacuum's fan_speed is threaded through the same settings. Entity labels use the app's user-visible wording. Values persist across restarts via RestoreEntity (RestoreSelect / RestoreNumber / RestoreEntity) — set once and kept. async_clean_segments threads them into start_rooms; water and fan also apply live while cleaning. Built on sjmotew#49 (parameterized start_rooms / WorkMode). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
cc8b075 to
225274e
Compare
async_start sent clean/plan/start (StartWithPlan), which replays the saved current plan — the last room selection — so a whole-house Start re-ran the previous room-subset clean instead of cleaning the house. Enumerate every cleanable room and clean via clean/start_clean (start_rooms), matching the app's allRoomIds() path; fall back to the saved-plan start only when no map rooms are known. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Summary
Exposes the room-clean parameters decoded in #49 as Home Assistant controls, so users can set the work mode, suction, water, mop strength, and pass count and have them applied to room cleans.
What it adds
All are backed by a single
CleanSettingsdataclass on the coordinator (the source the clean-start path reads).async_clean_segmentsthreads them intostart_rooms; water and fan also apply live while the robot is cleaning.Persistence
Values persist across restarts via HA's
RestoreEntity(RestoreSelect/RestoreNumber/RestoreEntity) — set once and kept. No manual storage;restore_statereplays the last value intoCleanSettingson startup.Labels
Option labels use the app's user-visible wording (same convention as #49's fan labels). Two caveats:
CleanParamfield the app otherwise auto-manages).Testing
pytest tests/— all green (167).