-
Notifications
You must be signed in to change notification settings - Fork 58
/
leak_notify.yaml
59 lines (54 loc) 路 1.55 KB
/
leak_notify.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#
# Check if a water leak is detected somewhere
#
# @subscribe group.leak_sensors
#
# @link https://domeha.com/z-wave-leak-sensor
#
- id: leak_notify
alias: "Leak NOTIFY"
trigger:
# When a leak is detected somewhere.
- platform: state
entity_id: group.leak_sensors
to: 'on'
action:
# Delay the notifications, to allow the location to be determined. Hack-ish.
- delay:
seconds: 2
# Pin a warning message in the frontend.
- service: persistent_notification.create
data:
notification_id: water
title: "Water leak"
message: |
{% if states('sensor.leak_location') != '' %}
A leak has been detected at location:
<strong>{{ states('sensor.leak_location') }}</strong>.
{% else %}
A leak has been detected.
{% endif %}
# Warn someone to take action.
- service: notify.text
data:
title: "Water leak"
message: |
A leak has been detected.
{% if states('sensor.leak_location') != '' -%}
Location: {{ states('sensor.leak_location') }}.
{% endif %}
# Play a warning sound and message.
- service: notify.sound
data:
message: 'alarm'
data:
method: 'alarm'
- delay:
seconds: 2
- service: notify.speech
data_template:
message: >-
A water leak has been detected.
{% if states('sensor.leak_location') != '' -%}
Check the {{ states('sensor.leak_location') }}!
{% endif %}