From 7ab6f875f551e31153982e5490f34382c3c87216 Mon Sep 17 00:00:00 2001 From: Carlo Costanzo Date: Wed, 4 Feb 2026 16:58:59 -0500 Subject: [PATCH] Refine vacuum automation logic in README and vacuum.yaml. Updated phase change conditions to ensure the vacuum is not actively cleaning before advancing phases. Improved clarity in comments regarding task completion and queue management. --- config/packages/README.md | 2 +- config/packages/vacuum.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/packages/README.md b/config/packages/README.md index f024aa85..32ec6537 100755 --- a/config/packages/README.md +++ b/config/packages/README.md @@ -67,7 +67,7 @@ Live collection of plug-and-play Home Assistant packages. Each YAML file in this ### Dreame vacuum automations - Logic lives in [vacuum.yaml](vacuum.yaml): continuous four-phase loop (sweep main, sweep baths, mop main, mop baths) driven by `input_select.l10s_vacuum_phase` and `input_text.l10s_vacuum_room_queue`, with per-room notifications and automatic reseeding between phases. - Uses the Dreame HACS integration with segment IDs to enforce bathrooms last in each sweep/mop pass, dock on arrival, and auto-run if idle for 3+ days. -- Room queue advances on a 2-minute dwell in `sensor.l10s_vacuum_current_room` (queue = remaining rooms); phase changes happen when an empty queue is reseeded after a completed task. +- Room queue advances on a 2-minute dwell in `sensor.l10s_vacuum_current_room` (queue = remaining rooms); phase changes happen when an empty queue is reseeded and the vacuum is not actively cleaning. - One-off room cleaning for Alexa uses `input_boolean.l10s_vacuum_clean_*` (example: "Kitchen Clean") and runs a segment job without touching or checking the phased queue. - Formal Dining (room 17/dock) is excluded from phased queues; clean it via the one-off toggle. ![Dreame Automations](../www/custom_ui/floorplan/images/branding/Dreame%20Automations.png) diff --git a/config/packages/vacuum.yaml b/config/packages/vacuum.yaml index bf5cb4c5..3d4c7090 100755 --- a/config/packages/vacuum.yaml +++ b/config/packages/vacuum.yaml @@ -10,7 +10,7 @@ # Notes: # - `sensor.l10s_vacuum_current_room` can change during transit; require a dwell (`for:`) before dequeuing. # - Treat 2+ minutes in a room as "being cleaned" and dequeue immediately (queue = remaining rooms). -# - Phase changes happen when the queue is reseeded after task completion (queue is the source of truth). +# - Phase changes happen when the queue is reseeded after the queue hits zero and the vacuum is not actively cleaning (queue is the source of truth). # - Avoid reissuing `dreame_vacuum.vacuum_clean_segment` while already cleaning; only send a new segment job when starting/resuming or switching phases. # - Jinja2 loop scoping: use a `namespace` when building lists (otherwise the queue can appear empty and get cleared). # - Docked + task complete only logs queue state; no auto-clearing. @@ -125,10 +125,10 @@ script: next_phase: "{{ phase_order[phase_index + 1] if has_next_phase else '' }}" queue_raw: "{{ states('input_text.l10s_vacuum_room_queue') | default('', true) | string | replace(' ', '') }}" queue_ints: "{{ queue_raw | regex_findall('[0-9]+') | map('int') | select('gt', 0) | list }}" - task_status: "{{ states('sensor.l10s_vacuum_task_status') | default('', true) | string | lower }}" - task_completed: "{{ task_status == 'completed' }}" + vac_state: "{{ states('vacuum.l10s_vacuum') | default('', true) | string | lower }}" + vac_is_cleaning: "{{ vac_state == 'cleaning' }}" phase_ready: "{{ is_state('input_boolean.l10s_vacuum_phase_ready', 'on') }}" - advance_phase: "{{ queue_ints | length == 0 and task_completed and phase_ready }}" + advance_phase: "{{ queue_ints | length == 0 and phase_ready and not vac_is_cleaning }}" reset_cycle: "{{ advance_phase and not has_next_phase }}" phase_for_seed: "{{ next_phase if advance_phase and has_next_phase else phase }}" cleaning_mode: "{{ 'sweeping_and_mopping' if 'mop_' in phase_for_seed else 'sweeping' }}"