For some reason, the png file can be access in path “/media/local/loca/<image.png>”
And I’m not sure why it’s configured that way. But now the image can be viewed in the notification.
I didn’t have to add anything in the configuration.yaml, like allowlist_external_dirs. None.
I also had to add a 5 second delay to prevent Home Assistant from sending the previous saved image.
- alias: Motion Detected
trigger:
- platform: state
entity_id: binary_sensor.living_room_camera_motion_detected
to: 'on'
action:
- service: camera.snapshot
target:
entity_id: camera.living_room_camera
data:
filename: '/media/local/living-room_motion-detected.png'
- delay: '00:00:05'
- service: notify.ios_phones
data:
message: Motion detected in the living room.
data:
attachment:
url: '/media/local/local/living-room_motion-detected.png'
content-type: png
hide-thumbnail: false
For anyone who runs across this post and is confused (like I was) about what the fix was, if you are storing files in /media/folder/filename.png when you take a snapshot, you can then access that content at /media/local/folder/filename.png when using that image to send a notification (note the addition of /local after /media).
The documentation states:
“A file stored in /media/file.jpg on-disk is represented by /media/local/file.jpg in the notification. Note the addition of the local part of the path.”