Skip to content

Commit 9831f31

Browse files
committed
Finally got the Vacuum scheduler working! Update HA version to 2025.12.3 and refine vacuum automation logic by adjusting room dequeue timing to 2 minutes and improving Jinja2 loop scoping for better list handling.
1 parent 7543b1c commit 9831f31

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

config/.HA_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2025.12.2
1+
2025.12.3

config/packages/vacuum.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# - Treat 3+ minutes in a room as "being cleaned" and dequeue immediately (queue = remaining rooms).
1313
# - Phase changes are driven by `sensor.l10s_vacuum_task_status: completed` and an empty queue to avoid skipping ahead on false room transitions.
1414
# - Avoid reissuing `dreame_vacuum.vacuum_clean_segment` while already cleaning; only send a new segment job when starting/resuming or switching phases.
15+
# - Jinja2 loop scoping: use a `namespace` when building lists (otherwise the queue can appear empty and get cleared).
1516
######################################################################
1617

1718
## 1. Helpers
@@ -207,26 +208,26 @@ automation:
207208
trigger:
208209
- platform: state
209210
entity_id: sensor.l10s_vacuum_current_room
210-
for: '00:03:00'
211+
for: '00:02:30'
211212
variables:
212-
room_map: {14:'kitchen',12:'dining-room',10:'living room',7:'master-bedroom',15:'foyer',9:'stacey-office',17:'formal-dining',13:'hallway',8:'justin-bedroom',6:'paige-bedroom',4:'master-bathroom',2:'office',1:'pool-bath',3:'kids-bathroom'}
213+
room_map: {14: Kitchen, 12: 'Dining Room', 10: 'Living Room', 7: 'Master Bedroom', 15: Foyer, 9: 'Stacey Office', 17: 'Formal Dining', 13: Hallway, 8: 'Justin Bedroom', 6: 'Paige Bedroom', 4: 'Master Bathroom', 2: Office, 1: 'Pool Bath', 3: 'Kids Bathroom'}
213214
queue_raw: "{{ states('input_text.l10s_vacuum_room_queue') | default('', true) | string | replace(' ', '') }}"
214-
queue_ints: "{{ queue_raw | regex_findall('[0-9]+') | map('int') | list | default([], true) }}"
215+
queue_ints: "{{ queue_raw | regex_findall('[0-9]+') | map('int') | select('gt', 0) | list | default([], true) }}"
215216
cleaned_room_state: "{{ trigger.to_state.state if trigger.to_state is not none else '' }}"
216217
cleaned_room_id: "{{ (trigger.to_state.attributes.room_id if trigger.to_state is not none else 0) | int(0) }}"
217218
matched_room_id: "{{ cleaned_room_id if cleaned_room_id > 0 and cleaned_room_id in (queue_ints | default([], true)) else 0 }}"
218219
room_name: "{{ room_map.get(matched_room_id, cleaned_room_state) }}"
219220
remaining_list: >
220-
{% set rem = [] %}
221+
{% set ns = namespace(rem=[]) %}
221222
{% set removed = namespace(done=false) %}
222223
{% for r in queue_ints %}
223224
{% if not removed.done and r == matched_room_id %}
224225
{% set removed.done = true %}
225226
{% else %}
226-
{% set rem = rem + [r] %}
227+
{% set ns.rem = ns.rem + [r] %}
227228
{% endif %}
228229
{% endfor %}
229-
{{ rem }}
230+
{{ ns.rem }}
230231
remaining_rooms: "{{ remaining_list | join(',') }}"
231232
remaining_count: "{{ remaining_list | length }}"
232233
phase_order: ['sweep_main', 'sweep_bath', 'mop_main', 'mop_bath']

0 commit comments

Comments
 (0)