Last active
November 17, 2022 20:26
-
-
Save mmackowiak/eda7e5974183d80623c73378247471e3 to your computer and use it in GitHub Desktop.
notify_until_off
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Notify Until Off | |
domain: automation | |
input: | |
trigger_sensor: | |
name: Sensor | |
description: Binary sensor that will trigger the automation. | |
selector: | |
entity: | |
domain: binary_sensor | |
multiple: false | |
delay: | |
name: Time before alert | |
description: Amount of time before an alert is triggered. | |
default: 0 | |
selector: | |
duration: | |
title: | |
name: Notification title | |
description: Title of the notification. | |
selector: | |
text: | |
message: | |
name: Notification message | |
description: Message of the notification. | |
selector: | |
text: | |
repeat_delay: | |
name: Time before repeat | |
description: Amount of time before a notification is sent again. | |
default: 0 | |
selector: | |
duration: | |
is_critical: | |
name: Ciritical? | |
description: Should send critical notification? | |
selector: | |
boolean: | |
variables: | |
is_critical: !input is_critical | |
trigger: | |
- platform: state | |
entity_id: | |
- !input trigger_sensor | |
to: "on" | |
for: !input delay | |
action: | |
- repeat: | |
until: | |
- condition: state | |
entity_id: !input trigger_sensor | |
state: "off" | |
sequence: | |
- service: notify.notify | |
data: | |
message: !input message | |
title: !input title | |
data: > | |
{% if is_critical %} | |
{ | |
"push": { | |
"sound": { | |
"name": "default", | |
"critical": 1, | |
"volume": 1 | |
} | |
} | |
} | |
{% else %} | |
{ } | |
{% endif %} | |
- delay: !input repeat_delay |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment