I’m having a lot of fun with the Google AI stuff and my home cameras. I’ve successfully got an automation running that takes three snaps of a camera, and asks google to describe what has / is happening.
It then outputs the text as a response variable. I know this is working because I can then automate a notification to my iPhone that has the correct output of text.
What I’d also like to do is have this same output of text appear in a ‘input_text’ helper that I have setup so that I can see the last motion detected as a text box in my dashboard. This -for some reason- isn’t working. It will not update the text.
I’ve included the script below - can anyone see where I’ve gone wrong? Many thanks.
alias: Camera - Driveway 1 - Snapshot, AI & Notification (PERSON)
sequence:
- alias: AWTRIX Person Outside
data:
topic: awtrix_efb7bc/notify
payload: |-
{
"icon": "32198",
"text": [
{
"t": "Person Outside",
"c": "0000FF"
}
],
"pushIcon": 0,
"repeat": 4
}
action: mqtt.publish
- metadata: {}
data:
filename: ./www/snapshots/driveway1_personsnapshot1.jpg
target:
entity_id:
- camera.g4_front_high
enabled: true
action: camera.snapshot
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
enabled: true
- metadata: {}
data:
filename: ./www/snapshots/driveway1_personsnapshot1.jpg
target:
entity_id:
- camera.g4_front_high
enabled: true
action: camera.snapshot
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
enabled: true
- metadata: {}
data:
filename: ./www/snapshots/driveway1_personsnapshot2.jpg
target:
entity_id:
- camera.g4_front_high
enabled: true
action: camera.snapshot
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
enabled: true
- metadata: {}
data:
filename: ./www/snapshots/driveway1_personsnapshot3.jpg
target:
entity_id:
- camera.g4_front_high
enabled: true
action: camera.snapshot
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
enabled: true
- metadata: {}
data:
prompt: >-
Motion has been detected caused by a person. Compare and very briefly
describe what you see in the following images from my CCTV camera. You
can arrange the screenshots in time order to make it easier. What do you
think caused the motion alarm? Describe any people in detail. Do not
describe stationary objects or buildings. Ensure output is 255
characters or less.
image_filename:
- ./www/snapshots/driveway1_personsnapshot1.jpg
- ./www/snapshots/driveway1_personsnapshot2.jpg
- ./www/snapshots/driveway1_personsnapshot3.jpg
response_variable: generated_content_p
action: google_generative_ai_conversation.generate_content
- action: input_text.set_value
target:
entity_id: input_text.google_ai_generated_text
data:
value: "{{generated_content_p['text'] }}"
- metadata: {}
data:
title: Front - Person Detected
message: "{{generated_content_p['text'] }}"
data:
image: /local/snapshots/driveway1_personsnapshot2.jpg
action: notify.mobile_app_matts_iphone_15
- action: tts.speak
metadata: {}
data:
cache: true
media_player_entity_id: media_player.kitchen_sonos
message: "{{ generated_content_p.text }}"
target:
entity_id: tts.home_assistant_cloud
enabled: false
mode: single
description: ""
icon: mdi:motion-sensor