Skip to content

Instantly share code, notes, and snippets.

@peyanski
Created August 20, 2025 06:43
Show Gist options
  • Save peyanski/97e251136d0165a720e8ec72172cc93b to your computer and use it in GitHub Desktop.
Save peyanski/97e251136d0165a720e8ec72172cc93b to your computer and use it in GitHub Desktop.
alias: Count Persons from a Pic
description: Uses AI Task to analyze a camera snapshot and count persons
triggers:
- trigger: time_pattern
minutes: /5
enabled: true
- trigger: time_pattern # execute the automation every 10 seconds just to test the automation
seconds: /10
enabled: false
actions:
- data:
instructions: Analyze the attached image and count the number of persons visible.
attachments:
media_content_id: media-source://media_source/local/7me.jpg
media_content_type: image/jpeg
metadata:
title: 7me.jpg
thumbnail: null
media_class: image
children_media_class: null
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
task_name: count persons
structure:
people:
selector:
number: null
response_variable: ai_response
action: ai_task.generate_data
- target:
entity_id:
- input_number.person_count
data:
value: "{{ ai_response.data.people }}"
action: input_number.set_value
- action: persistent_notification.create
metadata: {}
data:
message: >-
I just count {{ ai_response.data.people }} people on the picture and I
updated the input_number.person_count with this value
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment