Skip to content

Commit 63e5709

Browse files
committed
Enhance vacuum automation with improved state handling and logging. Added conditions for resuming from dock when a queue exists, refined queue checks, and updated logbook messages for better tracking of vacuum operations.
1 parent db26d84 commit 63e5709

1 file changed

Lines changed: 72 additions & 2 deletions

File tree

config/packages/vacuum.yaml

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,8 @@ automation:
356356
entity_id: input_boolean.l10s_vacuum_on_demand
357357
state: 'on'
358358
variables:
359+
vac_state: "{{ states('vacuum.l10s_vacuum') | default('', true) | string | lower }}"
360+
is_docked: "{{ vac_state == 'docked' }}"
359361
queue_raw: "{{ states('input_text.l10s_vacuum_room_queue') | default('', true) | trim }}"
360362
queue_empty: "{{ queue_raw == '' }}"
361363
phase_order: ['sweep_main', 'sweep_bath', 'mop_main', 'mop_bath']
@@ -368,7 +370,7 @@ automation:
368370
- choose:
369371
- conditions:
370372
- condition: template
371-
value_template: "{{ queue_empty }}"
373+
value_template: "{{ queue_empty and vac_state != 'cleaning' }}"
372374
sequence:
373375
- service: script.send_to_logbook
374376
data:
@@ -419,7 +421,50 @@ automation:
419421
default: []
420422
- conditions:
421423
- condition: template
422-
value_template: "{{ not queue_empty }}"
424+
value_template: "{{ not queue_empty and is_docked }}"
425+
sequence:
426+
- service: script.send_to_logbook
427+
data:
428+
topic: "VACUUM"
429+
message: >
430+
Task complete and docked with queue still set ({{ queue_raw }}); treating as early reseed.
431+
{{ 'Advancing to ' ~ next_phase ~ '.' if has_next_phase else 'All phases complete; shutting down.' }}
432+
- choose:
433+
- conditions:
434+
- condition: template
435+
value_template: "{{ has_next_phase }}"
436+
sequence:
437+
- service: input_select.select_option
438+
target:
439+
entity_id: input_select.l10s_vacuum_phase
440+
data:
441+
option: "{{ next_phase }}"
442+
- service: input_text.set_value
443+
target:
444+
entity_id: input_text.l10s_vacuum_room_queue
445+
data:
446+
value: ""
447+
- conditions:
448+
- condition: template
449+
value_template: "{{ not has_next_phase }}"
450+
sequence:
451+
- service: input_select.select_option
452+
target:
453+
entity_id: input_select.l10s_vacuum_phase
454+
data:
455+
option: "sweep_main"
456+
- service: input_text.set_value
457+
target:
458+
entity_id: input_text.l10s_vacuum_room_queue
459+
data:
460+
value: ""
461+
- service: input_boolean.turn_off
462+
target:
463+
entity_id: input_boolean.l10s_vacuum_on_demand
464+
default: []
465+
- conditions:
466+
- condition: template
467+
value_template: "{{ not queue_empty and not is_docked }}"
423468
sequence:
424469
- service: script.send_to_logbook
425470
data:
@@ -431,6 +476,31 @@ automation:
431476
- service: script.l10s_vacuum_start_next_room
432477
default: []
433478

479+
- alias: 'Away Vacuum: Resume From Dock When Queue Exists'
480+
id: d70ad5a2-6047-4af4-8b4a-6e3b78c19774
481+
mode: single
482+
trigger:
483+
- platform: state
484+
entity_id: vacuum.l10s_vacuum
485+
to: 'docked'
486+
- platform: state
487+
entity_id: input_text.l10s_vacuum_room_queue
488+
condition:
489+
- condition: state
490+
entity_id: input_boolean.l10s_vacuum_on_demand
491+
state: 'on'
492+
- condition: state
493+
entity_id: vacuum.l10s_vacuum
494+
state: 'docked'
495+
- condition: template
496+
value_template: "{{ states('input_text.l10s_vacuum_room_queue') | default('', true) | trim != '' }}"
497+
action:
498+
- service: script.send_to_logbook
499+
data:
500+
topic: "VACUUM"
501+
message: "Docked with queue set; resuming next room without waiting for departure."
502+
- service: script.l10s_vacuum_start_next_room
503+
434504
- alias: 'Vacuum Sensor Cleaning Silencer'
435505
id: 6548de52-a4a4-4df2-9d66-9c2c15577a7f
436506
trigger:

0 commit comments

Comments
 (0)