Last active
October 23, 2023 00:48
-
-
Save DarkCoder28/a040770e9184c1c660daa27ae2424099 to your computer and use it in GitHub Desktop.
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: Door Sensor Notify | |
description: | |
"Send notifications to your phone when the door sensor sees that it is open\n\n Blueprint\n Version: 3" | |
domain: automation | |
input: | |
sensor: | |
name: Open Sensor | |
selector: | |
entity: | |
domain: binary_sensor | |
counter: | |
name: Counter Helper | |
description: Used to double delay each call | |
selector: | |
entity: | |
domain: counter | |
notify: | |
name: Notify Service | |
description: "Ex: 'notify.admins' or 'notify.notify'" | |
selector: | |
text: | |
notify_title: | |
name: Notify Opened Title | |
selector: | |
text: | |
notify_message: | |
name: Notify Opened Message | |
selector: | |
text: | |
notify_close: | |
name: Should Notify on Close | |
selector: | |
boolean: | |
notify_close_title: | |
name: Notify Closed Title | |
selector: | |
text: | |
notify_close_message: | |
name: Notify Closed Message | |
selector: | |
text: | |
source_url: https://gist.github.com/DarkCoder28/a040770e9184c1c660daa27ae2424099 | |
mode: parallel | |
max_exceeded: silent | |
variables: | |
sensor: !input "sensor" | |
counter: !input "counter" | |
notify: !input "notify" | |
notify_title: !input "notify_title" | |
notify_message: !input "notify_message" | |
notify_close: !input "notify_close" | |
notify_close_title: !input "notify_close_title" | |
notify_close_message: !input "notify_close_message" | |
trigger: | |
- platform: state | |
entity_id: !input "sensor" | |
from: "off" | |
to: "on" | |
- platform: state | |
entity_id: !input "sensor" | |
from: "on" | |
to: "off" | |
action: | |
- if: | |
- condition: state | |
entity_id: !input "sensor" | |
state: "on" | |
then: | |
- service: counter.set_value | |
data: | |
value: 1 | |
target: | |
entity_id: !input "counter" | |
- repeat: | |
while: | |
- condition: state | |
entity_id: !input "sensor" | |
state: "on" | |
sequence: | |
- service: "{{notify}}" | |
data: | |
title: "{{notify_title}}" | |
message: "{{notify_message}}" | |
- variables: | |
timeout: "{{((2|float)**((states(counter)|float)-1))*5|float}}" | |
- delay: | |
minutes: "{{timeout | float}}" | |
- service: counter.increment | |
data: {} | |
target: | |
entity_id: !input "counter" | |
else: | |
- if: | |
- condition: template | |
value_template: "{{ notify_close == true }}" | |
then: | |
- service: "{{notify}}" | |
data: | |
title: "{{notify_close_title}}" | |
message: "{{notify_close_message}}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment