Finally got it ALL working!

Enhance configuration files for improved logging and vacuum automation

- Updated logbook.yaml to exclude additional domains and sensor entities for better data management.
- Modified logger.yaml to adjust log levels for template helpers and scripts, enhancing error tracking.
- Added auto_purge and commit_interval settings in recorder.yaml to optimize database management.
- Refined vacuum.yaml to improve queue handling and room identification logic, ensuring more efficient cleaning operations.
This commit is contained in:
Carlo Costanzo
2025-12-03 17:06:17 -05:00
parent 36b5150db6
commit 9c540c0acc
5 changed files with 75 additions and 80 deletions

View File

@@ -7,6 +7,9 @@
#------------------------------------------- #-------------------------------------------
exclude: exclude:
domains:
- persistent_notification
- update
entity_globs: entity_globs:
- sensor.*_location - sensor.*_location
- sensor.*_place - sensor.*_place
@@ -16,6 +19,16 @@ exclude:
- input_text.l10s_vacuum_* - input_text.l10s_vacuum_*
- input_datetime.l10s_vacuum_* - input_datetime.l10s_vacuum_*
- input_boolean.l10s_vacuum_* - input_boolean.l10s_vacuum_*
- sensor.*_battery
- sensor.*_battery_state
- sensor.*_uptime*
- sensor.*_last_update*
- sensor.*_since
- sensor.*_last_boot
- sensor.sun_next_*
- sensor.*_activity
- sensor.*_bssid
- sensor.*_wifi_signal_strength
entities: entities:
- automation.cuckoo_clock - automation.cuckoo_clock
- automation.detect_lights_and_adjust_the_brightness_when_turned_on_based_on_time - automation.detect_lights_and_adjust_the_brightness_when_turned_on_based_on_time
@@ -44,3 +57,4 @@ exclude:
- sensor.small_garage_wifi_signal_strength - sensor.small_garage_wifi_signal_strength
- sensor.time - sensor.time
- sensor.upstairs_ac_cooling_numeric - sensor.upstairs_ac_cooling_numeric
- sensor.vcloudinfo_com

View File

@@ -36,6 +36,7 @@ logs:
homeassistant.components.mqtt: error homeassistant.components.mqtt: error
homeassistant.components.mqtt.discovery: critical homeassistant.components.mqtt.discovery: critical
homeassistant.components.persistent_notification: critical homeassistant.components.persistent_notification: critical
homeassistant.components.template: warn
homeassistant.components.rest.sensor: critical homeassistant.components.rest.sensor: critical
homeassistant.components.recorder: error homeassistant.components.recorder: error
homeassistant.components.sensor.pi_hole: critical homeassistant.components.sensor.pi_hole: critical
@@ -47,7 +48,7 @@ logs:
homeassistant.components.switch.unifi: error homeassistant.components.switch.unifi: error
homeassistant.components.zwave: warn homeassistant.components.zwave: warn
homeassistant.exceptions: info homeassistant.exceptions: info
homeassistant.helpers.script: info homeassistant.helpers.script: warn
homeassistant.helpers.entity: critical homeassistant.helpers.entity: critical
homeassistant.loader: warn homeassistant.loader: warn
homeassistant.components.websocket_api: error homeassistant.components.websocket_api: error

View File

@@ -1,38 +0,0 @@
#-------------------------------------------
# @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# Logger Controls - Realtime debugging helpers.
#-------------------------------------------
######################################################################
## Adjust Home Assistant log level from the UI.
######################################################################
input_select:
log_level:
name: Log Level
options:
- critical
- fatal
- error
- warning
- warn
- info
- debug
- notset
initial: warn
icon: mdi:bug
###################################
## Dynamically set the log levels without having to restart HASS or edit configuration.yaml
#- Thanks @VDRainer
###################################
automation:
- alias: Log Level
id: 8196e9d4-5174-492e-8523-6ef70ccbd8dd
trigger:
platform: state
entity_id:
- input_select.log_level
# - input_select.log_component
action:
- service: logger.set_level
data:
homeassistant.components: "{{ states.input_select.log_level.state }}"

