Skip to content

Commit 02a554a

Browse files
committed
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.
1 parent 2265f2b commit 02a554a

File tree

2 files changed

+89
-5
lines changed

2 files changed

+89
-5
lines changed

config/packages/llmvision.yaml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# LLM Vision test package: checks the garage camera for garbage cans in the upper-right corner.
2+
# Trigger with input_button.llmvision_garbage_check to update input_boolean.garbage_cans_in.
3+
4+
input_button:
5+
llmvision_garbage_check:
6+
name: "LLM Vision: Garage cans check"
7+
icon: mdi:delete-variant
8+
9+
input_boolean:
10+
garbage_cans_in:
11+
name: "Garbage cans in upper right"
12+
icon: mdi:trash-can
13+
14+
input_text:
15+
llmvision_garbage_last_response:
16+
name: "LLM Vision garage response"
17+
max: 255
18+
llmvision_garbage_last_keyframe:
19+
name: "LLM Vision garage key frame"
20+
max: 255
21+
22+
input_datetime:
23+
llmvision_garbage_last_run:
24+
name: "LLM Vision garage last run"
25+
has_date: true
26+
has_time: true
27+
28+
template:
29+
- binary_sensor:
30+
- name: "Garbage cans in"
31+
unique_id: llmvision_garbage_cans_in
32+
device_class: presence
33+
state: "{{ is_state('input_boolean.garbage_cans_in', 'on') }}"
34+
attributes:
35+
last_run: "{{ states('input_datetime.llmvision_garbage_last_run') }}"
36+
last_response: "{{ states('input_text.llmvision_garbage_last_response') }}"
37+
last_key_frame: "{{ states('input_text.llmvision_garbage_last_keyframe') }}"
38+
source_camera: camera.garagecam
39+
40+
automation:
41+
- alias: LLM Vision - Garage cans upper right
42+
id: d88a2e6d-78f3-4bb7-9d9f-c4d06e6eb5a9
43+
mode: restart
44+
trigger:
45+
- platform: state
46+
entity_id: input_button.llmvision_garbage_check
47+
variables:
48+
prompt_text: >
49+
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.
50+
action:
51+
- service: llmvision.data_analyzer
52+
response_variable: llmvision_result
53+
data:
54+
provider: !secret llmvision_provider_entry
55+
model: gpt-4o-mini
56+
message: "{{ prompt_text }}"
57+
sensor_entity: input_boolean.garbage_cans_in
58+
image_entity:
59+
- camera.garagecam
60+
include_filename: false
61+
target_width: 1280
62+
max_tokens: 16
63+
expose_images: true
64+
- service: input_text.set_value
65+
target:
66+
entity_id: input_text.llmvision_garbage_last_response
67+
data:
68+
value: "{{ (llmvision_result.response_text | default('unknown'))[:250] }}"
69+
- choose:
70+
- conditions: "{{ llmvision_result is defined and llmvision_result.key_frame is defined }}"
71+
sequence:
72+
- service: input_text.set_value
73+
target:
74+
entity_id: input_text.llmvision_garbage_last_keyframe
75+
data:
76+
value: "{{ llmvision_result.key_frame }}"
77+
default:
78+
- service: input_text.set_value
79+
target:
80+
entity_id: input_text.llmvision_garbage_last_keyframe
81+
data:
82+
value: ""
83+
- service: input_datetime.set_datetime
84+
target:
85+
entity_id: input_datetime.llmvision_garbage_last_run
86+
data:
87+
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 >= 15 %}
39+
[Air Quality: {{ aq_description }}]
4340
{% endif %}
4441
{% set pirateweather_metrics = states.sensor
4542
| selectattr('entity_id','search','pirateweather')

0 commit comments

Comments
 (0)