From 02a554a79388654679f5e1c4bf959a28f3246bbe Mon Sep 17 00:00:00 2001 From: Carlo Costanzo Date: Tue, 9 Dec 2025 18:49:29 -0500 Subject: [PATCH 1/2] Refactor air quality display in briefing.yaml to improve clarity. Adjusted conditions for displaying air quality information, ensuring it only shows when the index is above 15. --- config/packages/llmvision.yaml | 87 +++++++++++++++++++++++++++ config/templates/speech/briefing.yaml | 7 +-- 2 files changed, 89 insertions(+), 5 deletions(-) create mode 100644 config/packages/llmvision.yaml diff --git a/config/packages/llmvision.yaml b/config/packages/llmvision.yaml new file mode 100644 index 00000000..eb30fc30 --- /dev/null +++ b/config/packages/llmvision.yaml @@ -0,0 +1,87 @@ +# LLM Vision test package: checks the garage camera for garbage cans in the upper-right corner. +# Trigger with input_button.llmvision_garbage_check to update input_boolean.garbage_cans_in. + +input_button: + llmvision_garbage_check: + name: "LLM Vision: Garage cans check" + icon: mdi:delete-variant + +input_boolean: + garbage_cans_in: + name: "Garbage cans in upper right" + icon: mdi:trash-can + +input_text: + llmvision_garbage_last_response: + name: "LLM Vision garage response" + max: 255 + llmvision_garbage_last_keyframe: + name: "LLM Vision garage key frame" + max: 255 + +input_datetime: + llmvision_garbage_last_run: + name: "LLM Vision garage last run" + has_date: true + has_time: true + +template: + - binary_sensor: + - name: "Garbage cans in" + unique_id: llmvision_garbage_cans_in + device_class: presence + state: "{{ is_state('input_boolean.garbage_cans_in', 'on') }}" + attributes: + last_run: "{{ states('input_datetime.llmvision_garbage_last_run') }}" + last_response: "{{ states('input_text.llmvision_garbage_last_response') }}" + last_key_frame: "{{ states('input_text.llmvision_garbage_last_keyframe') }}" + source_camera: camera.garagecam + +automation: + - alias: LLM Vision - Garage cans upper right + id: d88a2e6d-78f3-4bb7-9d9f-c4d06e6eb5a9 + mode: restart + trigger: + - platform: state + entity_id: input_button.llmvision_garbage_check + variables: + prompt_text: > + Examine ONLY the upper-right quadrant of the image (top half + right half). Ignore everything else (car, floor text, door, bikes, bottles, bags). If you see a black garbage can in that upper-right quadrant, respond exactly "on". If none are present there, respond exactly "off". Do not add any other words. + action: + - service: llmvision.data_analyzer + response_variable: llmvision_result + data: + provider: !secret llmvision_provider_entry + model: gpt-4o-mini + message: "{{ prompt_text }}" + sensor_entity: input_boolean.garbage_cans_in + image_entity: + - camera.garagecam + include_filename: false + target_width: 1280 + max_tokens: 16 + expose_images: true + - service: input_text.set_value + target: + entity_id: input_text.llmvision_garbage_last_response + data: + value: "{{ (llmvision_result.response_text | default('unknown'))[:250] }}" + - choose: + - conditions: "{{ llmvision_result is defined and llmvision_result.key_frame is defined }}" + sequence: + - service: input_text.set_value + target: + entity_id: input_text.llmvision_garbage_last_keyframe + data: + value: "{{ llmvision_result.key_frame }}" + default: + - service: input_text.set_value + target: + entity_id: input_text.llmvision_garbage_last_keyframe + data: + value: "" + - service: input_datetime.set_datetime + target: + entity_id: input_datetime.llmvision_garbage_last_run + data: + datetime: "{{ now() }}" diff --git a/config/templates/speech/briefing.yaml b/config/templates/speech/briefing.yaml index ce3b3110..40e62be5 100755 --- a/config/templates/speech/briefing.yaml +++ b/config/templates/speech/briefing.yaml @@ -35,11 +35,8 @@ [Here is the current weather outside] {% set aq_description = state_attr('sensor.bear_stone_common_air_quality_index', 'description') | default('') %} {% set aq_index = states('sensor.bear_stone_common_air_quality_index') | int(0) %} - {% if aq_description %} - Air Quality: {{ aq_description }} - {% endif %} - {% if aq_index >= 150 %} - [Air quality is unhealthy; limit outdoor activity] + {% if aq_index >= 15 %} + [Air Quality: {{ aq_description }}] {% endif %} {% set pirateweather_metrics = states.sensor | selectattr('entity_id','search','pirateweather') From a8eca6f4bb1eb9e6742049d12cde7f61bb934792 Mon Sep 17 00:00:00 2001 From: Carlo Costanzo Date: Thu, 11 Dec 2025 09:23:36 -0500 Subject: [PATCH 2/2] Remove backups.yaml configuration file and update llmvision.yaml for garbage can detection, including renaming entities and adjusting automation logic. Modify air quality condition in briefing.yaml to display only when the index exceeds 50. --- config/packages/backups.yaml | 37 --------------------------- config/packages/llmvision.yaml | 31 ++++++++++++++-------- config/templates/speech/briefing.yaml | 2 +- 3 files changed, 21 insertions(+), 49 deletions(-) delete mode 100755 config/packages/backups.yaml diff --git a/config/packages/backups.yaml b/config/packages/backups.yaml deleted file mode 100755 index bc73ffb6..00000000 --- a/config/packages/backups.yaml +++ /dev/null @@ -1,37 +0,0 @@ -#------------------------------------------- -# @CCOSTAN -# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig -# Backups - Monitor backup jobs and alert on failures. -#------------------------------------------- -###################################################################### -## Duplicati/backup status sensors and notifications. -###################################################################### -# Added Duplicati to HA - https://github.com/CCOSTAN/Home-AssistantConfig/issues/1498 -automation: - - alias: 'Backup Job Failed Notification' - id: 5b3a4c89-1234-4567-8901-23456789abcf - trigger: - - platform: state - entity_id: sensor.dockerconfigs_backup_error_message - from: '-' - action: - - service: script.notify_engine - data: - who: 'carlo' - value1: 'Backup Job Error!' - value2: "Error: {{ states('sensor.dockerconfigs_backup_error_message') }}" - - - alias: 'Backup Size Change Alert' - id: 5b3a4c89-1234-4567-8901-23456789abd0 - trigger: - - platform: numeric_state - entity_id: sensor.dockerconfigs_backup_target_size - above: 10000000000 # Alert if backup size is over 10GB - action: - - service: script.notify_engine - data: - who: 'carlo' - value1: 'Backup Size Warning' - value2: > - Backup target size has grown to {{ states('sensor.dockerconfigs_backup_target_size') | float / 1000000000 }} GB. - Please verify backup contents and available storage. diff --git a/config/packages/llmvision.yaml b/config/packages/llmvision.yaml index eb30fc30..a563321b 100644 --- a/config/packages/llmvision.yaml +++ b/config/packages/llmvision.yaml @@ -1,5 +1,14 @@ -# LLM Vision test package: checks the garage camera for garbage cans in the upper-right corner. -# Trigger with input_button.llmvision_garbage_check to update input_boolean.garbage_cans_in. +###################################################################### +# @CCOSTAN - Follow Me on X +# For more info visit https://www.vcloudinfo.com/click-here +# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig +# ------------------------------------------------------------------- +# LLM Vision - Garage Cans X Check - detects reflective X on right wall +# Trigger with input_button.llmvision_garbage_check to update garbage_cans_out. +# ------------------------------------------------------------------- +# Notes: LLMVision analyzes camera.garagecam; expects strict "on"/"off" output. +# Docs: https://llmvision.gitbook.io/getting-started/usage/image-analyzer +###################################################################### input_button: llmvision_garbage_check: @@ -7,8 +16,8 @@ input_button: icon: mdi:delete-variant input_boolean: - garbage_cans_in: - name: "Garbage cans in upper right" + garbage_cans_out: + name: "Garbage Cans Out" icon: mdi:trash-can input_text: @@ -27,10 +36,10 @@ input_datetime: template: - binary_sensor: - - name: "Garbage cans in" - unique_id: llmvision_garbage_cans_in + - name: "Garbage Cans Out" + unique_id: llmvision_garbage_cans_out device_class: presence - state: "{{ is_state('input_boolean.garbage_cans_in', 'on') }}" + state: "{{ is_state('input_boolean.garbage_cans_out', 'on') }}" attributes: last_run: "{{ states('input_datetime.llmvision_garbage_last_run') }}" last_response: "{{ states('input_text.llmvision_garbage_last_response') }}" @@ -38,7 +47,7 @@ template: source_camera: camera.garagecam automation: - - alias: LLM Vision - Garage cans upper right + - alias: LLM Vision - Garbage cans out id: d88a2e6d-78f3-4bb7-9d9f-c4d06e6eb5a9 mode: restart trigger: @@ -46,15 +55,15 @@ automation: entity_id: input_button.llmvision_garbage_check variables: prompt_text: > - Examine ONLY the upper-right quadrant of the image (top half + right half). Ignore everything else (car, floor text, door, bikes, bottles, bags). If you see a black garbage can in that upper-right quadrant, respond exactly "on". If none are present there, respond exactly "off". Do not add any other words. + Examine the image. I have taped a reflective X on the right wall. Look for the reflective X on the right wall. If you clearly see the X, respond exactly: on. If you cannot see the X, respond exactly: off. No other words. action: - service: llmvision.data_analyzer response_variable: llmvision_result data: provider: !secret llmvision_provider_entry - model: gpt-4o-mini + model: gpt-4.1-nano message: "{{ prompt_text }}" - sensor_entity: input_boolean.garbage_cans_in + sensor_entity: input_boolean.garbage_cans_out image_entity: - camera.garagecam include_filename: false diff --git a/config/templates/speech/briefing.yaml b/config/templates/speech/briefing.yaml index 40e62be5..2301185a 100755 --- a/config/templates/speech/briefing.yaml +++ b/config/templates/speech/briefing.yaml @@ -35,7 +35,7 @@ [Here is the current weather outside] {% set aq_description = state_attr('sensor.bear_stone_common_air_quality_index', 'description') | default('') %} {% set aq_index = states('sensor.bear_stone_common_air_quality_index') | int(0) %} - {% if aq_index >= 15 %} + {% if aq_index >= 50 %} [Air Quality: {{ aq_description }}] {% endif %} {% set pirateweather_metrics = states.sensor