/
notification_fuites.yaml
91 lines (88 loc) · 4.34 KB
/
notification_fuites.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
##################################################################################
##################################################################################
##################################################################################
# _____ _ _ _____ _ _ _______ _ _ _ _ __ __ ____ ______ _____
# |_ _| \ | | __ \| | | |__ __| | \ | | | | | \/ | _ \| ____| __ \
# | | | \| | |__) | | | | | | | \| | | | | \ / | |_) | |__ | |__) |
# | | | . ` | ___/| | | | | | | . ` | | | | |\/| | _ <| __| | _ /
# _| |_| |\ | | | |__| | | | | |\ | |__| | | | | |_) | |____| | \ \
# |_____|_| \_|_| \____/ |_| |_| \_|\____/|_| |_|____/|______|_| \_\
input_number:
# https://www.home-assistant.io/integrations/input_number/
##################################################################################
eau_froide_1h:
name: eau froide 1h
initial: 0
min: 0
max: 9999999999
mode: box
eau_chaude_1h:
name: eau chaude 1h
initial: 0
min: 0
max: 9999999999
mode: box
##################################################################################
##################################################################################
##################################################################################
# _ _ _______ ____ __ __ _______ _____ ____ _ _ _____
# /\ | | | |__ __/ __ \| \/ | /\|__ __|_ _/ __ \| \ | |/ ____|
# / \ | | | | | | | | | | \ / | / \ | | | || | | | \| | (___
# / /\ \| | | | | | | | | | |\/| | / /\ \ | | | || | | | . ` |\___ \
# / ____ \ |__| | | | | |__| | | | |/ ____ \| | _| || |__| | |\ |____) |
# /_/ \_\____/ |_| \____/|_| |_/_/ \_\_| |_____\____/|_| \_|_____/
automation:
# https://www.home-assistant.io/integrations/automation/
##################################################################################
- id: "index eau 1h00"
alias: index eau 1h00
trigger:
platform: time
at: '00:15:00'
action:
- service: input_number.set_value
data_template:
entity_id: input_number.eau_froide_1h
value: "{{ states.sensor.compteur_eau_froide.state | float }}"
- service: input_number.set_value
data_template:
entity_id: input_number.eau_chaude_1h
value: "{{ states.sensor.compteur_eau_chaude.state | float }}"
- id: "notification fuite eau froide"
alias: "notification fuite eau froide"
trigger:
platform: time # https://www.home-assistant.io/docs/automation/trigger/#time-pattern-trigger
at:
- "05:40:00"
condition:
- condition: template
value_template: >
{{states.sensor.compteur_eau_froide.state | float > states.input_number.eau_froide_1h.state | float }}
action:
- service: notify.telegram
data_template:
message: "fuite d'eau froide détectée de {{1000*(states.sensor.compteur_eau_froide.state | float - states.input_number.eau_froide_1h.state | float) | round(2)}} litre(s)"
- service: persistent_notification.create
data_template:
title: "fuite d'eau froide"
message: "fuite d'eau froide détectée de {{1000*(states.sensor.compteur_eau_froide.state | float - states.input_number.eau_froide_1h.state | float)*1000 | round(2)}} litre(s)"
notification_id: "fuite d'eau froide"
- id: "notification fuite eau chaude"
alias: "notification fuite eau chaude"
trigger:
platform: time # https://www.home-assistant.io/docs/automation/trigger/#time-pattern-trigger
at:
- "05:40:00"
condition:
- condition: template
value_template: >
{{states.sensor.compteur_eau_chaude.state | float > states.input_number.eau_chaude_1h.state | float }}
action:
- service: notify.telegram
data_template:
message: "fuite d'eau chaude détectée de {{1000*(states.sensor.compteur_eau_chaude.state | float - states.input_number.eau_chaude_1h.state | float) | round(2)}} litre(s)"
- service: persistent_notification.create
data_template:
title: "fuite d'eau chaude"
message: "fuite d'eau chaude détectée de {{1000*(states.sensor.compteur_eau_chaude.state | float - states.input_number.eau_chaude_1h.state | float) | round(2)}} litre(s)"
notification_id: "fuite d'eau chaude"