I have a separate automation to create my snapshot. Then i have a different automation to email it to me after a time.
No more ideas from anyone how to not get a snapshot from cache, but a live one instead to be attached?
Are you sure that the picture generated in /config/www/images/doorbell.jpg is an old one? If you are using a browser to look at the picture it is probably caching as well. Can you check a time stamp on the file to determine if it’s old or new?
If you have access to the file system I would copy /config/www/images/doorbell.jpg to /config/www/images/doorbell_1.jpg and then open it in a browser to verify that it is really on old image or not.
Hi vic,
Yes, the timestamp of the picture file generated is the same time as the trigger and the picture itself have a timestamp in the picture itself and those do not match.
The file is sent tom my email, so no browser cache involved here.
It is known issue that home assistant will send a cached copy of the snapshot. I originally experienced this problem and was able to resolve it by adding the html option using the cid keyword to the notify call.
Here is my automation.
alias: Mailbox Opened
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.mailbox_state
to: "on"
condition: []
action:
- service: camera.snapshot
data:
filename: www/tmp/mailbox.jpg
target:
entity_id: camera.driveway
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- service: notify.mail_xxxxx
data:
title: Mailbox Opened
message: "snapshot:"
data:
images:
- www/tmp/mailbox.jpg
html: |
<img src="cid:mailbox.jpg">
mode: single
Hi vic4news,
Now I copied exactly your code with the delay as well.
I still get 1 picture before the latest picture (not sure if it is like this every time) attached to the email (In HA GUI I get the latest every time).
The html part was nice, so it is in the mail and not as an attachment anymore.
SOLVED!
I take 2 snapshots with a delay of minimum 5 seconds between, then I only use the second snapshot as the attachment.
Thanks for all help from everyone!
Legend. Thanks for the tip. Finally able to send the Eufy doorbell image to my Android TV.
@AseKarlsson
Can I get your updated flow to make it work for mobile notifications?
I have been fighting with this all day with no luck.
@Soulflyzz, It stopped working a long time ago and have not put in the time to solve it. If you are able to solve it again, please come back with info!
action: notify.X
metadata: {}
data:
title: "ALERT ! : Deurcamera alarm"
message: Zie snapshot in bijlage
target:
- [email protected]
data:
images:
- www/tmp/snapvideo.mp4
- www/tmp/snapshot.jpg
my tmp map is linke config/www/tmp
in my config.yaml I have
allowlist_external_dirs:
- /config
- www/tmp
I am getting the mail, but no attachement. Where am I going wrong ?
Same problem for me. I can see the file stored in my www/images. I receive the message but without attachment.
action: notify.xxxx_gmail_com
data:
message: New Event Detected
title: HA log entry made
target:
- [email protected]
data:
from: [email protected]
images:
- /config/www/images/doorbell_last_image.jpg
html: |
<img src="cid:doorbell_last_image.jpg">
Would that be some Gmail limitation?
What am I doing wrong?
I use smtp integration, with google I didnt got it working…
This works fine for me:
notify:
- name: "email"
platform: smtp
sender: "[email protected]"
recipient: "[email protected]"
server: smtp.gmail.com
port: 587
timeout: 15
encryption: starttls
username: [email protected]
password: "redacted"
sender_name: Home Assistant
action within an automation:
- service: notify.email
data_template:
title: 'CCTV Images'
message: "CCTV Images"
data:
images:
- /config/www/camera_snapshots/front_door_alarm.jpg
- /config/www/camera_snapshots/driveway_alarm.jpg
- /config/www/camera_snapshots/street_view_zoom_alarm.jpg
- /config/www/camera_snapshots/garden_shed_alarm.jpg
Thats what i said. Smtp integration…
So maybe you have something setup wrong, that’s why I posted my code. Double check yours because it should work.
I think he uses a gmail integration, not the smpt…
I work on raspberry pi 4 with Home Assistant OS * Core2024.12.0
- Supervisor2024.11.4
- Operating System13.2
I have a snapshot recorded in config/www/snapshots, confirmed by
➜ ~ ls config/www/snapshots
frontyard.jpg
I use google mail integration with the code :
action: notify.XXXX_gmail_com
data:
message: photo essai 1
title: Photo
data:
images:
-‘/config/www/snapshots/frontyard.jpg’
target:[email protected]
In the configuration.yaml, I have added
homeassistant:
allowlist_external_dirs:
- ‘/config/www/snapshots/’
I recieve the mail correctly but without attachment.
Coud you help me to find why?
Hi Louis, welcome to the HA community.
Please have a read of this and edit your above post accordingly.