2025-11-29 15:40:14 -05:00
######################################################################
# @CCOSTAN - Follow Me on X
# For more info visit https://www.vcloudinfo.com/click-here
2018-01-01 19:00:45 -05:00
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
2025-11-29 15:40:14 -05:00
# -------------------------------------------------------------------
# Dreame Vacuum Orchestration - Weekday cleaning schedules and alerts
# Migrated from Neato D7; HACS dreame-vacuum - https://github.com/Tasshack/dreame-vacuum
# -------------------------------------------------------------------
# Neato D7: https://amzn.to/2kqnnqu | Dreame: https://amzn.to/4f7NpFP
# Authentication via Dreame developer portal; resume-friendly weekday runs
Standardizing on Headers for all YAML files.
- Updated comments in various YAML configuration files to provide clearer descriptions of functionalities and integrations.
- Improved documentation for alarm, alexa_media_player, backups, blink, cbyge, climate, finance, fridge, garadget, glances, hass_agent_homepc, holiday, ios, landscape_lighting, lightning, logger, medicine, nfc_tags, noonhome, office_motion, phynplus, powerwall, printer, processmonitor, proxmox, rachio, rheem_econet, roku, sleepiq, space, speedtest, stats, superbowl, vacuum, wireless, and youtube packages.
- Added relevant links and issue references where applicable to enhance user guidance and support.
2025-11-29 13:17:00 -05:00
######################################################################
2025-11-29 15:40:14 -05:00
Standardizing on Headers for all YAML files.
- Updated comments in various YAML configuration files to provide clearer descriptions of functionalities and integrations.
- Improved documentation for alarm, alexa_media_player, backups, blink, cbyge, climate, finance, fridge, garadget, glances, hass_agent_homepc, holiday, ios, landscape_lighting, lightning, logger, medicine, nfc_tags, noonhome, office_motion, phynplus, powerwall, printer, processmonitor, proxmox, rachio, rheem_econet, roku, sleepiq, space, speedtest, stats, superbowl, vacuum, wireless, and youtube packages.
- Added relevant links and issue references where applicable to enhance user guidance and support.
2025-11-29 13:17:00 -05:00
######################################################################
2025-11-29 15:40:14 -05:00
### Helpers - Track weekday cleaning cycles and last run timestamp
######################################################################
input_boolean :
l10s_vacuum_weekday_cycle_active :
name : L10s Weekday Cleaning Active
icon : mdi:robot-vacuum
2025-11-29 16:15:04 -05:00
l10s_vacuum_on_demand :
name : Dream Clean (On-Demand)
icon : mdi:rocket-launch
2025-11-29 15:40:14 -05:00
input_datetime :
l10s_vacuum_last_weekday_cycle :
name : L10s Last Weekday Cleaning Cycle
has_date : true
has_time : true
input_text :
l10s_vacuum_room_queue :
name : L10s Vacuum Room Queue
icon : mdi:format-list-bulleted
max : 255
l10s_vacuum_room_catalog :
name : L10s Vacuum Room Catalog
# Room order (id:name): 14 Kitchen, 12 Dining, 10 Living, 7 Master Bedroom, 15 Foyer, 9 Stacey Office,
2025-11-29 16:15:04 -05:00
# 17 Formal Dining, 13 Hallway, 8 Justin Bedroom, 6 Paige Bedroom, 4 Master Bathroom, 2 Office, 1 Pool Bath, 3 Kids Bathroom. Skip 11 Garage Hallway.
2025-11-29 15:40:14 -05:00
initial : "14,12,10,7,15,9,17,13,8,6,4,2,1,3"
icon : mdi:map
max : 255
l10s_vacuum_rooms_cleaned_today :
name : L10s Vacuum Rooms Cleaned Today
icon : mdi:clipboard-check-outline
max : 255
script :
l10s_vacuum_start_next_room :
alias: 'Away Vacuum : Start Next Room'
mode : single
sequence :
- variables :
is_weekend : "{{ now().weekday() in [5, 6] }}"
cleaning_mode : "{{ 'mopping' if is_weekend else 'sweeping' }}"
2025-12-01 16:38:55 -05:00
catalog_raw : "{{ states('input_text.l10s_vacuum_room_catalog') | string | replace(' ', '') }}"
queue_raw : "{{ states('input_text.l10s_vacuum_room_queue') | string | replace(' ', '') }}"
last_reset_raw : "{{ states('input_datetime.l10s_vacuum_last_weekday_cycle') }}"
last_reset : "{{ as_datetime(last_reset_raw, default=None) }}"
can_seed_today : "{{ last_reset is none or (last_reset | as_datetime).date() != now().date() }}"
2025-11-29 15:40:14 -05:00
will_seed : "{{ queue_raw | length == 0 and can_seed_today and catalog_raw | length > 0 }}"
seeded_queue : "{{ catalog_raw if will_seed else queue_raw }}"
2025-12-01 16:38:55 -05:00
queue_list : "{{ (seeded_queue | string).split(',') if seeded_queue | length > 0 else [] }}"
bath_ids : [ 1 , 3 , 4 ]
queue_ints : "{{ queue_list | map('int') | list }}"
bath_list : "{{ queue_ints | select('in', bath_ids) | list }}"
nonbath_list : "{{ queue_ints | reject('in', bath_ids) | list }}"
2025-11-29 15:40:14 -05:00
next_room : "{{ queue_list[0] if queue_list | length > 0 else '' }}"
- choose :
- conditions :
- condition : template
value_template : "{{ next_room == '' }}"
sequence :
- stop : 'No rooms left to clean today.'
default : [ ]
- choose :
- conditions :
- condition : template
value_template : "{{ will_seed }}"
sequence :
- service : input_text.set_value
target :
entity_id : input_text.l10s_vacuum_room_queue
data :
value : "{{ catalog_raw }}"
- service : input_datetime.set_datetime
target :
entity_id : input_datetime.l10s_vacuum_last_weekday_cycle
data :
datetime : "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
default : [ ]
- service : select.select_option
target :
entity_id : select.l10s_vacuum_cleaning_mode
data :
option : "{{ cleaning_mode }}"
- service : vacuum.set_fan_speed
target :
entity_id : vacuum.l10s_vacuum
data :
fan_speed : Standard
- service : input_boolean.turn_on
target :
entity_id : input_boolean.l10s_vacuum_weekday_cycle_active
- service : dreame_vacuum.vacuum_clean_segment
target :
entity_id : vacuum.l10s_vacuum
data :
# Service per https://github.com/Tasshack/dreame-vacuum/tree/master/docs/services.md#dreame_vacuumvacuum_clean_segment
2025-12-01 16:38:55 -05:00
segments : "{{ nonbath_list if nonbath_list | length > 0 else queue_ints }}"
2021-11-11 14:41:15 -05:00
2023-10-21 18:39:19 +00:00
automation :
2020-05-29 16:45:24 -04:00
##############################################################################
2024-08-05 17:03:43 +00:00
### Automations - Help Vacuum!
2020-05-31 15:10:58 -04:00
### https://www.vcloudinfo.com/2020/05/home-assistant-neato-vacuum-automation.html
2020-05-29 16:45:24 -04:00
##############################################################################
2025-11-29 16:15:04 -05:00
- alias: 'Away Vacuum : Reset Queue (Mon/Sat)'
2025-11-29 15:40:14 -05:00
id : 93a6e7dc-9c32-4d53-9f7c-651cd60f4b84
trigger :
- platform : time
at : '08:55:00'
condition :
- condition : time
weekday :
- mon
2025-11-29 16:15:04 -05:00
- sat
2025-11-29 15:40:14 -05:00
action :
- service : input_text.set_value
target :
entity_id : input_text.l10s_vacuum_room_queue
data :
value : "{{ states('input_text.l10s_vacuum_room_catalog') }}"
- service : input_text.set_value
target :
entity_id : input_text.l10s_vacuum_rooms_cleaned_today
data :
value : ""
- service : input_boolean.turn_off
target :
entity_id : input_boolean.l10s_vacuum_weekday_cycle_active
- service : input_datetime.set_datetime
target :
entity_id : input_datetime.l10s_vacuum_last_weekday_cycle
data :
datetime : "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
- service : input_boolean.turn_off
target :
2025-11-29 16:15:04 -05:00
entity_id : input_boolean.l10s_vacuum_on_demand
2025-11-29 15:40:14 -05:00
2025-12-01 16:38:55 -05:00
- alias: 'Away Vacuum : Start or Resume When we leave or On-Demand'
2025-11-29 15:40:14 -05:00
id : 7f7e0a3c-6452-4f6b-8464-c6c25770a148
trigger :
- platform : state
entity_id : group.family
to : 'not_home'
2025-12-01 16:38:55 -05:00
- platform : state
entity_id : input_boolean.l10s_vacuum_on_demand
to : 'on'
2025-11-29 15:40:14 -05:00
condition :
2025-11-29 16:15:04 -05:00
- condition : state
entity_id : input_boolean.guest_mode
state : 'off'
2025-12-01 17:23:58 -05:00
- condition : template
value_template : >
{{ is_state('input_boolean.l10s_vacuum_on_demand', 'on') or is_state('group.family', 'not_home') }}
2025-11-29 15:40:14 -05:00
- condition : template
value_template : "{{ not is_state('vacuum.l10s_vacuum', 'cleaning') }}"
action :
- service : script.l10s_vacuum_start_next_room
- alias: 'Away Vacuum : Dock When Family Returns'
id : 1ef172f2-4b30-4e5b-953d-d4d1ca8701ad
trigger :
- platform : state
entity_id : group.family
to : 'home'
2025-12-01 16:38:55 -05:00
- platform : state
entity_id : input_boolean.l10s_vacuum_on_demand
to : 'off'
2025-11-29 15:40:14 -05:00
condition :
- condition : state
entity_id : input_boolean.l10s_vacuum_weekday_cycle_active
state : 'on'
- 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
- alias: 'Away Vacuum : Confirm Room Cleaned'
id : c581c570-55b0-4acd-8b5d-53cfb486cc2a
trigger :
- platform : state
entity_id : sensor.l10s_vacuum_current_room
2025-12-01 16:38:55 -05:00
for : '00:03:00'
2025-11-29 15:40:14 -05:00
variables :
2025-12-01 16:38:55 -05:00
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' }
2025-12-02 09:23:17 -05:00
queue_ints : >
{% set queue = states('input_text.l10s_vacuum_room_queue') | default('', true) | string | replace(' ', '') %}
{% if queue %}
{{ queue | regex_findall('[0-9]+') | map('int') | list }}
{% else %}
[ ]
{% endif %}
current_room_id : >
{% set trigger_room_id = trigger.to_state.attributes.room_id if trigger.to_state and trigger.to_state.attributes and 'room_id' in trigger.to_state.attributes else none %}
{% set sensor_room_id = state_attr('sensor.l10s_vacuum_current_room', 'room_id') %}
{{ (trigger_room_id if trigger_room_id is not none else sensor_room_id) | int(0) }}
2025-12-01 16:38:55 -05:00
matched_room_id : >
2025-12-02 09:23:17 -05:00
{% set q = queue_ints %}
{% set cur = current_room_id %}
{{ cur if cur > 0 and cur in q else 0 }}
remaining_rooms : >
{% set m = matched_room_id %}
{% set q = queue_ints %}
{% if m == 0 %}
{{ q | join(',') }}
2025-12-01 16:38:55 -05:00
{% else %}
2025-12-02 09:23:17 -05:00
{% set found = false %}
{% set rem = [] %}
{% for r in q %}
{% if not found and r == m %}
{% set found = true %}
{% else %}
{% set rem = rem + [r] %}
2025-12-01 16:38:55 -05:00
{% endif %}
{% endfor %}
2025-12-02 09:23:17 -05:00
{{ rem | join(',') }}
2025-12-01 16:38:55 -05:00
{% endif %}
2025-11-29 15:40:14 -05:00
condition :
- condition : template
2025-12-01 16:38:55 -05:00
value_template : "{{ queue_ints | length > 0 }}"
2025-11-29 15:40:14 -05:00
- condition : template
2025-12-01 16:38:55 -05:00
value_template : "{{ matched_room_id != 0 }}"
2025-11-29 15:40:14 -05:00
- condition : state
entity_id : vacuum.l10s_vacuum
state : 'cleaning'
action :
- condition : template
value_template : >
2025-12-01 16:38:55 -05:00
{{ is_state('vacuum.l10s_vacuum', 'cleaning') and matched_room_id != 0 }}
2025-11-29 15:40:14 -05:00
- service : input_text.set_value
target :
entity_id : input_text.l10s_vacuum_room_queue
data :
value : "{{ remaining_rooms }}"
- variables :
cleaned_raw : "{{ states('input_text.l10s_vacuum_rooms_cleaned_today') }}"
2025-12-01 16:38:55 -05:00
room_name : "{{ room_map.get(matched_room_id, states('sensor.l10s_vacuum_current_room')) }}"
2025-11-29 15:40:14 -05:00
updated_cleaned : >
{% set parts = cleaned_raw.split(',') if cleaned_raw | length > 0 else [] %}
{% if room_name not in parts %}
{{ (parts + [room_name]) | join(', ') }}
{% else %}
{{ cleaned_raw }}
{% endif %}
remaining_count : "{{ remaining_rooms.split(',') | length if remaining_rooms | length > 0 else 0 }}"
- service : input_text.set_value
target :
entity_id : input_text.l10s_vacuum_rooms_cleaned_today
data :
value : "{{ updated_cleaned }}"
- service : script.notify_engine
data :
title : 'Vacuum room done'
value1 : "{{ room_name }} cleaned."
value2 : "Remaining: {{ remaining_count }}."
ios_category : 'camera'
camera_entity : 'camera.l10s_vacuum_map'
content_type : 'jpeg'
who : 'carlo'
group : 'information'
- choose :
- conditions :
- condition : template
value_template : "{{ remaining_rooms | length == 0 }}"
sequence :
- service : input_boolean.turn_off
target :
entity_id : input_boolean.l10s_vacuum_weekday_cycle_active
- service : input_datetime.set_datetime
target :
entity_id : input_datetime.l10s_vacuum_last_weekday_cycle
data :
datetime : "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
- alias: 'Away Vacuum : Cycle Complete'
id : 8fa7779a-957b-49a3-84e7-36ca93c2e0d2
trigger :
- platform : state
entity_id : sensor.l10s_vacuum_task_status
to : 'completed'
- platform : state
entity_id : vacuum.l10s_vacuum
to : 'docked'
for : 00 : 05 : 00
condition :
- condition : template
value_template : "{{ is_state('sensor.l10s_vacuum_task_status', 'completed') }}"
- condition : template
value_template : "{{ (states('input_text.l10s_vacuum_room_queue') | replace(' ', '')) | length == 0 }}"
action :
- service : input_boolean.turn_off
target :
entity_id : input_boolean.l10s_vacuum_weekday_cycle_active
- service : input_datetime.set_datetime
target :
entity_id : input_datetime.l10s_vacuum_last_weekday_cycle
data :
datetime : "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
2025-12-01 16:38:55 -05:00
- alias: 'Away Vacuum : Start Bathrooms When Pending'
id : 6b8d7d0e-fc21-4a2f-bd9e-4c51f6b9c2c3
2025-11-29 15:40:14 -05:00
trigger :
- platform : state
2025-12-01 16:38:55 -05:00
entity_id : vacuum.l10s_vacuum
to : 'docked'
for : 00 : 02 : 00
2025-11-29 15:40:14 -05:00
condition :
2025-11-29 16:15:04 -05:00
- condition : state
entity_id : input_boolean.guest_mode
state : 'off'
2025-11-29 15:40:14 -05:00
- condition : template
2025-12-01 16:38:55 -05:00
value_template : "{{ is_state('input_boolean.l10s_vacuum_weekday_cycle_active', 'on') or is_state('input_boolean.l10s_vacuum_on_demand', 'on') }}"
2025-11-29 15:40:14 -05:00
- condition : template
2025-12-01 16:38:55 -05:00
value_template : >
{% set bath_ids = [1,3,4] %}
{% set queue_raw = states('input_text.l10s_vacuum_room_queue') | string | replace(' ', '') %}
{% set q = queue_raw.split(',') if queue_raw | length > 0 else [] %}
{% set q_int = q | map('int') | list %}
{% set non_bath = q_int | reject('in', bath_ids) | list %}
{% set baths = q_int | select('in', bath_ids) | list %}
{{ baths | length > 0 and non_bath | length == 0 }}
- condition : template
value_template : "{{ not is_state('vacuum.l10s_vacuum', 'cleaning') }}"
2025-11-29 15:40:14 -05:00
action :
2025-12-01 16:38:55 -05:00
- variables :
bath_ids : [ 1 , 3 , 4 ]
queue_raw : "{{ states('input_text.l10s_vacuum_room_queue') | string | replace(' ', '') }}"
q : "{{ queue_raw.split(',') if queue_raw | length > 0 else [] }}"
baths : "{{ q | map('int') | list | select('in', bath_ids) | list }}"
- service : input_text.set_value
target :
entity_id : input_text.l10s_vacuum_room_queue
data :
value : "{{ baths | join(',') }}"
- service : dreame_vacuum.vacuum_clean_segment
target :
entity_id : vacuum.l10s_vacuum
data :
segments : "{{ baths }}"
- service : input_boolean.turn_on
target :
entity_id : input_boolean.l10s_vacuum_weekday_cycle_active
2025-11-29 15:40:14 -05:00
2025-01-22 15:55:48 +00:00
- alias : 'Vacuum Sensor Cleaning Silencer'
id : 6548de52-a4a4-4df2-9d66-9c2c15577a7f
trigger :
- platform : numeric_state
entity_id : sensor.l10s_vacuum_sensor_dirty_left
below : 10
condition :
- condition : state
entity_id : sensor.l10s_vacuum_task_status
state : 'completed'
action :
- service : button.press
target :
entity_id : button.l10s_vacuum_reset_sensor
2024-07-24 05:48:36 +00:00
- alias : 'Help Vacuum'
2020-07-20 19:33:03 +01:00
id : 6548de52-a4a4-4df2-9d66-9c2c15577a7e
2020-05-29 16:45:24 -04:00
trigger :
- platform : state
2024-07-24 05:48:36 +00:00
entity_id : sensor.l10s_vacuum_error
2020-05-29 16:45:24 -04:00
- platform : event
2024-07-24 05:48:36 +00:00
event_type : event_did_someone_help_vacuum_loop
2024-08-05 17:03:43 +00:00
2020-05-29 16:45:24 -04:00
condition :
2024-08-05 17:03:43 +00:00
- condition : template
value_template : "{{ states('sensor.l10s_vacuum_error') not in ['no_error', 'unavailable'] }}"
2020-05-29 16:45:24 -04:00
action :
2025-05-26 21:09:46 +00:00
- service : script.notify_engine
data :
title : 'Help vacuum'
value1 : "{{ states('sensor.l10s_vacuum_error') }} - {{states('sensor.l10s_vacuum_current_room')}}"
who : 'family'
ios_category : 'camera'
camera_entity : 'camera.l10s_vacuum_map'
content_type : 'jpeg'
group : 'information'
2022-06-23 12:00:17 -04:00
- wait_template : "{{ is_state('group.bed', 'off') }}"
2024-08-05 17:03:43 +00:00
- wait_template : "{{ is_state('group.family', 'home') }}"
- delay : 00 : 03 : 00
2024-07-02 17:09:40 +00:00
- service : vacuum.locate
2024-07-24 05:48:36 +00:00
entity_id : vacuum.l10s_vacuum
2020-05-29 16:45:24 -04:00
- service : script.speech_engine
2020-09-26 10:52:45 -04:00
data :
2024-07-24 05:48:36 +00:00
value1 : >
2025-05-26 21:09:46 +00:00
{{ "Vacuum error: " ~ states('sensor.l10s_vacuum_error') ~ " [ask Residents to help]" }}
2024-08-05 17:03:43 +00:00
Currently in {{states('sensor.l10s_vacuum_current_room')}}"
2020-05-29 16:45:24 -04:00
2024-07-02 17:09:40 +00:00
- delay : 00 : 01 : 00
- service : vacuum.locate
2024-07-24 05:48:36 +00:00
entity_id : vacuum.l10s_vacuum
2024-07-02 17:09:40 +00:00
2020-05-29 16:45:24 -04:00
- delay : 00 : 20 : 00
2024-07-24 05:48:36 +00:00
- event : event_did_someone_help_vacuum_loop
2025-09-30 12:11:05 -04:00
2025-12-01 16:38:55 -05:00