šŸ“ø Notification with camera snapshot with blocking condition and clickaction

hey Jack,
I suggest you clone the blueprint and change the domain accordingly.

Thanks for the work and effort in this blueprint. Was wondering how to go about sending notifications to multiple devices. Is this possible?

Thanks again!

i think the easiest is to make a notification group.

1 Like

Nice Blueprint! One feature request: My (Chinese) ONVIF camera sends a ā€˜motion detectedā€™ every second during motion. This results in many notifications. Is it possible to add a ā€˜time-outā€™ timer so that once the automation is kicked off it wonā€™t do that again for xx seconds?

@Michael3871 Just make a new template-sensor which gets ā€œoffā€ when no motion is detected for maybe 30seconds or something.
Timeout could be realised with a wait at the end and a condition that the automation only starts when it is not already running. Automation mode will create a warningā€¦

@StanG nice blueprint, like it. Borrowed me your code for my own automation, because I dont like blueprints.

i cannot get this to work, even after removing ā€œmobile_appā€ prerequisites in the code.

Iā€™m not sure but i think a notification group is not a device, it is a service?
Hoping there is an easy solution to this, I use it with my doorbells and It works like a charm. However I have to run 4 automations to cover all devices to be notified and it would be more elegant if it just could be one :blush:

never got the notification group working either. Only lists actual mobile devices.

I really want to use the notify.all (I have created a IOS group) but this template only let you select one mobile device, any way to use this? (You wrote: * Notify device entity (mobile_app), if needed you could create device groups and use that instead of a single device.) but then I would need to remove the mobile_app in the blueprint? sorry if I misunderstood this

Hmm youā€™re right, that wonā€™t work.
Iā€™ll have to experiment a bit.

EDIT: I tried it with service call notify.notify and then the data, but that didnā€™t seem to work.

- service: notify.notify
    data:
      title: "{{ notification_title }}"
      message: "{{ notification_message }}"
      target: !input notify_device
      data: >

I couldnā€™t not find a selector that would let met select the notify group.
So I tried with object and just typing in ā€œSmartphones_en_Tabletā€ as value (the name of my group).

Not working yet, here is what Iā€™m trying:

I have the notification to group working, but without all the data. Just the title and the message.
Iā€™m not quite sure how to solve this.
Iā€™ve tried many iterations of extra data: line or not.

  - service: notify.notify
    data:
      title: "{{ notification_title }}"
      message: "{{ notification_message }}"
      data:
       target: !input notify_who
       data: >
        {% if is_ios %}
          {% if is_critical %}
            {% set platform_data = { "channel": "%s", "url": "%s", "attachment": {"url": "%s", "content_type": "JPEG"},  "push": { "category": "%s", "sound": { "name": "default", "critical": 1, "volume": 1.0 } } } | format(channel_name, clickAction, snapshot_access_file_path, group_name) %}
          {% else %}
            {% if overwrite_similar %}
              {% set platform_data = { "channel": "%s", "url": "%s", "apns_headers": { "apns-collapse-id": "%s" }, "attachment": {"url": "%s", "content_type": "JPEG"},  "push": { "category": "%s", "sound": { "name": "default", "volume": 1.0 } } } | format(channel_name, clickAction, group_name, snapshot_access_file_path, group_name) %}
            {% else %}
              {% set platform_data = { "channel": "%s", "url": "%s", "attachment": {"url": "%s", "content_type": "JPEG"},  "push": { "category": "%s", "sound": { "name": "default", "volume": 1.0 } } } | format(channel_name, clickAction, snapshot_access_file_path, group_name) %}
            {% endif %}
          {% endif %}
        {% else %}
          {% if is_critical %}
            {% if overwrite_similar %}
              {% set platform_data = { "tag": "%s", "channel": "%s", "group": "%s", "ttl": 0, "priority": "high", "clickAction": "%s", "image": "%s"} | format(group_name, channel_name, group_name, clickAction, snapshot_access_file_path) %}
            {% else %}
              {% set platform_data = { "channel": "%s", "ttl": 0, "priority": "high", "clickAction": "%s", "image": "%s"} | format(channel_name, clickAction, snapshot_access_file_path) %}
            {% endif %}
          {% else %}
            {% if overwrite_similar %}
              {% set platform_data = { "tag": "%s", "channel": "%s", "group": "%s", "clickAction": "%s", "image": "%s"} | format(group_name, channel_name, group_name, clickAction, snapshot_access_file_path) %}
            {% else %}
              {% set platform_data = { "channel": "%s", "clickAction": "%s", "image": "%s"} | format(channel_name, clickAction, snapshot_access_file_path) %}
            {% endif %}
          {% endif %}
        {% endif %}
        {{ platform_data }}

Maybe I could just make a version of the blueprint with 2 mobile devices or another version with 3?
Would that be a solution?

Everything works as long as I put at least a 1 second delay-- but the image comes up like this in the notification.
I can find the actual JPG file inside /config/www/tmp but it doesnā€™t show in the notification.
Any ideas?

(Running from a Raspberry Pi, not a Docker or anything like that.)

Make sure you have your External URI configured correctly.

You should try to load the image using a browser to see if that works.
The URL is made out of the External URI you have in your configuration.
Something like: https://my.dyndns.org:8123/tmp/filename.jpg

Hi,

Itā€™s possible to ad an action on mobile for silence notification? similar on this blueprint :

I test but, Iā€™m new on yaml/automation/blueprint and nothing work for meā€¦ :frowning:

thankā€™s for your help

Hi @StanG
Thanks for the blueprint iā€™m wanting to use the trigger as a contact sensor instead of motion so i copied your yaml and editied the top part to this

  domain: automation
  input:
    motion_sensor:
      name: Door sensor
      description: The sensor wich triggers the snapshot creation (domain binary_sensor,
        class motion).
      selector:
        entity:
          domain: binary_sensor
          device_class: door

and also changed the trigger state

trigger:
  platform: state
  entity_id: !input 'motion_sensor'
  from: 'closed'
  to: 'open'

and i can select the contact sensor i want but it doesnā€™t seem to work though as no notifications are sent.
Can you confirm what else i would need to change as i notice i still had ā€œmotion_sensor:ā€ at the top but didnā€™t know what t change that to
Cheers

Hi StanG,

Iā€™m interested in this (send message to multiple devices) as well, did you find any solution for it?

If anyone is using Unifi Protect and are on iOS,if you want to open the Protect app instead of HA then use this URL: ā€œunifi-protect://ā€
Found that the default motion notifications that Protect makes are way to frequent. Using this blueprint with a simple node red debounce timer to prevent duplicate notifications for the same motion.

Just open the protect app on iphone. do you have a full query to open directly camera on IOS ?

I havenā€™t been able to find any combination to open a specific camera or event. But hereā€™s is where I found the URL though, if that helps. I havenā€™t been able to find any more resources on the topic.

Hi!
I just wanted to create a blueprint to send snapshots for alarms, but I am lazy AF and did a fast search and found your blueprint.
It is almost perfect for me, and maybe I can suggest you some modification to help others using this blueprint.
Do not restrict the activation only for motion, some people have sensors on doors/gates
Allow to add more then one activation entity (this way we donā€™t need more automations if we have different sensors for the same camera).
For blocking entity allow to set up itā€™s blocking state. This way you can use alarm panels state or alarm integrations states.
I am now on to do these changes, just wanted to mention them for you.

1 Like