šŸ“ø Send camera snapshot notification on motion

Is it possible to add ttl: 0 and priority: high to the ā€œdata:ā€ tab? To get the notification quicker to the phone, even when the phone or app is active.

Iā€™m not skilled in the coding, but I was wondering if it could be something like this:

data: >
    
        {% set android_data = {"image": "%s"} | format(snapshot_access_file_path) %}
        {% set ios_data = {"attachment": {"url": "%s", "content_type": "JPEG"}} | format(snapshot_access_file_path) %}
        {{ ios_data if is_ios else android_data }} 
        ttl: 0
        priority: high

Is it possible to add a delay/throttle. To prevent the flood of msgā€™s. Like 1 msg/10sec?

Did anyone solve this problem ?

Once I changed the delay from 0 to 1 it started working, anyone else have this issue?

The blueprint or HA is expecting a value in the delay, but setting 0 in the automation leaves it empty, so no line for ā€œdelayā€ in the yaml.

I set it to 0.1 (disregard the field becoming red, just save) and it works (it creates the line).

Or go to the automationā€™s yaml and now that you have the line, change the 1 to 0 or whatever:

    delay: 0
2 Likes

I was having the same issue. New snapshot is created, but an old (cached?) one is sent to the notification :frowning:

So, Iā€™ve done my own automation based on this blueprint and another one I had, adding a timestamp to the snapshot:

alias: Mirilla notification Test
description: ''
trigger:
  - platform: state
    entity_id:
      - binary_sensor.entrada_motion
    from: 'off'
    to: 'on'
condition: []
action:
  - service: camera.snapshot
    data:
      filename: /config/www/tmp/{{filename}}.jpg
    target:
      entity_id: camera.entrada_sd
  - service: notify.mobile_app_iphone_de_antonio
    data:
      message: Movimiento detectado
      data:
        attachment:
          url: /local/tmp/{{filename}}.jpg
          content-type: JPEG
variables:
  filename: snapshot-{{now().strftime("%d%m-%H%M%S")}}
mode: single

Setting the variable in yaml mode, so that the filenames match.
OF course the folder will get full of snapshot, so a periodic cleanup will be necessary. Theyā€™re 7kb for me so not a big deal.

5 Likes

I had this working but since letting my subscription cease on my Ring account I now donā€™t get any snapshots ā€¦ do I need a subscription for snapshots to be captured?

Looking at this because I am getting old images sent the same as some others here.
Are we we sure itā€™s a cache issue as I have had success by turning on the preload stream option for the camera.
My theory is it takes a while for the camera to be available/connected and it sends the message with the previous image.
It may also work with a delay between calling the snapshot service and sending the message to give the camera time to connect.

It will be nice if the notification can send thru email, so can be archived the alerts.

Great blueprint!
I have it running using the the snapshot of my Nest camera but I keep getting the same old snapshot created in the /config/www/tmp folder rather than the current ā€¦ any clues why? (note: I have changed the dely and the pre-stream options to see if that helps but make no different)
[update] after a few restarts it seems to be work :crossed_fingers:

I have just set this up seemsn OK, I get the notification with a thumbnail (too small to see), then when I open the notification it just opens my home assistant app, I was expecting to see an image of my cameraā€¦ any ideas cheers

Keep pressing the notification to show the picture (just clicking it will open HA) :wink:

I add to my dashboard a card for ā€žlast snapshot pictureā€œ from my cam, but it updates not the picture if it is a ā€žnewā€œ movement/picture there. Maybe somebody know whats the problem? Or is it not possible that the card automatic update the picture if it is a new one there?

Solved :white_check_mark:

1 Like

Can you please show me a example how to send the notification/picture on 2 devices?

I created a group but cant use it in the blueprint. Just the devices

Post your config.

Please elaborate. Whatā€™s the error?

notify.* are services. Each device gets a notify service, and the notification group works exactly the same way (the way itā€™s called). Iā€™m not sure what you mean here. Does it work with using the service call for a single device?

It worked perfectly until the 2022.7 upgrade.
Now it creates an image when an event occurs, displays the alert in the thumbnail, but then never opens and the alert disappears.
When I build the URL manually and enter it into the browser, the image opens.
I have no idea yet if itā€™s the CORE upgrade or the app on the mobile.
If anyone knows how to get it working again, Iā€™d be very happy.
I looked into it quite a bit today but didnā€™t come up with anything.

@Filip_Svoboda
can you please share the code you added?

Is it possible to move an dahua ptz camera to an another position when the doorbell activated?

Here is my automation to record camera instead of snapshot: This automation will send 30 seconds video (mp4) thru gmail. Iā€™m only sending 30 sec video only to minimize the size of the file. You can adjust the camera resolution also to make file size smaller. Also I set the Yolink motion sensor to trigger motion every 15 minutes and I have 45 sec delay before sending the file.

  1. Iā€™m using different trigger like Yolink outside motion sensor, Garage door alarm switch, Eufy Video Door.
  2. Iā€™m using various Amcrest camera.
  3. I setup SMTP integration with Google.
  4. Optional, Iā€™m using Alarmo integration from HACS for ā€œconditionā€ in case if Iā€™m working in the yard not to trigger the automation.

id: ā€˜1658460748134ā€™
alias: ā€˜Notify: Driveway Camera Recordā€™
description: Camera Notification thru Gmail
trigger:

  • platform: state
    entity_id:
    • binary_sensor.driveway_motion_sensor_motion
      to: ā€˜onā€™
      condition:
  • condition: device
    device_id: a6a81ded68d8f61855eba5f210e47dc1
    domain: alarm_control_panel
    entity_id: alarm_control_panel.outside_motion
    type: is_armed_away
    action:
  • service: camera.record
    data:
    filename: /config/www/tmp/record/driveway.mp4
    duration: 30
    target:
    device_id: 0ee57ec95412bc287f53167def4fc936
  • delay:
    hours: 0
    minutes: 0
    seconds: 45
    milliseconds: 0
  • service: notify.google_mail
    data:
    message: ā€˜Camera: Driveway Camera Motion Recordā€™
    data:
    images:
    - /config/www/tmp/record/driveway.mp4
    title: ā€˜Camera: Driveway Camera Motion Recordā€™
    mode: single
3 Likes