Guide for CCTV Snapshot on motion, send to Google Generative AI & get notification with description & snapshot

Sweet thanks for posting that, I had been meaning to update to include timestamps but never got around to it. Glad you got it sorted. :slight_smile:

@Aussie_Adam

Im getting the alerts and the AI generated text, but no image preview.

Does the image only show if motion changes detected, rather than when “no obvious motion observed”


Edit it seems like I get no images even if it detect and describes and event.

Thank you very much! I have this setup with 4 cams and it works perfectly.

1 Like

I have to come back and edit this. “continue_on_error” doesn’t work with the Dahua integration. I can’t link it right now, but there’s a specific way integrations need to handle errors in order to work with continue_on_error, and that integration doesn’t appear to do it, so when my script fails to get an image from the camera, the whole thing fails. It’s not common, but I do wish I could get around it somehow (since I grab 3 images, losing one or even two wouldn’t be that big a deal).

This is working nicely with a few Amcrest cams (I’m using the HACS Dahua integration because I need intrusion detection and advanced event (“human”) detection which the Amcrest integration doesn’t offer). One thing I had to add was “continue_on_error: true” to each snapshot generation portion of the scripts because I had a situation where one of the snapshots timed out, and the whole thing failed.

1 Like

Wow!
Nice guide, and easy setup.

I dont really know if some else having the same issue but when I send the notification to my Samsung S21 Ultra the provided text is cropped.
Is there a another way to display the full text lenght ?

1 Like

what cameras would work for this?

Any camera that can be used in HA.
I’m using frigate as a NVR and ReoLink cameras… They are quite good for the purpose.

1 Like

Having the same issue on a s23. Did you find a solution?

Love it otherwise, works brilliant just not way to see the whole message :sweat_smile:

Well I’ve some success… If I change the font size to smaller, I can fit more characters,

1 Like

Does anyone have an idea how to make a notification on the phone so that in one message with a picture it doesn’t cut off the text? Currently it only shows 2 lines and a photo, you can’t read the rest of the message, when you send separately there are full messages.

How do you pull back up old alerts that have been seen on your iPhone? Is there a function to record and pull back up in home assistant?

How’d you go about that?
I’ve noticed the same issue on my S20+. My galaxy watch at least shows me the full text.

Did you ever come up with a solution to this one? I’ve got 2 cars in the driveway and I’m either getting told that the stationary car is the entering the drive or that the car that is moving is doing the opposite. :rofl:

You can go into Google AI and tell it the cars are not moving in future alerts. It will store the information to tell it to remember.

1 Like

Is there a way to show the most recent notification being sent to mobile as a card ( picture + text ) on the dashboard. Would be nice to showoff :slight_smile: on kiosk.

make sure you use local in the path for snapshots NOT www. It’s the same directory but when using http you must call it via local. For example:

image: /local/snapshots/driveway1_snapshot2.jpg

Nice, I will look at adding continue on error to my script when I get a minute. Sounds like a better way to do! :slight_smile:

To achieve something similar, I added HA dashboard notifications and android tv notifications to my script that I use, I haven’t played with displaying images but it just shoots the text to HA as notification (like when an update is available) or pops up the text on my tv (if it’s on). I will try tidy up the script and upload it as another version or something in the next week or two if you like?

Yep. I sorted this for me and the issues of my alpacas always setting it off, it’s all in the prompt you ask!

For my personal script, I added to mine: “… The driveways starts up the top left of the image and the carport is at the bottom of the image, if a car hasn’t moved when comparing images, ignore it and do not describe it in your response. Also ignore all Alpacas and Kangaroos movement and do not describe them in your response. …” :slight_smile:

This seems for me to have worked pretty well and it now correctly tells me if I am coming or going and doesn’t tell me if my car is parked in the drive and something else sets it off.

Play with your prompt wording and see how you go!

This is an Android restriction. You can either have the full notification text or you can have it with the image - you cannot have both. My solution has been to generate two notifications - one text only, and one image only.