šŸ“ø Send camera snapshot notification on motion

super ā€¦ thank you very much

i have to try but it looks like i can not set entity_id. I use unifi g4 doorbell ā€¦ :slight_smile:

My bad. :slight_smile: got it to workā€¦:slight_smile: thanx chefā€¦:slight_smile:

1 Like

Iā€™m new to using blueprints, so Iā€™m not exactly sure where to start troubleshooting. Iā€™m getting this error message in the HA logs.

homeassistant | 2021-08-04 15:14:25 ERROR (MainThread) [homeassistant.components.automation.send_a_camera_snapshot_when_motion_is_detected] Send a camera snapshot when motion is detected: Error rendering Send a camera snapshot when motion is detected delay template: offset should be format 'HH:MM', 'HH:MM:SS' or 'HH:MM:SS.F'

I did a little digging and it seems like there is a workaround by changing the ā€œoptionalā€ delay in the automation to something other than the default. I just bumped it up to 1s and it works fine now. Since the delay is labeled as optional in the automation I wouldnā€™t have expected to need to change it to make it work.

At any rate, a 0s or 1s delay makes no difference to me. Thanks for putting the blueprint together!

1 Like
 Hello and sorry if i'm off topic. I searched a lot before writting this message and i need halp with a blueprint. I tried myself to modify an existing blueprint like yours but it didn't work. What i need, is a blueprint to send camera snapshot based on door window sensor (binary). I think thtat your blueprint will do it if you just leave the choise to trigger on any binary sensor. Thank you so much for your work with this blueprint, is very usefull.

Did you manage to get around with this?

Yes, but in other way. I made my own automation:

alias: Intrusion Alert Send Inside Snapshot to Telegram
description: ''
trigger: []
condition: []
action:
  - repeat:
      until:
        - type: is_no_motion
          condition: device
          device_id: a2321254d4ce4c258fb56559f988deac
          entity_id: binary_sensor.motion_occupancy
          domain: binary_sensor
      sequence:
        - service: telegram_bot.send_photo
          data:
            disable_notification: true
            caption: Intrusion Alert!
            url: >-
              https://your.ha.com{{ states.camera.inside.attributes.entity_picture }}
        - delay:
            hours: 0
            minutes: 0
            seconds: 3
            milliseconds: 0
mode: single
variables:
  camera: camera.inside
  snapshot_url: '{{ states.camera.inside.attributes.entity_picture }}'

When creating it in editor put the url in last as it breaks the visual editor and afterwards you gotta edit in yaml. Your entity names/ids will be different but should give you the idea.

I got another automation that triggers on door opening, light switch pressing and motion sensors if I am away and that in turn triggers this one to send a photo to telegram every 3 seconds until motion is stopped.

Hi
Iā€™m trying to replicate your telegram bot automation but Iā€™m new to home assistant and Iā€™m not able to find what to replace on this

states.camera.inside.attributes.entity_picture

This is my automation code

- alias: Intrusion Alert to Telegram Cam Ingresso
  description: ''
  trigger: []
  condition: []
  action:
  - repeat:
      until:
        - type: is_no_motion
          condition: device
          device_id: Cam ingresso
          entity_id: binary_sensor.cam_ingresso_motion
          domain: binary_sensor
      sequence:
        - service: telegram_bot.send_photo
          data:
            disable_notification: true
            caption: Intrusion Alert!
            url: >-
             https://your.ha.com{{ states.camera.inside.attributes.entity_picture }}
        - delay:
            hours: 0
            minutes: 0
            seconds: 3
            milliseconds: 0
  mode: single
  variables:
    camera: camera.inside
    snapshot_url: '{{ states.camera.inside.attributes.entity_picture }}'

Hey! Did you manage to get a fix for this? I have the same problemā€¦

No, I still get sending old snapshots (different one from when I raised the issue, but still)ā€¦ The correct snapshot gets stored in the folder, but its attaching an old image for some reason.

Wierdā€¦ mine does exacly the same, i have tried changing the time to 20sec, but that dosenā€™t seem to be the reason. Hope to se some fix for this soon.
Thanks anyways!

Iā€™m not sure (and quite possibly completely wrong, these are the circumstances that made it work for me), but I think itā€™s dependent on your camera integration, it has to be able to send the snapshot / live feed as a Picture Entity Card (look at the examples at the bottom, iirc I adapted the one where they were sending live feed). I use Zoneminder (which HA integration is poorly maintained / seemingly abandoned, despite offering the lowest bandwidth+highest clarity camera streams of all the camera integrations I tested, but I digress) and Reolink integration from HACS.

My camera is named Camera Inside, itā€™s entity is called camera.inside hence my snapshot template is
{{ states.camera.inside.attributes.entity_picture }}
if your camera is called Holy Smokes it would be
{{ states.holy.smokes.attributes.entity_picture }} I imagine, Iā€™m fairly new to HA myself :wink:

Would it be possible to add the following to the notification?
priority: high
ttl: 0

I can receive the notifications on Android, but theyā€™re coming in extremely delayed. I tried to modify myself, but couldnā€™t figure out the syntax. (Iā€™m new-ish at HA)

Im seeing the same thingā€¦ The first few months I ran this it was instant, however now I am seeing delays of minutes some time, which makes the feature pointlessā€¦

That along with the fact that old snapshot were sent through in the notification now means I have removed it.

Thank you!
Maybe this should be mentioned in the documentation (first message). It also took a while for me to find out about the subtle difference between ā€œnotificationā€ and ā€œpersistent notificationā€.
We could assume that people are aware of the difference or add 1 line explaining the different behavior.

Great automation. How could I use it with a magnetic contact instead of the motion sensor?

I copied the blueprint and replaced the motion detector by an (esphome) doorbell buttonā€¦
see Send camera snapshot notification with Frenckā€™s doorbell
Or gist ā†’ https://gist.github.com/aceindy/d43b3a3237194e9846b18e0132de303b

variables:
  binary_sensor: !input 'binary_sensor'
  binary_sensor_name: '{{ states[binary_sensor].name }}'

First of all, congratulate the creator of the blueprint, Iā€™ve been using it on several of my cameras for a few days and it works wonderfully.

I would like to add clickable actions to the notification with photos, is it possible? I have looked for information but I have not found it ā€¦

Thank you!

I have not used it myself, but check this out:

1 Like

Would be great if this supported recording and sending video clips.

1 Like