Thatās an option but with this blueprint I did intend to not have any helpers that need to be configured. I think for beginners these kinds of options are just a little confusing. Hopefully automations in HA get changed in a way that allows for definition of helper variables in the automation itself without the need to manually define a helper.
Would it be possible to trigger the automaton with an NFC tag scan instead of a timer? We often leave windows open throughout the house most of the day, so the timer wouldnāt help me much, but I would like to integrate open window warnings into a bedtime routine triggered by an NFC tag.
I still do not get the point to not have a Ā« end of alert Ā» event. I mean, there is a Ā« alert removal delay Ā», so at least you can user implement their own logic.
At the very least would it be possible to have a custom action Ā« alert trigger Ā», for the moment we can only send a notification, but for instance I would like tower my own actions.
Hi @Malte
thx for this great blueprint. I tested it and basically it works fine and I get some notifications.for my 3 doors (2 Sonoff sensors, 1 aqara sensor)
However sometimes (not every time) when looking at the traces I see there is an error and it is stopped
Template rendered invalid service: ā see also screenshot (sorry it is in german)
Did I something wrong or do I have to change something?
thx for your work
Would you mind adding a version number to the BP itself? This would help to determine if you are running the latest version, what his changed from the currently used version to latest.
Thanks for the report. German is perfectly fine for me
Can you go through the different tabs and does it say somewhere which service it is trying to run? Or is it just empty. Can you also try to reproduce it and describe when exactly this happens. Thanks in advance!
Iāll add it to my to do list!
Hard to say what triggers the error. For me it seems the error happens when the script tries to make a second Iteration ā see screenshot below
Today HaustĆ¼re worked perfetct with no error while GartentĆ¼re has shown the same error again todayā¦
HaustĆ¼re
vs GartentĆ¼re
In the different tabs I could not find any more information about the service it trys to runā¦ is there any special tab to look into?
Good blueprint, but i am also one of those that needs multiple entity support. Doing that single entity over and over wont work for me either. I pretty much have this running now with actionable notifications and clickAction as well so it would be more of the same single use work that I already have in place
Great job though and it looks well put together!
The only difference I spot is that the tag in the failing iteration ends with ā,
ā which the first one does not. Can you send the YAML config of your blueprint you get to via editing the blueprint and then clicking the three dot menu and in German it says āAls YAML bearbeitenā. This could probably help best at investigating the problem further.
Update 2024.04.23 has been released
See the changelog in the initial post for details.
@schlomm, @gyle, @chris400, @hazio, @aelsharawi, @mefistofelis and @danktankk: Your request about supporting binary_sensor
group has been implemented. As of now input_boolean
that are grouped like described here are not supported.
@chris400 Version number has been added. Thanks for the idea!
If you notice something not working as expected please let me know!
here is my YAML config
Blueprint config
alias: NOTIFICATION GartentĆ¼re offen
description: Nach 10 Minuten erfolgt eine Notification, dass die GartentĆ¼re offen ist
use_blueprint:
path: Raukze/contact-sensor-left-open-notification.yaml
input:
trigger_entity: binary_sensor.tursensor_werkstatt_contact
friendly_name: GartentĆ¼re
notify_services_string: "notify.telegram_roland, "
notification_title: NOTIFICATION {{ friendly_name }}
notification_message: >-
{{ friendly_name }} steht offen {{ as_timestamp(now()) |
timestamp_custom('%T', True) }}.
and
automation config
mode: restart
max_exceeded: silent
variables:
friendly_name: GartentĆ¼re
trigger_entity: binary_sensor.tursensor_werkstatt_contact
issue_state: 'on'
duration_issue_state:
minutes: 10
condition_send_notification: []
delete_notification: true
duration_from_issue_state:
seconds: 5
notify_services_string: 'notify.telegram_roland, '
notification_click_url: /lovelace/ROOM
notification_title: NOTIFICATION {{ friendly_name }}
notification_message: >-
{{ friendly_name }} steht offen {{ as_timestamp(now()) |
timestamp_custom('%T', True) }}.
repeat_notification: false
time_between_repeat_notification:
minutes: 10
notification_icon_warning: alert
notification_color: red
notification_interruption_level: active
custom_action_issue_state: []
custom_action_from_issue_state: []
trigger:
- platform: state
entity_id: binary_sensor.tursensor_werkstatt_contact
to: 'on'
for:
minutes: 10
id: send_notification
- platform: state
entity_id: binary_sensor.tursensor_werkstatt_contact
from: 'on'
for:
seconds: 5
id: delete_notification
action:
- variables:
notify_services_list: '{{ notify_services_string.split('','') }}'
number_of_notify_services: '{{ notify_services_list | count }}'
notification_tag: >-
{{ trigger_entity[-20:] }}-{{ friendly_name[-20:] }}-{{
notify_services_string[-20:] }}
- choose:
- conditions:
- condition: trigger
id: send_notification
- condition: []
sequence:
- repeat:
sequence:
- parallel:
- repeat:
count: '{{ number_of_notify_services }}'
sequence:
- service: '{{ notify_services_list[repeat.index-1] }}'
data:
message: >-
{{ friendly_name }} steht offen {{
as_timestamp(now()) | timestamp_custom('%T',
True) }}.
title: NOTIFICATION {{ friendly_name }}
data:
clickAction: /lovelace/ROOM
url: /lovelace/ROOM
tag: '{{ notification_tag }}'
color: red
notification_icon: mdi:{{ notification_icon_warning }}
push:
interruption-level: active
persistent: false
sticky: false
- choose: []
default: []
- if:
- '{{ repeat_notification }}'
then:
- delay: '{{ time_between_repeat_notification }}'
until:
- '{{ not repeat_notification }}'
- conditions:
- condition: trigger
id: delete_notification
- '{{ delete_notification }}'
sequence:
- parallel:
- repeat:
count: '{{ number_of_notify_services }}'
sequence:
- service: '{{ notify_services_list[repeat.index-1] }}'
data:
message: clear_notification
data:
tag: '{{ notification_tag }}'
- choose: []
default: []
id: '1713561691878'
alias: NOTIFICATION GartentĆ¼re offen
description: Nach 10 Minuten erfolgt eine Notification, dass die GartentĆ¼re offen ist
The value should just be notify.telegram_roland
without the comma and space characters. This might be the issue.
Thx for your help , I just changed it. Hope this fixed it
Hello Malte
Sorry but I canāt make it works.
And I donāt see why:
My yaml
mode: single
max_exceeded: silent
variables:
custom_friendly_name: ''
trigger_entity: binary_sensor.porte_et_fenetres
issue_state: 'on'
duration_issue_state:
hours: 0
minutes: 0
seconds: 10
days: 0
condition_send_notification:
- condition: state
entity_id: person.corinne
state: not_home
- condition: state
entity_id: person.philippe
state: not_home
delete_notification: false
duration_from_issue_state:
seconds: 5
notify_services_string: notify.notify
notification_click_url: /lovelace/ROOM
notification_title: The {{ friendly_name }} was left open
repeat_notification: true
time_between_repeat_notification:
hours: 0
minutes: 1
seconds: 0
days: 0
notification_icon_warning: alert
notification_color: red
notification_interruption_level: active
custom_action_issue_state: []
custom_action_from_issue_state: []
trigger:
- platform: state
entity_id: binary_sensor.porte_et_fenetres
to: 'on'
for:
hours: 0
minutes: 0
seconds: 10
days: 0
id: send_notification
- platform: state
entity_id: binary_sensor.porte_et_fenetres
from: 'on'
for:
seconds: 5
id: delete_notification
action:
- variables:
notify_services_list: '{{ notify_services_string.split('','') }}'
number_of_notify_services: '{{ notify_services_list | count }}'
notification_tag: >-
{{ trigger_entity[-20:] }}-{{ custom_friendly_name[-20:] }}-{{
notify_services_string[-20:] }}
initially_triggered_at: '{{ now() }}'
- choose:
- conditions:
- condition: trigger
id: send_notification
- condition:
- condition: state
entity_id: person.corinne
state: not_home
- condition: state
entity_id: person.philippe
state: not_home
sequence:
- repeat:
sequence:
- variables:
friendly_name: |
{% if custom_friendly_name != '' %}
{{ custom_friendly_name }}
{% else %}
{% set expanded_trigger_entity_list = expand(trigger_entity) | selectattr('state', 'eq', issue_state) | map(attribute='name') | join(', ') %}
{{ ' & '.join(expanded_trigger_entity_list.rsplit(', ', 1)) }}
{% endif %}
- parallel:
- repeat:
count: '{{ number_of_notify_services }}'
sequence:
- service: '{{ notify_services_list[repeat.index-1] }}'
data:
message: >-
The {{ friendly_name }} was left open at {{
as_timestamp(initially_triggered_at) |
timestamp_custom('%T', True) }}.
title: The {{ friendly_name }} was left open
data:
clickAction: /lovelace/ROOM
url: /lovelace/ROOM
tag: '{{ notification_tag }}'
color: red
notification_icon: mdi:{{ notification_icon_warning }}
push:
interruption-level: active
persistent: true
sticky: true
- choose: []
default: []
- if:
- '{{ repeat_notification }}'
then:
- delay: '{{ time_between_repeat_notification }}'
until:
- '{{ not repeat_notification }}'
- conditions:
- condition: trigger
id: delete_notification
- '{{ delete_notification }}'
sequence:
- parallel:
- repeat:
count: '{{ number_of_notify_services }}'
sequence:
- service: '{{ notify_services_list[repeat.index-1] }}'
data:
message: clear_notification
data:
tag: '{{ notification_tag }}'
- choose: []
default: []
id: '1715173036123'
alias: šŖ Contact Sensor Left Open Notification by Malte
description: ''
trace:
stored_traces: 20
Every try leads to this issue.
An idea of what I am doin wrong?
Looking at the screenshot of the execution attempt, Iām wondering if you triggered the automation manually or if the sensor status change actually triggered the automation? To me it looks like a manual trigger, which definitely doesnāt work but is intentional.
Okey. Thanks for having replied. Iām going to test it IRL.
Iām pretty new to Home Assistant so forgive me if thereās an obvious answer to this, but Iāve configured an automation using the blueprint and when I manually run it Iām not getting a notification and am seeing the below error in my logs.
Template variable warning: āfriendly_nameā is undefined when rendering āThe {{ friendly_name }} was left openā
Iāve used the default settings in the blueprint and updated the Entity ID for my DW sensor group (Door & Window Sensors) and updated my device id for my phone (notify.mobile_app_pixel_7).
What am I missing?
Thanks for trying out my blueprint. Manual trigger does not work due to the implementation of the blueprint. Easiest way to try or debug is to just set the intervals to a couple of seconds or just 0 and the notification should arrive immediately when the state of the sensor changes. Hope that my answer is helpful!
This blueprint is great! Itās replacing a custom written AppDaemon app I had for this purpose. Thanks for sharing it.
Thereās one thing I donāt see how to set up. Triggering on contact sensors works fine. But, is there a way it can trigger when people become away, or a zone state changes? For example, letās say:
- I open a window before bed.
- I leave the next morning for work, and forget to close the window.
- ???
For my custom automations, I have a separate automation that triggers on a Person group becoming not_home
, and then checking the state of doors and windows. Iād love to be able to replace that with this blueprint!