Camera - Send & Save snapshot to mobile device when motion is detected with Conditions. Now with Custom Triggers!

I did some tests with the notify service.
I succesfully sent an alert with a jpg attach with the following config:

configuration.yaml

homeassistant:
  media_dirs:
    local: /config/media
service: notify.mobile_app_dadox
data:
      title: TEST
      message: test message
      data:
        attachment:
          content-type: jpeg
          url: /media/local/snapshots/last_motion.jpg
        push:
          sound:
            name: default
            critical: 1
            volume: 1

Then I put the same path (/media/local/snapshots/last_motion.jpg) to your blueprint, keeping all the other fields with the default parameter … but I got the “failed to load attachment” message :frowning_face:

remove the /local in the blueprint URL, the blueprint replaces /media with /media/local so it looks like the final URL it is going to load is /media/local/local/snapshots/last_motion.jpg.

Here is the actual code

snapshot_access_file_path: '{{ snapshot_create_file_path | replace(''/media'',''/media/local'')  }}'```

where snapshot_create_file_path should be /media/snapshots/last_motion.jpg
so the final URL becomes /media/local/snapshots/last_motion.jpg

The blueprint’s default path is /media/snapshots/{{ states[camera].object_id }}/last_motion.jpg.

Still not working.
This is now the blueprint url:

/media/snapshots/last_motion.jpg

and this is the message I get:

So I added this to configuration.yaml:

homeassistant:
  allowlist_external_dirs:
    - /config/media/snapshots

but I got the same error.

/media is not in /config but in root. I’m not sure why it cant get your image. What kind of HA install are you using?

try using /media/snapshots or /config/www (but remember to replace /config/www with /local in the notification) or any other folder that you have write access to.

shit, I will have to update the blueprint to support files in /www natively though. But it looks like you cannot write to /media at all which may be an underlying issue.

They would have to be in here either way I bet. (In order for something else to write to the folder)
Home Assistant Core Integration - Home Assistant.

1 Like

Try

  media_dirs:
    media: "/media"

thanks for your help! Always appreciated

1 Like

I’ve updated it to support the /config/www, try using the file path as /config/www/snapshots/{{ states[camera].object_id }}/last_motion.jpg and see if you can save the image there. This will expose the image to the internet though, but it seems like you have write issues.

Good morning community,

i am using this automation, but i have a problem with showing the right snapshot in my notification.
The automation saves the snapshot in /media/DoorbellCamera/last_motion.jpg and also saves in archive.

But it shows a really old snapshot in my iphone notification. I dont even know where it takes the snapshot from…

can someone help me?

alias: Snapshot bei Türklingel
description: ""
use_blueprint:
  path: TheRealFalseReality/send_snapshot_conditional.yaml
  input:
    camera: camera.doorbell
    sensor: binary_sensor.vto_doorbell
    notify_device: 35262d0fc29ef7f90fcdfdee202748a8
    is_ios: true
    notification_title: Türklingel
    file: /media/DoorbellCamera/last_motion.jpg
    archive_file: >-
      /media/DoorbellCamera/archive/motion_{{ now().strftime("%Y%m%d-%H%M%S")
      }}.jpg

Thanks in advance

cheers Steve

are you using the latest update of the blueprint? I think I had the issue but fixed it.

Hi TheRealFalseReality,
yes, i deleted the blueprint and reloaded it and set it up new.
i think it is working now. I will test it a cpl of days.

1 Like

Hello guys! Is there a way with this great blueprint to have more then 1 snapshot? I mean if movement is detected send snap from camera 1 and camera 2 instead of only 1 camera.

I don’t think so as it is. But you could try using the addition actions option or try the new “Take over this blueprint” feature to add that. The image component is a single URL. You can try just duplicating that part. But it may just be best and make an automation for each camera, keeping everything the same but the actual camera. I do that for a few cameras on certain conditions.

I use the archive option. Now de snapshot.jpg keeps showing the same picture from the past. Also on the archive multiple files have the same image.

are you updated to the latest version?

I think so. I use the link on the first page. I keep seeing the snapshot in the dark while the sun is shining :sun_with_face:

At first, thanks for this blueprint which is really useful.
Unfortunately i had the same problem like other before to get the snapshot on my iOS notification.

I am using HA Operating System on an Intel Nuc. The snapshot is correctly saved and i can reach it through the browser …
http://HA-URL:PORT/media/local/snapshots/CAMERA_NAME/last_motion.jpg?authSig=HASH

So the snapshot part is working fine.
But on my Apple Watch i just get a black “Screen” with a play button. On the iphone there is no picture shown in the notification.

Any idea what i am doing wrong?

Check the version number in the blueprint description, should be (v2.2.5) or later. I think I fixed that issue you are having.

Hmm, people have been posting about having issues on iOS. I do not have an iOS device so I cannot test properly. However, there is a iOS option for video support. I had that enabled in case it worked, but I just removed it in case that was the issue. Update the blueprint to 2.2.6

However, if you continue having errors, try to use the blueprint with it’s defaults and see if you get the image. In many cases, it’s the url that is notification is trying to use which seems like the issue. The code replaces some strings, like /media/media/local for example.

EDIT, looking at your URL, you already have /media/local so the notification is trying to use /media/local/local, remove the /local from the File Path option.