šŸ“ø Send camera snapshot notification on motion

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

You should format the config as code to make this useful to anybody else.

What is the relation of this to the topic of this thread (besides simply having an automation and camera in common), since this doesnā€™t seem to utilise the blueprint?

This blueprint works great! Only catch for me is that the images are ephermeral - if you tap the notification it just goes to home assistant and the image is sorta ā€¦ gone.

Is there a way to take the same image, and create a card from it, to drop into another dashboard that could be a card with the ā€œlast image produced from the motion trigger being set offā€?

1 Like

Push the notification, and keep it pushed until it opens.
Just a tap will open HAā€¦

1 Like

Is this only working with active Ring subscription? Because the snashots are very old?

I wouldnā€™t know, I donā€™t use ringā€¦

I figured it out.
i made a camera device out of the same image path, then made a card for the ā€œcameraā€.

config.yaml:

camera:
   - platform: local_file
     name: foyer_snap
     file_path: /config/www/tmp/snapshot_m3116_lve_1.jpg

card jinja:

 camera_view: live
 type: picture-glance
 entities: []
   camera_image: camera.foyer_snap
1 Like

Need help pls! I have some problems with this blueprint.
I have installed home assistant on proxmox VM.
I can reach HA from the web.
The automations only worked the first time, I had the notification on phone with the attached snapshot.
After that the automations generate an image file of zero byte in the folder /www/temp/ and no image attached to the notification on mobile app
My cam is a Tapo C200

This is the blueprint config

blueprint:
  name: Send a camera snapshot when motion is detected
  description: 'This automation blueprint creates a camera snapshot if motion is detected  and
    sends a notification to your phone with the picture.

    '
  domain: automation
  input:
    motion_sensor:
      name: Motion sensor
      description: The sensor wich triggers the snapshot creation
      selector:
        entity:
          domain: binary_sensor
          device_class: motion
          multiple: false
    camera:
      name: Camera
      description: The camera which creates the snapshot
      selector:
        entity:
          domain: camera
          multiple: false
    notify_device:
      name: Device to notify
      description: Device needs to run the official Home Assistant app to receive
        notifications
      selector:
        device:
          integration: mobile_app
          multiple: false
    is_ios:
      name: Is it an iOS device?
      description: Toggle if your selected device runs iOS, default is Android
      selector:
        boolean: {}
      default: false
    notification_title:
      name: Notification title (Optional)
      description: 'Default: "Motion detected!"'
      default: Motion detected!
    notification_message:
      name: Notification message (Optional)
      description: 'Default: "{{ motion_sensor_name }} detected movement!"'
      default: '{{ motion_sensor_name }} detected movement!'
    delay:
      name: Delay (Optional)
      description: Wait before creating camera snapshot
      default: ''
      selector:
        number:
          min: 0.0
          max: 60.0
          unit_of_measurement: seconds
          mode: slider
          step: 1.0
  source_url: https://community.home-assistant.io/t/send-camera-snapshot-notification-on-motion/254565
trigger:
  platform: state
  entity_id: !input motion_sensor
  from: 'off'
  to: 'on'
variables:
  motion_sensor: !input motion_sensor
  motion_sensor_name: '{{ states[motion_sensor].name }}'
  camera: !input camera
  notify_device: !input notify_device
  is_ios: !input is_ios
  notification_title: !input notification_title
  notification_message: !input notification_message
  delay: !input delay
  snapshot_create_file_path: /config/www/tmp/snapshot_{{ states[camera].object_id
    }}.jpg
  snapshot_access_file_path: '{{ snapshot_create_file_path | replace(''/config/www'',''/local'')
    }}'
action:
- delay: '{{ delay }}'
- service: camera.snapshot
  entity_id: !input camera
  data:
    filename: '{{ snapshot_create_file_path }}'
- device_id: !input notify_device
  domain: mobile_app
  type: notify
  title: '{{ notification_title }}'
  message: '{{ notification_message }}'
  data: '{% set android_data = {"image": "%s"} | format(snapshot_access_file_path)
  %} {% set ios_data = {"push": {"sound": {"critical": "1", "name": "default", "volume": "0.1"}}, "attachment": {"url": "%s", "content_type": "JPEG"}} | format(snapshot_access_file_path)
  %} {{ ios_data if is_ios else android_data }}'

This is my automation

- id: '1661436517428'
  alias: Send snapshot cam letto_sx movement detection
  description: ''
  use_blueprint:
    path: vorion/send-camera-snapshot-notification-on-motion.yaml
    input:
      motion_sensor: binary_sensor.letto_sx_motion
      camera: camera.cam_letto_sx_sd
      notify_device: bd3c0fb3b17128dd85de362ce9a61cbc
      delay: 1

You probably need to correct this line:

apparently it is save elsewhere

@aceindy
If I remove the snapshot file from the configured folder and manually launch the automation the file is created correctly in the folder but with 0 byteā€¦

If I correct the path in the code from

snapshot_access_file_path: '{{ snapshot_create_file_path | replace(''/config/www'',''/local'')
    }}'

to

snapshot_access_file_path: '{{ snapshot_create_file_path | replace(''/config/www/tmp'',''/local'')
    }}'

the files are created with some size, but not attached to the notification on mobile app
and if I try to open the images they are unredable with gimp or similarā€¦

EDIT: after edited the path only first time I run the automation the file have a size, second time I run the automation the files have 0 byteā€¦againā€¦

Hmmā€¦sounds like there is an issue with

service camera.snapshot

What happens when you call it from developer tools?

@aceindy

2022-08-30 21:11:19.329 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140054179184704] Error handling message: Service service camera.snapshot does not match format <domain>.<name> for dictionary value @ data['sequence'][0]['service']. Got 'service camera.snapshot' (invalid_format)

Help pleaseā€¦

Nice blueprint. Like it really much.

I have one issue with it though. I updates the message that is pushed to iOS with the critical params. However, I notice the message does not come through as critical. All my other automations, with critical message, come through as critical.

Anyone else here experiencing the same?

Hi, im not getting any notification at all. Any ideas why? Thanks for a great blueprint.

Has anyone gotten the group notification to work? I have the group setup correctly in configuration.yaml, but I canā€™t figure out how to call the group from the template.