Skip to content

Instantly share code, notes, and snippets.

@dskindell
Last active August 14, 2025 16:18
Show Gist options
  • Select an option

  • Save dskindell/3b0e8849c88157353a943321848e94c1 to your computer and use it in GitHub Desktop.

Select an option

Save dskindell/3b0e8849c88157353a943321848e94c1 to your computer and use it in GitHub Desktop.
Fork of balloon/ai-camera-analysis.yaml to support my use case
blueprint:
name: AI camera analysis
description: >-
Analyze camera footage with AI when motion is detected and write it to the logbook.
domain: automation
author: Paulus Schoutsen
input:
motion_entity:
name: Detection Sensor
selector:
entity:
filter:
domain: binary_sensor
camera_target:
name: Camera
selector:
entity:
domain: camera
ai_agent:
name: AI Agent
selector:
entity:
domain: ai_task
extra_instructions:
name: Extra Instructions
description: >
Additional instructions for the AI to consider when analyzing the camera footage.
This can be used to specify what to look for in the footage.
selector:
text: null
default: ""
analysis_delay:
name: Delay before analysis
description: Time to wait before analyzing the camera after motion is detected.
default: 5
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 }}"
entity_id: !input ai_agent
instructions: >
Give a 1 sentence analysis of what is happening on this camera picture. {{ 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 logbook
action: logbook.log
data:
entity_id: "{{ camera_entity }}"
message: "analysis: {{ result.data.analysis }}"
domain: ai_task
name: "{{ states[camera_entity].name }}"
- delay:
seconds: !input cooldown_time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment