Add vacuum return safeguards for short trips

This commit is contained in:
Carlo Costanzo
2026-04-15 16:26:53 -04:00
parent 955b691f4d
commit ee2ed4300c
2 changed files with 67 additions and 14 deletions

View File

@@ -80,6 +80,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.
- Family-return docking now ignores away windows shorter than 20 minutes so brief walks do not interrupt an active run, but still docks if the family stays home for 10 minutes.
- 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.

View File

@@ -17,6 +17,7 @@
# - If docked+completed still has queue entries, treat queue as stale and clear it before phase advance.
# - Mop phases use `sweeping_and_mopping` instead of mop-only.
# - One-off room clean booleans ignore the queue; they only run when the vacuum is docked/idle.
# - Family-return docking ignores away windows under 20 minutes to avoid short-walk false stops, but docks after 10 minutes home if the family stays put.
# - Formal Dining (room 17/dock) is excluded from phased queues; clean via one-off toggle.
# - Phase advancement no longer depends on a separate "ready" latch.
######################################################################
@@ -378,28 +379,79 @@ automation:
- platform: state
entity_id: group.family
to: 'home'
id: family_home
- platform: state
entity_id: group.family
to: 'home'
for: '00:10:00'
id: family_home_stable
- platform: state
entity_id: input_boolean.l10s_vacuum_on_demand
to: 'off'
id: on_demand_off
variables:
family_away_seconds: >
{% if trigger.id == 'family_home'
and trigger.from_state is not none
and trigger.from_state.state == 'not_home'
and trigger.from_state.last_changed is not none %}
{{ (as_timestamp(now()) - as_timestamp(trigger.from_state.last_changed)) | int(0) }}
{% else %}
999999
{% endif %}
condition:
- condition: template
value_template: >
{{ is_state('vacuum.l10s_vacuum', 'cleaning') or is_state('vacuum.l10s_vacuum', 'returning') or is_state('vacuum.l10s_vacuum', 'paused') }}
action:
- service: vacuum.pause
target:
entity_id: vacuum.l10s_vacuum
- delay: 00:00:10
- service: vacuum.return_to_base
target:
entity_id: vacuum.l10s_vacuum
- service: input_boolean.turn_off
target:
entity_id: input_boolean.l10s_vacuum_on_demand
- service: script.send_to_logbook
data:
topic: "VACUUM"
message: "Family home; docking vacuum and disabling On-Demand."
- choose:
- conditions:
- condition: template
value_template: "{{ trigger.id == 'family_home' and family_away_seconds < 1200 }}"
sequence:
- service: script.send_to_logbook
data:
topic: "VACUUM"
message: >
Family returned after {{ ((family_away_seconds | int(0)) / 60) | round(1) }}
minutes; leaving vacuum running unless we stay home for 10 minutes.
- conditions:
- condition: template
value_template: >
{{ trigger.id == 'family_home_stable' and is_state('input_boolean.l10s_vacuum_on_demand', 'on') }}
sequence:
- service: vacuum.pause
target:
entity_id: vacuum.l10s_vacuum
- delay: 00:00:10
- service: vacuum.return_to_base
target:
entity_id: vacuum.l10s_vacuum
- service: input_boolean.turn_off
target:
entity_id: input_boolean.l10s_vacuum_on_demand
- service: script.send_to_logbook
data:
topic: "VACUUM"
message: "Family stayed home for 10 minutes; docking vacuum and disabling On-Demand."
- conditions:
- condition: template
value_template: "{{ trigger.id in ['family_home', 'on_demand_off'] }}"
sequence:
- service: vacuum.pause
target:
entity_id: vacuum.l10s_vacuum
- delay: 00:00:10
- service: vacuum.return_to_base
target:
entity_id: vacuum.l10s_vacuum
- service: input_boolean.turn_off
target:
entity_id: input_boolean.l10s_vacuum_on_demand
- service: script.send_to_logbook
data:
topic: "VACUUM"
message: "Family home; docking vacuum and disabling On-Demand."
- alias: 'Away Vacuum: Confirm Room Cleaned'
id: c581c570-55b0-4acd-8b5d-53cfb486cc2a