Please share your revised blueprint with the community, so all can benefit.
Thanks
Hi,
I would like to have this blueprint to activate by a contact sensor, instead of a motion sensor.
Is there an easy way to do so?
Is there a blueprint with this modification?
Thanks.
I think itās as easy as removing the domain class.
Try with the modified blueprint at the URL below.
Thank you very much.
Hello
Finally I found this
I have 3 places geocoded in HA. I dont want to receive notification if I am home but I do want to receive notification if I am at the other locations. What should I do? Do I need to remove those? Not really need themā¦
The standard blueprint does just that.
You use the blocking entity to stop the notifications when you are home.
Blocking entity
As blocking entity you just create a helper template entity (binary template sensor) that has the status ON when you are home and the status OFF when youāre not. In the below template example I optionally change the icon as well to graphically show when people are home or not, because I also use this sensor in my dashboards.
With 1 person:
- platform: template
sensors:
stang_home:
value_template: >-
{{ is_state('person.stan_g', 'home') }}
icon_template: >-
{% if is_state("binary_sensor.stang_home", "on") %}
mdi:home-account
{% else %}
mdi:home
{% endif %}
With 2 persons, with the OR operator:
- platform: template
sensors:
people_home:
value_template: >-
{{ is_state('person.stan_g', 'home')
or is_state('person.xxyyy', 'home') }}
icon_template: >-
{% if is_state("binary_sensor.people_home", "on") %}
mdi:home-account
{% else %}
mdi:home
{% endif %}
In my example I have a geocoded location named āHomeā and the template sensor looks for this location in the attributes of the person. If you home location is called differently i.e. thuis, house, etc ā¦ just replace the āhomeā in the above template sensor with your named location. Go to settings - ares & zones to look at your configured zones and the name.
The other geocoded locations donāt have any impact. You donāt need to do anything with them.
I have this blueprint working now where it can send notifications to multiple devices (both Android and iOS)
Please note that I am what one would call an āidiotā, so I mightāve done something dumb here, but it does work.
Go to your file editor and open /blueprints/automation/Stan-Gobien/CriticalCollapseOptionNotHomeMotionCameraSnapshotWithClickAction.yaml
Note the section that says:
notify_device:
name: Device to notify
description: Device that runs the official Home Assistant app to receive notifications.
selector:
device:
integration: mobile_app
multiple: false
Duplicate this section and rename the ānotify_deviceā for each into something unique. I did ānotify_device1ā and ānotify_device2ā because I am a simple man. See below for what that looks like:
notify_device1:
name: Device to notify
description: Device that runs the official Home Assistant app to receive notifications.
selector:
device:
integration: mobile_app
multiple: false
notify_device2:
name: Device to notify
description: Device that runs the official Home Assistant app to receive notifications.
selector:
device:
integration: mobile_app
multiple: false
Now scroll down to the āvariablesā section and find:
notify_device1: !input notify_device
Duplicate this line and rename it to what you renamed the devices earlier. In my case:
notify_device1: !input notify_device1
notify_device1: !input notify_device2
Now scroll down to the āactionsā section and find:
- 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: "{% if is_ios %}\n {% if is_critical %}\n {% 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) %}\n {% else %}\n {% if overwrite_similar %}\n {% 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) %}\n {% else %}\n {% 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)
%}\n {% endif %}\n {% endif %}\n{% else %}\n {% if is_critical %}\n {%
if overwrite_similar %}\n {% 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) %}\n {% else %}\n {% set platform_data = {
\"channel\": \"%s\", \"ttl\": 0, \"priority\": \"high\", \"clickAction\": \"%s\",
\"image\": \"%s\"} | format(channel_name, clickAction, snapshot_access_file_path)
%}\n {% endif %}\n {% else %}\n {% if overwrite_similar %}\n {% 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) %}\n {% else %}\n {% set platform_data = {
\"channel\": \"%s\", \"clickAction\": \"%s\", \"image\": \"%s\"} | format(channel_name,
clickAction, snapshot_access_file_path) %}\n {% endif %}\n {% endif %}\n{%
endif %} {{ platform_data }}\n"
Duplicate this section entirely and rename !input notify_device to what you called your devices earlier.
In my case this section now looks like this:
action:
- delay: '{{ delay }}'
- service: camera.snapshot
entity_id: !input camera
data:
filename: '{{ snapshot_create_file_path }}'
- device_id: !input notify_device1
domain: mobile_app
type: notify
title: '{{ notification_title }}'
message: '{{ notification_message }}'
data: "{% if is_ios %}\n {% if is_critical %}\n {% 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) %}\n {% else %}\n {% if overwrite_similar %}\n {% 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) %}\n {% else %}\n {% 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)
%}\n {% endif %}\n {% endif %}\n{% else %}\n {% if is_critical %}\n {%
if overwrite_similar %}\n {% 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) %}\n {% else %}\n {% set platform_data = {
\"channel\": \"%s\", \"ttl\": 0, \"priority\": \"high\", \"clickAction\": \"%s\",
\"image\": \"%s\"} | format(channel_name, clickAction, snapshot_access_file_path)
%}\n {% endif %}\n {% else %}\n {% if overwrite_similar %}\n {% 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) %}\n {% else %}\n {% set platform_data = {
\"channel\": \"%s\", \"clickAction\": \"%s\", \"image\": \"%s\"} | format(channel_name,
clickAction, snapshot_access_file_path) %}\n {% endif %}\n {% endif %}\n{%
endif %} {{ platform_data }}\n"
- delay: '{{ delay }}'
- service: camera.snapshot
entity_id: !input camera
data:
filename: '{{ snapshot_create_file_path }}'
- device_id: !input notify_device2
domain: mobile_app
type: notify
title: '{{ notification_title }}'
message: '{{ notification_message }}'
data: "{% if is_ios %}\n {% if is_critical %}\n {% 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) %}\n {% else %}\n {% if overwrite_similar %}\n {% 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) %}\n {% else %}\n {% 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)
%}\n {% endif %}\n {% endif %}\n{% else %}\n {% if is_critical %}\n {%
if overwrite_similar %}\n {% 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) %}\n {% else %}\n {% set platform_data = {
\"channel\": \"%s\", \"ttl\": 0, \"priority\": \"high\", \"clickAction\": \"%s\",
\"image\": \"%s\"} | format(channel_name, clickAction, snapshot_access_file_path)
%}\n {% endif %}\n {% else %}\n {% if overwrite_similar %}\n {% 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) %}\n {% else %}\n {% set platform_data = {
\"channel\": \"%s\", \"clickAction\": \"%s\", \"image\": \"%s\"} | format(channel_name,
clickAction, snapshot_access_file_path) %}\n {% endif %}\n {% endif %}\n{%
endif %} {{ platform_data }}\n"
Restart Home Assistant and now when you use the blueprint, itāll give you two notification devices to select.
Please note
- You could probably duplicate the line again if you wanted to add another device to notify, but I have not tested that
- Your existing automations that use the old version of the blueprint will not show up anymore if you make changes to the original blueprint. To update those, go to your automations.yaml file and duplicate and update your ānotify_deviceā names to those used in your blueprint.
- Iām not sure if this causes any issues with the iOS specific toggle under āoverwrite similarā in the blueprint. I would imagine it does.
- Iām not adding the file as itās pretty simple stuff and as mentioned before, Iām an idiot. So please try this at your own risk.
- I found that you can duplicate the blueprint and rename it for example to ācameranotifies1ā and ācameranotifies2ā you can keep both.
Hope this helps at all!
I cannot get it to workā¦
The sensor gives me the answer āTrueā not āonā is it a problem?
-
platform: template
sensors:
gabor_otthon:
value_template: >-
True
icon_template: >-mdi:home
and this is in the config:
- platform: template
sensors:
gabor_otthon:
value_template: >-
{{ is_state(āperson.adminā, āhomeā) }}
icon_template: >-
{% if is_state(ābinary_sensor.gabor_otthonā, āTrueā) %}
mdi:otthon-account
{% else %}
mdi:home
{% endif %}
when I put sensor.gabor_otthon as blocking, I dont get any notificationā¦
See above for the correct spacing.
Check the status of the person.stan_g and sensor.stang_home in the developer tools both when home and away to troubleshoot.
I think my problem is that I dont have the
binary_sensor.gabor_otthon
The little piece of code 2 posts above is for creating the binary_sensor
hi @StanG and thanks for the blueprint, itās one of the best. Iāve been thinking that i need to have a storage of those snapshots. anyway we can keep them stored in a specific folder on ha?
snapshot_create_file_path: "/config/www/tmp/snapshot_{{ states[camera].object_id }}.jpg"
Above is where the path is set for saving the snapshot photo file.
You can change the sub-directory to one your create yourself.
If you want to keep every file youāll have to add a date-time-stamp in the name of the file so the next one doesnāt overwrite the previous one.
The notification is working fine but it is not sending the snapshot. I went into my www/tmp directory and I see the snapshot image there. and every time I run a test it create the image but on my phone instead of the snapshot I get this: Failed to Load attachment Response status code was unacceptable:404
how you got this? without blueprint
If you go in to trace mode you can see the full code the blueprint produces.
You can use that full code to make your own manual automation.
About your problem.
I guess maybe you a configuration error with your external and/or internal link setting.
Sorry, not easy to change picture to video.
Did anyone find a solution with this blueprint sending old images in the notification (on android)? I donāt see any explicit solutions posted above, just folks that created their own automations instead (which is my next step).
I saw this post above about the different directories, but making them the same has no impact. I donāt even understand where the cached images are coming from as the snapshot on the server appears overwritten every time.
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