Skip to content

Commit 3345bf3

Browse files
authored
Merge pull request #1549 from CCOSTAN/llm-vision
2 parents d900c64 + a8eca6f commit 3345bf3

File tree

3 files changed

+98
-42
lines changed

3 files changed

+98
-42
lines changed

config/packages/backups.yaml

Lines changed: 0 additions & 37 deletions
This file was deleted.

config/packages/llmvision.yaml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
######################################################################
2+
# @CCOSTAN - Follow Me on X
3+
# For more info visit https://www.vcloudinfo.com/click-here
4+
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
5+
# -------------------------------------------------------------------
6+
# LLM Vision - Garage Cans X Check - detects reflective X on right wall
7+
# Trigger with input_button.llmvision_garbage_check to update garbage_cans_out.
8+
# -------------------------------------------------------------------
9+
# Notes: LLMVision analyzes camera.garagecam; expects strict "on"/"off" output.
10+
# Docs: https://llmvision.gitbook.io/getting-started/usage/image-analyzer
11+
######################################################################
12+
13+
input_button:
14+
llmvision_garbage_check:
15+
name: "LLM Vision: Garage cans check"
16+
icon: mdi:delete-variant
17+
18+
input_boolean:
19+
garbage_cans_out:
20+
name: "Garbage Cans Out"
21+
icon: mdi:trash-can
22+
23+
input_text:
24+
llmvision_garbage_last_response:
25+
name: "LLM Vision garage response"
26+
max: 255
27+
llmvision_garbage_last_keyframe:
28+
name: "LLM Vision garage key frame"
29+
max: 255
30+
31+
input_datetime:
32+
llmvision_garbage_last_run:
33+
name: "LLM Vision garage last run"
34+
has_date: true
35+
has_time: true
36+
37+
template:
38+
- binary_sensor:
39+
- name: "Garbage Cans Out"
40+
unique_id: llmvision_garbage_cans_out
41+
device_class: presence
42+
state: "{{ is_state('input_boolean.garbage_cans_out', 'on') }}"
43+
attributes:
44+
last_run: "{{ states('input_datetime.llmvision_garbage_last_run') }}"
45+
last_response: "{{ states('input_text.llmvision_garbage_last_response') }}"
46+
last_key_frame: "{{ states('input_text.llmvision_garbage_last_keyframe') }}"
47+
source_camera: camera.garagecam
48+
49+
automation:
50+
- alias: LLM Vision - Garbage cans out
51+
id: d88a2e6d-78f3-4bb7-9d9f-c4d06e6eb5a9
52+
mode: restart
53+
trigger:
54+
- platform: state
55+
entity_id: input_button.llmvision_garbage_check
56+
variables:
57+
prompt_text: >
58+
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.
59+
action:
60+
- service: llmvision.data_analyzer
61+
response_variable: llmvision_result
62+
data:
63+
provider: !secret llmvision_provider_entry
64+
model: gpt-4.1-nano
65+
message: "{{ prompt_text }}"
66+
sensor_entity: input_boolean.garbage_cans_out
67+
image_entity:
68+
- camera.garagecam
69+
include_filename: false
70+
target_width: 1280
71+
max_tokens: 16
72+
expose_images: true
73+
- service: input_text.set_value
74+
target:
75+
entity_id: input_text.llmvision_garbage_last_response
76+
data:
77+
value: "{{ (llmvision_result.response_text | default('unknown'))[:250] }}"
78+
- choose:
79+
- conditions: "{{ llmvision_result is defined and llmvision_result.key_frame is defined }}"
80+
sequence:
81+
- service: input_text.set_value
82+
target:
83+
entity_id: input_text.llmvision_garbage_last_keyframe
84+
data:
85+
value: "{{ llmvision_result.key_frame }}"
86+
default:
87+
- service: input_text.set_value
88+
target:
89+
entity_id: input_text.llmvision_garbage_last_keyframe
90+
data:
91+
value: ""
92+
- service: input_datetime.set_datetime
93+
target:
94+
entity_id: input_datetime.llmvision_garbage_last_run
95+
data:
96+
datetime: "{{ now() }}"

config/templates/speech/briefing.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,8 @@
3535
[Here is the current weather outside]
3636
{% set aq_description = state_attr('sensor.bear_stone_common_air_quality_index', 'description') | default('') %}
3737
{% set aq_index = states('sensor.bear_stone_common_air_quality_index') | int(0) %}
38-
{% if aq_description %}
39-
Air Quality: {{ aq_description }}
40-
{% endif %}
41-
{% if aq_index >= 150 %}
42-
[Air quality is unhealthy; limit outdoor activity]
38+
{% if aq_index >= 50 %}
39+
[Air Quality: {{ aq_description }}]
4340
{% endif %}
4441
{% set pirateweather_metrics = states.sensor
4542
| selectattr('entity_id','search','pirateweather')

0 commit comments

Comments
 (0)