View File

@@ -54,19 +54,26 @@ script:
- variables: - variables:
# Weekday runs are sweeping (vacuum only), weekend runs are mopping # Weekday runs are sweeping (vacuum only), weekend runs are mopping
cleaning_mode: "{{ 'mopping' if now().weekday() in [5, 6] else 'sweeping' }}" cleaning_mode: "{{ 'mopping' if now().weekday() in [5, 6] else 'sweeping' }}"
catalog_raw: "{{ states('input_text.l10s_vacuum_room_catalog') | string | replace(' ', '') }}" catalog_raw: "{{ states('input_text.l10s_vacuum_room_catalog') | default('', true) | string | replace(' ', '') }}"
queue_raw: "{{ states('input_text.l10s_vacuum_room_queue') | string | replace(' ', '') }}" queue_raw: "{{ states('input_text.l10s_vacuum_room_queue') | default('', true) | string | replace(' ', '') }}"
last_reset: "{{ as_datetime(states('input_datetime.l10s_vacuum_last_weekday_cycle'), default=None) }}" last_reset_raw: "{{ states('input_datetime.l10s_vacuum_last_weekday_cycle') }}"
last_reset_date_str: >
{% set dt = as_datetime(last_reset_raw, default=None) %}
{{ dt.date().isoformat() if dt is not none else '' }}
catalog_ints: "{{ catalog_raw | regex_findall('[0-9]+') | map('int') | select('gt', 0) | list }}"
queue_ints: "{{ queue_raw | regex_findall('[0-9]+') | map('int') | select('gt', 0) | list }}"
# Seed if queue is empty AND last reset was not today # Seed if queue is empty AND last reset was not today
can_seed_today: "{{ last_reset is none or last_reset.date() != now().date() }}" can_seed_today: "{{ last_reset_date_str == '' or last_reset_date_str != now().date().isoformat() }}"
will_seed: "{{ queue_raw | length == 0 and can_seed_today and catalog_raw | length > 0 }}" will_seed: >
seeded_queue_list: > {% set empty_queue = queue_ints | length == 0 %}
{% set q = catalog_raw.split(',') if will_seed else queue_raw.split(',') %} {% set on_demand = is_state('input_boolean.l10s_vacuum_on_demand', 'on') %}
{{ q | map('int') | list }} {{ (empty_queue or (on_demand and queue_ints | length <= 1)) and catalog_ints | length > 0 and (can_seed_today or on_demand) }}
seeded_queue_list: "{{ catalog_ints if will_seed else queue_ints }}"
valid_queue_list: "{{ seeded_queue_list }}"
# Define bathroom IDs for mopping separation # Define bathroom IDs for mopping separation
bath_ids: [1, 3, 4] bath_ids: [1, 3, 4]
nonbath_list: "{{ seeded_queue_list | reject('in', bath_ids) | list }}" nonbath_list: "{{ valid_queue_list | reject('in', bath_ids) | list }}"
bath_list: "{{ seeded_queue_list | select('in', bath_ids) | list }}" bath_list: "{{ valid_queue_list | select('in', bath_ids) | list }}"
# Prioritize non-bathrooms first, then bathrooms # Prioritize non-bathrooms first, then bathrooms
segments_to_clean: > segments_to_clean: >
{% if nonbath_list | length > 0 %} {% if nonbath_list | length > 0 %}
@@ -216,55 +223,64 @@ automation:
- platform: state - platform: state
entity_id: sensor.l10s_vacuum_current_room entity_id: sensor.l10s_vacuum_current_room
for: '00:03:00' for: '00:03:00'
- platform: state
entity_id: vacuum.l10s_vacuum
to: 'cleaning'
for: '00:03:00'
variables: variables:
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'} 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'}
catalog_raw: "{{ states('input_text.l10s_vacuum_room_catalog') | default('', true) | string | replace(' ', '') }}"
catalog_ints: "{{ catalog_raw | regex_findall('[0-9]+') | map('int') | select('gt', 0) | list }}"
queue_raw: "{{ states('input_text.l10s_vacuum_room_queue') | default('', true) | string | replace(' ', '') }}" queue_raw: "{{ states('input_text.l10s_vacuum_room_queue') | default('', true) | string | replace(' ', '') }}"
queue_ints: "{{ queue_raw | regex_findall('[0-9]+') | map('int') | list | default([], true) }}" queue_ints: "{{ queue_raw | regex_findall('[0-9]+') | map('int') | select('gt', 0) | list | default([], true) }}"
working_queue: "{{ queue_ints if queue_ints | length > 0 else catalog_ints }}"
current_room_id: "{{ trigger.to_state.attributes.room_id | default(state_attr('sensor.l10s_vacuum_current_room', 'room_id'), true) | int(0) }}" current_room_id: "{{ trigger.to_state.attributes.room_id | default(state_attr('sensor.l10s_vacuum_current_room', 'room_id'), true) | int(0) }}"
matched_room_id: "{{ current_room_id if current_room_id > 0 and current_room_id in (queue_ints | default([], true)) else 0 }}" matched_room_id: "{{ current_room_id if current_room_id > 0 and current_room_id in (working_queue | default([], true)) else 0 }}"
remaining_rooms: > remaining_rooms: "{{ working_queue | reject('equalto', matched_room_id) | list | join(',') }}"
{% if matched_room_id == 0 %} remaining_value: >
{{ queue_ints | join(',') }} {% set rem = remaining_rooms | string %}
{% if rem | length == 0 and working_queue | length > 1 %}
{{ working_queue | join(',') }}
{% else %} {% else %}
{% set rem = [] %} {{ rem }}
{% set removed = namespace(done=false) %} {% endif %}
{% for r in queue_ints %} remaining_value_str: >
{% if not removed.done and r == matched_room_id %} {% set rv = remaining_value %}
{% set removed.done = true %} {% if rv is string %}
{% else %} {{ rv }}
{% set rem = rem + [r] %} {% elif rv is iterable %}
{% endif %} {{ rv | map('string') | join(',') }}
{% endfor %} {% else %}
{{ rem | join(',') }} {{ rv | string }}
{% endif %} {% endif %}
condition: condition:
# Only run if there's actually a queue and a room was successfully matched to the start of the queue # Only run if there's actually a queue and a room was successfully matched to the start of the queue
- condition: template - condition: template
value_template: "{{ queue_ints | length > 0 }}" value_template: "{{ working_queue | length > 0 }}"
- condition: template
value_template: "{{ matched_room_id != 0 }}"
- condition: template - condition: template
value_template: "{{ matched_room_id != 0 }}" value_template: "{{ matched_room_id != 0 }}"
- condition: state
entity_id: vacuum.l10s_vacuum
state: 'cleaning'
action: action:
- service: input_text.set_value - service: input_text.set_value
target: target:
entity_id: input_text.l10s_vacuum_room_queue entity_id: input_text.l10s_vacuum_room_queue
data: data:
value: "{{ remaining_rooms }}" value: "{{ remaining_value_str }}"
- variables: - variables:
cleaned_raw: "{{ states('input_text.l10s_vacuum_rooms_cleaned_today') }}" cleaned_raw: "{{ states('input_text.l10s_vacuum_rooms_cleaned_today') | default('', true) | string }}"
cleaned_parts: "{{ cleaned_raw | regex_findall('[^,]+') | map('trim') | reject('equalto','') | list }}"
room_name: "{{ room_map.get(matched_room_id, states('sensor.l10s_vacuum_current_room')) }}" room_name: "{{ room_map.get(matched_room_id, states('sensor.l10s_vacuum_current_room')) }}"
updated_cleaned: > updated_cleaned: >
{% set parts = cleaned_raw.split(',') if cleaned_raw | length > 0 else [] %} {% set parts = cleaned_parts %}
{% if room_name not in parts %} {% if room_name not in parts %}
{{ (parts + [room_name]) | join(', ') }} {{ (parts + [room_name]) | join(', ') }}
{% else %} {% else %}
{{ cleaned_raw }} {{ parts | join(', ') }}
{% endif %} {% endif %}
remaining_count: "{{ remaining_rooms.split(',') | length if remaining_rooms | length > 0 else 0 }}" remaining_count: "{{ remaining_value_str | regex_findall('[^,]+') | length if remaining_value_str | length > 0 else 0 }}"
- service: input_text.set_value - service: input_text.set_value
target: target:
entity_id: input_text.l10s_vacuum_rooms_cleaned_today entity_id: input_text.l10s_vacuum_rooms_cleaned_today
@@ -272,8 +288,8 @@ automation:
value: "{{ updated_cleaned }}" value: "{{ updated_cleaned }}"
- service: script.notify_engine - service: script.notify_engine
data: data:
title: 'Vacuum room done' title: 'Vacuum Room Cleaned'
value1: "{{ room_name }} cleaned." value1: "{{ room_name }} is clean."
value2: "Remaining: {{ remaining_count }}." value2: "Remaining: {{ remaining_count }}."
ios_category: 'camera' ios_category: 'camera'
camera_entity: 'camera.l10s_vacuum_map' camera_entity: 'camera.l10s_vacuum_map'
@@ -324,9 +340,6 @@ automation:
data: data:
datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}" datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
- alias: 'Away Vacuum: Start Bathrooms When Pending'
id: 6b8d7d0e-fc21-4a2f-bd9e-4c51f6b9c2c3
- alias: 'Vacuum Sensor Cleaning Silencer' - alias: 'Vacuum Sensor Cleaning Silencer'
id: 6548de52-a4a4-4df2-9d66-9c2c15577a7f id: 6548de52-a4a4-4df2-9d66-9c2c15577a7f
trigger: trigger:
@@ -371,7 +384,7 @@ automation:
data: data:
value1: > value1: >
{{ "Vacuum error: " ~ states('sensor.l10s_vacuum_error') ~ " [ask Residents to help]" }} {{ "Vacuum error: " ~ states('sensor.l10s_vacuum_error') ~ " [ask Residents to help]" }}
Currently in {{states('sensor.l10s_vacuum_current_room')}}" Currently in {{states('sensor.l10s_vacuum_current_room')}}
- delay: 00:01:00 - delay: 00:01:00
- service: vacuum.locate - service: vacuum.locate
entity_id: vacuum.l10s_vacuum entity_id: vacuum.l10s_vacuum

