Hi there,
I used Paulus Schoutsens initial blueprint and extended it with an output and the possibility to have a complete custom promt to ask to the AI.
For me it worked fine with the Google Generative AI Integration (not yet with the open router integration): Google Generative AI - Home Assistant
This blueprint will gonna be extended more and more - so input is welcome
blueprint:
name: AI camera analysis
description: >-
📷 ⚙️ v0.15 <br>
Analyze camera footage with AI when motion is detected.
This is an extended version, of Paulus Schoutsens intitial blueprint to analyze camera footage with AI.
domain: automation
author: Marcels Custom Shop & Paulus Schoutsen
input:
result_target:
name: "Result Helper (Note: 255 characters max!)"
selector:
entity:
domain: input_text
motion_entity:
name: Motion Sensor
selector:
entity:
filter:
device_class: motion
domain: binary_sensor
camera_target:
name: Camera
selector:
entity:
domain: camera
extra_instructions:
name: Your promt here
description: >
Ask the AI for what you want to know about the image.
selector:
text: null
default: ""
analysis_delay:
name: Delay before analysis
description: Time to wait before analyzing the camera after motion is detected.
default: 0
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
cooldown_time:
name: Cooldown
description: Time to wait between analyses.
default: 60
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
mode: single
max_exceeded: silent
triggers:
- trigger: state
entity_id:
- !input motion_entity
from: "off"
to: "on"
actions:
- variables:
camera_entity: !input camera_target
extra_instructions: !input extra_instructions
- delay:
seconds: !input analysis_delay
- alias: Analyse camera image
action: ai_task.generate_data
data:
task_name: "{{ this.entity_id }}"
instructions: >
{{ extra_instructions }}
structure:
analysis:
selector:
text: null
attachments:
media_content_id: "media-source://camera/{{ camera_entity }}"
media_content_type: ""
response_variable: result
- alias: Write analysis to input_text
service: input_text.set_value
target:
entity_id: !input result_target
data:
value: "{{ result.data.analysis }}"
- delay:
seconds: !input cooldown_time