Thanks for the quick answer, but there the discussion is how to attach a jpeg image.
In my case I want to attach the picture from the entity “image.doorbell_event_image”
I do not know where its image is stored or how it is named.
I have just tested this to notify notifications on my Android.
for my device, there is an access token required, which can be found in the image entities attributes.
service: notify.notify
data:
message: Door PIR
data:
image: >-
/api/image_proxy/image.dp2_door_camera_last_motion_image?token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Thanks for your answer, I think it is not the same for an email, can you describe where to find the atributes if there is any in my image entity, could find anything under settings?
Like this you first take a snapshot and store it in a local folder, and then send that snapshot via e-mail.
In this case the /snapshots/ folder should exist in the root, next to the /config/ folder.
Note that you have to ensure access to this local folder: depending on where the local folder is you might need to add this to configuration.yaml:
From the firs code snip i get a bit further, but not an actual image attached:
For the second snip, this Doorbell does not start an live stream at the same moment as it is ringing, but this could maybe be accieved, have to think about it.
Hi Ed,
The second snip worked for me Thanks a lot!
I start the stream first, take the snapshot, turn off the stream and then attach the snapshot in an email.
There is quite a long delay (counted about 7 seconds from trigger to snapshot), but its the best for now.
Great!
One more idea (although a wild guess). You wrote:
What do you see when you right_click on this received image in the HA UI and select something like “Save image as…”?
Is this proposed image file name always the same?
If so, assuming that the image file name always is filename.jpg, you could try this:
The Doorbell can detect person and also pressing the ring button (on the snip 2 idea).
Made 2 different automations on this, seems like during this 7 second delay from detecting person and pressing ring that later automation gets discarded
Ah! I just realized that image.doorbell_event_image (being an entity) probably cannot directly be inserted in a full file path because this is a string.
But I re-read the post from ahaghshenas, and this still might be the solution.
You did not try his solution yet, did you?
If you go to Developer tools → States and enter the entity image.doorbell_event_image in the search field it shows the access_token and entity_picture attributes.
Following the solution from @ahaghshenas it looks like this entity_picture attribute is what you have to enter in the code like this:
But if this works I am still not sure that this access token is static: it might be changed with every new snapshot. So in that case it will not work consistently. But it’s worth a try.
OK, then I am out of ideas.
If no one else has any suggestions then it might be good to ask the code owners to look into this issue, because this lacking method of adding images via an image entity to e-mails might be a bug or missing feature in the SMTP Notification integration.
This should not be that hard to add because the same thing seems to be already supported by for instance the Companion App Notifications.
You could post an Issue on GitHub.
Im working on the same thing now where you able to find a solution ?
I seem to be missing proper path for the /api/image_proxy for the automation, but Im able to see the URL in the browser… What is the correct path to put in for the /api/image_proxy/ inside automation for SMTP or IOS notifications ? Does anyone know ?
My workaround on this was to start the P2P stream and take a snapshot and then stop the stream and mail the snapshot.
This sadly stopped working after upgrade to HA 2023-10-XX