Hello,
i have a script that snaps pictures of my camera when motion is detected, then gives it to google ai to comment on it, and sends it to my phone as a notification.
The way it is now is that every picture is called doorbell_1.jpg and gets overwritten by the next snapshot. This needs to be changed somehow that all pictures get saved and not overwritten. From a previous unrelated blueprint it time stamped them so that way they all are named different, but im not sure how to do it.
And the next step would be, how would i tell google ai to use the latest jpg when motion is detected in stead of an old one?
the script is as followed:
alias: Camera Doorbell - Snapshot, AI & Notification
sequence:
- metadata: {}
data:
filename: /config/www/tmp/doorbell_1.jpg
target:
entity_id: camera.doorbell_main
action: camera.snapshot
- metadata: {}
data:
prompt: >
Motion has been detected, very briefly describe what you see in this
image from my doorbell camera. What do you think caused the motion
alarm? If a person is present, describe them in detail. Don't describe
stationary objects or buildings. Your message needs to be short enough
to fit in a phone notification.
image_filename: /config/www/tmp/doorbell_1.jpg
response_variable: generated_content
action: google_generative_ai_conversation.generate_content
- metadata: {}
data:
title: Doorbell Motion Detected
message: "\"{{ generated_content['text'] }}\""
data:
image: /local/tmp/doorbell_1.jpg
entity_id: camera.doorbell_main
actions:
- action: URI
title: Vieuw Picture
uri: https://xxxx/local/tmp/doorbell_1.jpg
action: notify.mobile_app_pixel_7_pro
- metadata: {}
data:
title: Doorbell Motion Detected
message: "\"{{ generated_content['text'] }}\""
data:
image: /local/tmp/doorbell_1.jpg
entity_id: camera.doorbell_main
actions:
- action: URI
title: Vieuw Picture
uri: https://xxxx/local/tmp/doorbell_1.jpg
action: notify.mobile_app_phone_brigitte
mode: single
description: ""