Forked from bskjon/homeassistant-blueprint-water-leak-alert.yaml
Last active
July 3, 2024 03:27
-
-
Save HDJedi/ca6c46cac25b5ea019d97431886b6126 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: HDJedi - Water Leakage Notifier | |
description: Warning for water leakage | |
domain: automation | |
input: | |
water_sensor: | |
name: Leakage sensor | |
description: Water leakage sensor | |
selector: | |
entity: | |
filter: | |
- device_class: moisture | |
multiple: true | |
devices: | |
name: Devices | |
description: Devices where notification should be sent | |
selector: | |
device: | |
integration: mobile_app | |
multiple: true | |
trigger: | |
- platform: state | |
entity_id: !input water_sensor | |
mode: single | |
action: | |
# Debug | |
# - service: input_text.set_value | |
# data_template: | |
# entity_id: input_text.debug | |
# value: "{{ trigger }}" | |
# - service: input_text.set_value | |
# data_template: | |
# entity_id: input_text.debug | |
# value: "{{ trigger.entity_id }}" | |
# - service: input_text.set_value | |
# data_template: | |
# entity_id: input_text.debug | |
# value: "{{ trigger.to_state }}" | |
# - service: input_text.set_value | |
# data_template: | |
# entity_id: input_text.debug | |
# value: "{{ trigger.to_state.state }}" | |
# - service: input_text.set_value | |
# data_template: | |
# entity_id: input_text.debug | |
# value: "{{ is_state(trigger.to_state.state, 'on') }}" | |
# - service: input_text.set_value | |
# data_template: | |
# entity_id: input_text.debug | |
# value: "{{ trigger.to_state.state == 'on' }}" | |
- choose: | |
- conditions: | |
- condition: template | |
value_template: "{{ trigger.to_state.state == 'on' }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input devices | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: "Water leakage!" | |
message: "Water leak discovered! Check sensor areas." | |
data: | |
tag: "water-leak-alert" | |
visibility: public | |
notification_icon: "mdi:home-flood" | |
color: "red" | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
message: "TTS" | |
data: | |
tag: "water-leak-alert-tts" | |
ttl: 0 | |
priority: high | |
media_stream: alarm_stream_max | |
language: "no-NB" | |
tts_text: "Water leak detected. Check sensor areas." | |
- conditions: | |
- condition: template | |
value_template: "{{ trigger.to_state.state == 'off' }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input devices | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: "Water leakage ended" | |
message: "The water leak has ended, and the sensors are dry." | |
data: | |
tag: "water-leak-alert" | |
visibility: public | |
notification_icon: "mdi:water-check" | |
color: "green" | |
- conditions: | |
- condition: template | |
value_template: "{{ trigger.to_state.state == 'unavailable' }}" | |
- condition: template | |
value_template: "{{ trigger.to_state.state == 'unknown' }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input devices | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: "Disconnected leakage sensor" | |
message: "One or more leakage sensors became unavailable. Please check that the battery has not run out, that the coordinator is not disconnected and that the device is turned on and a member of the network!" | |
data: | |
tag: "device-water-leak-detector-unavailable" | |
visibility: public | |
notification_icon: "mdi:water-off" | |
color: "gray" | |
default: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input devices | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: "TEST - Water leakage" | |
message: "Test notification for water leakage" | |
data: | |
tag: "water-leak-alert-test" | |
visibility: public | |
notification_icon: "mdi:home-flood" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment