If I look in HA GUI on the Generic Camera the picture gets updated on trigger, but the picture generated in /config/www/images/doorbell.jpg is some cached one from an earlier trigger (have also tried to manually deleted the picture, but the new generated is old).
The trigger is:
trigger:
platform: state
entity_id: binary_sensor.doorbell_ringing
from: ‘off’
to: ‘on’
Also tried to generate multiple snapshots from the same trigger to see if the 2nd or 3rd snapshot would be an updated one.
Also tried to put delays between the different parts of the automation to see if that would have solved it.
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.
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.
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.
@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!