-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added 'frigate event summary' blueprint
- Loading branch information
1 parent
dd06b59
commit 5d81fe5
Showing
2 changed files
with
153 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
blueprint: | ||
name: Frigate Event Summary | ||
description: Summarizes frigate events and sends a notification with a preview to your phone | ||
domain: automation | ||
input: | ||
notify_device: | ||
name: Notify Device | ||
description: The device to send the notification to | ||
selector: | ||
device: | ||
integration: mobile_app | ||
frigate_url: | ||
name: Frigate URL | ||
description: Frigate's base url to fetch preview (e.g. http://localhost:5000) | ||
selector: | ||
text: | ||
multiline: false | ||
cooldown: | ||
name: Cooldown | ||
description: Time in minutes to wait before running again | ||
default: 10 | ||
selector: | ||
number: | ||
min: 0 | ||
max: 60 | ||
provider: | ||
name: Provider | ||
description: Configuration to use for the video_analyzer service. See docs for additional information. | ||
selector: | ||
config_entry: | ||
integration: llmvision | ||
model: | ||
name: Model | ||
description: Model to use for the video_analyzer service | ||
default: "gpt-4o-mini" | ||
selector: | ||
text: | ||
multiline: false | ||
message: | ||
name: Prompt | ||
description: Model prompt for the video_analyzer service | ||
default: "Summarize briefly what's happening in the camera feed (one sentence max). Don't describe the scene. If there is a person, describe what they're doing." | ||
selector: | ||
text: | ||
multiline: true | ||
interval: | ||
name: Interval | ||
description: Analyze frames every <interval> seconds | ||
default: 3 | ||
selector: | ||
number: | ||
min: 1 | ||
max: 60 | ||
target_width: | ||
name: Target Width | ||
description: Width in pixels to downscale (uses less tokens) | ||
default: 1280 | ||
selector: | ||
number: | ||
min: 512 | ||
max: 1920 | ||
detail: | ||
name: Detail | ||
description: Detail parameter (OpenAI only) | ||
default: 'high' | ||
selector: | ||
select: | ||
options: | ||
- 'high' | ||
- 'low' | ||
max_tokens: | ||
name: Maximum Tokens | ||
description: Maximum number of tokens to generate | ||
default: 50 | ||
selector: | ||
number: | ||
min: 1 | ||
max: 100 | ||
temperature: | ||
name: Temperature | ||
description: Randomness. Lower is more accurate, higher is more creative | ||
default: 0.1 | ||
selector: | ||
number: | ||
min: 0.1 | ||
max: 1.0 | ||
step: 0.1 | ||
|
||
variables: | ||
base_url: !input frigate_url | ||
cooldown: !input cooldown | ||
|
||
trigger: | ||
platform: mqtt | ||
topic: "frigate/events" | ||
|
||
condition: | ||
- condition: template | ||
value_template: '{{ trigger.payload_json["type"] == "end" }}' | ||
- condition: template | ||
value_template: "{{ (now() - state_attr(this.entity_id, 'last_triggered')).total_seconds() / 60 > cooldown }}" | ||
|
||
action: | ||
- service: llmvision.video_analyzer | ||
data: | ||
event_id: '{{trigger.payload_json["after"]["id"]}}' | ||
provider: !input provider | ||
model: !input model | ||
message: !input message | ||
interval: !input interval | ||
include_filename: false | ||
target_width: !input target_width | ||
detail: !input detail | ||
max_tokens: !input max_tokens | ||
temperature: !input temperature | ||
response_variable: response | ||
|
||
- choose: | ||
- conditions: | ||
- condition: template | ||
value_template: "{{ base_url is not none and base_url != '' }}" | ||
sequence: | ||
- alias: "Send notification with preview" | ||
domain: mobile_app | ||
type: notify | ||
device_id: !input notify_device | ||
title: "{{ trigger.payload_json.after.label|capitalize }} seen" | ||
message: "{{ response.response_text }}" | ||
data: | ||
video: "{{base_url}}/api/events/{{trigger.payload_json['after']['id']}}/clip.mp4" | ||
default: | ||
- alias: "Send notification" | ||
domain: mobile_app | ||
type: notify | ||
device_id: !input notify_device | ||
title: "{{ trigger.payload_json.after.label|capitalize }} seen" | ||
message: "{{ response.response_text }}" |