hello,
i have some automations, where notifications and persistant notifications where dismissed instantly, when a specific state of an sensor is happening.
But how could i delay the dismiss of an notification?
i would like to dismiss a notification, after a period of time (10 minutes), so notification message will be shown for at least 10 minutes, after the dismiss trigger event was fired?
i had tried by myself, but im fully overstrained. either i´m prevented by saving an automation due to errors, or trying by DeveloperTools/Template i got only errors.
here my automation, without any dismiss delay…
alias: Notify_Floodwarning_V01
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.aqara_ws_95_water_leak
from: "off"
to: "on"
for:
hours: 0
minutes: 0
seconds: 1
- platform: state
entity_id:
- binary_sensor.aqara_ws_95_water_leak
from: "off"
to: "on"
for:
hours: 0
minutes: 15
seconds: 0
- platform: state
entity_id:
- binary_sensor.aqara_ws_95_water_leak
from: "off"
to: "on"
for:
hours: 0
minutes: 30
seconds: 0
- platform: state
entity_id:
- binary_sensor.aqara_ws_95_water_leak
from: "on"
to: "off"
for:
hours: 0
minutes: 0
seconds: 1
condition: []
action:
- service: notify.notify
data:
title: |
{% if trigger.entity_id == "binary_sensor.aqara_ws_95_water_leak" %}
FLOOD WARNING!! since {{ ((now() -
timedelta(minutes=(trigger.for.seconds // 60))).strftime('%H:%M')) }}h
{% else %}
no flood!
{% endif %}
message: |
{% if trigger.entity_id == "binary_sensor.aqara_ws_95_water_leak" %}
{% if is_state("binary_sensor.aqara_ws_95_water_leak", "on") %}
FLOOD WARNING!! since {{ ((now() -
timedelta(minutes=(trigger.for.seconds // 60))).strftime('%H:%M')) }}h
{% else %}
clear_notification
{% endif %}
{% else %}
clear_notification
{% endif %}
data:
ttl: 0
priority: high
tag: |
{% if trigger.entity_id == "binary_sensor.aqara_ws_95_water_leak" %}
flood_warning
{% else %}
flood_entwarnung
{% endif %}
color: pink
- service: persistent_notification.create
data:
title: |-
{% if trigger.entity_id == "binary_sensor.aqara_ws_95_water_leak" %}
FLOOD WARNING!! since {{ ((now() -
timedelta(minutes=(trigger.for.seconds // 60))).strftime('%H:%M')) }}h
{% else %}
no flood!
{% endif %}
message: |-
{% if trigger.entity_id == "binary_sensor.aqara_ws_95_water_leak" %}
{% if is_state("binary_sensor.aqara_ws_95_water_leak", "on") %}
FLOOD WARNING!! since {{ ((now() -
timedelta(minutes=(trigger.for.seconds // 60))).strftime('%H:%M')) }}h
{% else %}
{% endif %}
{% else %}
not found
{% endif %}
notification_id: |-
{% if trigger.entity_id == "binary_sensor.aqara_ws_95_water_leak" %}
"pnotify_floodwarning"
{% endif %}
- service: persistent_notification.dismiss
data:
notification_id: |-
{% if trigger.entity_id == "binary_sensor.aqara_ws_95_water_leak" %}
{% if is_state("binary_sensor.aqara_ws_95_water_leak", "off") %}
"pnotify_floodwarning"
{% endif %}
{% else %}
not found
{% endif %}
mode: parallel
max: 10
Can someone please help me?
thank you in advance
br
Frank