View File

@@ -11,6 +11,8 @@
#------------------------------------------- #-------------------------------------------
#db_url: sqlite:///data/home-assistant_v2.db #db_url: sqlite:///data/home-assistant_v2.db
purge_keep_days: 30 purge_keep_days: 30
auto_purge: true
commit_interval: 30
exclude: exclude:
domains: domains:
- camera - camera
@@ -47,6 +49,7 @@ exclude:
- sensor.*uptime* - sensor.*uptime*
- sensor.sun_next_* - sensor.sun_next_*
- sensor.vpn_client_* - sensor.vpn_client_*
- sensor.*_wifi_signal_strength
- switch.*_do_not_disturb_* - switch.*_do_not_disturb_*
- switch.*_repeat_switch - switch.*_repeat_switch
- input_text.l10s_vacuum_* - input_text.l10s_vacuum_*
@@ -60,6 +63,8 @@ exclude:
- number.alarm_panel_1_screen_brightness - number.alarm_panel_1_screen_brightness
- script.amp_settings - script.amp_settings
- script.speech_processing - script.speech_processing
- button.l10s_vacuum_backup_map_1
- binary_sensor.vcloudinfo_com
- sensor.bear_stone - sensor.bear_stone
- sensor.carlo_ap - sensor.carlo_ap
- sensor.carlo_fast - sensor.carlo_fast