-
Notifications
You must be signed in to change notification settings - Fork 1
/
test-pompe1.yaml
291 lines (248 loc) · 8.38 KB
/
test-pompe1.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
#------------------------------
#-- test-pompe1.yaml
#-- Petit code pour tester la régulation de la pompe pour chauffer la piscine d'Antoine
#-- si la T aller - T retour est > que T consigne, alors allume la bonne pompe
#-- tous les paramètres de configuration se trouvent en input number directement sur l'ESPhome !
#-- pour l'instant ce n'est qu'une maquette de démo !
#--
#-- pinout mini-d1: https://docs.google.com/document/d/1GOp2zN0aFk80cv2Hz6DmlEwY84OPwVK38da-KSO77zw/edit#heading=h.ohz2baooedzi
#-- zf220621.1614
#--
esphome:
name: test-pompe1
esp8266:
board: esp01_1m
restore_from_flash: false
preferences:
flash_write_interval: 10min
# Configuration WIFI
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# networks:
# - ssid: !secret wifi_ssid_apzuzu7
# - password: !secret wifi_pass_apzuzu7
# - ssid: !secret wifi_ssid_apzuzu6
# - password: !secret wifi_pass_apzuzu6
# - ssid: !secret wifi_ssid_3G_zf
# - password: !secret wifi_pass_3G_zf2
# - ssid: !secret wifi_ssid_3G_zf2
# - password: !secret wifi_pass_3G_zf2
# - ssid: !secret wifi_ssid_3g_s7
# - password: !secret wifi_pass_3g_s7
# - ssid: !secret wifi_ssid_apzuzu6_EXT
# - password: !secret wifi_pass_apzuzu6_EXT
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "test-pompe1 Fallback"
password: !secret ap_wifi_password
# Enable wifi configuration fallback
captive_portal:
# Enable logging
logger:
# level: VERBOSE
# Enable Home Assistant API
api:
password: !secret api_password
# Enable OTA updates
ota:
password: !secret ota_password
# Enable WEB Server
web_server:
port: 80
# Configuration 1-wire pour les capteurs de température DS18B20
dallas:
- pin: GPIO4
update_interval: 3s
# Définition des Switch's
switch:
- platform: gpio
name: "test-pompe1 LED"
inverted: True
id: led
pin: GPIO2
- platform: restart
name: "test-pompe1 Restart"
- platform: template
name: "test-pompe1 Priorite Jacuzzi"
restore_state: true
optimistic: true
id: test_pompe1_priorite_jacuzzi
on_turn_on:
- switch.turn_off: test_pompe1_pompe_state
on_turn_off:
- switch.turn_off: test_pompe1_pompe_state
- platform: template
name: "test-pompe1 Regulation manuel"
restore_state: true
optimistic: true
id: test_pompe1_regulation_manuel
- platform: template
name: "test-pompe1 Pompe State"
restore_state: true
optimistic: true
id: test_pompe1_pompe_state
- platform: gpio
name: "test-pompe1 pompe1"
inverted: True
id: test_pompe1_pompe1
pin: GPIO14
- platform: gpio
name: "test-pompe1 pompe2"
inverted: True
id: test_pompe1_pompe2
pin: GPIO12
# Définition des inputs numbers
number:
- platform: template
name: "test-pompe1 Température Delta"
restore_value: true
optimistic: true
min_value: -10
max_value: +10
step: 0.5
initial_value: 4
unit_of_measurement: "°K"
id: test_pompe1_temperature_delta
- platform: template
name: "test-pompe1 Température Hysterese"
restore_value: true
optimistic: true
min_value: 0
max_value: +10
step: 0.5
initial_value: 2
unit_of_measurement: "°K"
id: test_pompe1_temperature_hysterese
- platform: template
name: "test-pompe1 Température Calibration"
restore_value: true
optimistic: true
min_value: -10
max_value: +10
step: 0.02
initial_value: 1.2
unit_of_measurement: "°K"
id: test_pompe1_temperature_calibration
- platform: template
name: "test-pompe1 Débit minute"
restore_value: true
optimistic: true
min_value: 0
max_value: +10
step: 0.1
initial_value: 6
unit_of_measurement: "l/mn"
id: test_pompe1_debit_minute
# Définition des sensors
sensor:
- platform: wifi_signal
name: "test-pompe1 Signal Wi-Fi"
update_interval: 60s
- platform: uptime
name: "test-pompe1 uptime"
update_interval: 60s
# Température aller
- platform: dallas
address: 0xd1020a92465ec628
name: "test-pompe1 temp aller"
id: test_pompe1_temp_aller
filters:
- lambda: return ( x - (id(test_pompe1_temperature_calibration).state /2) );
# Température retour
- platform: dallas
address: 0x3a0309977932c728
name: "test-pompe1 temp retour"
id: test_pompe1_temp_retour
filters:
- lambda: return ( x + (id(test_pompe1_temperature_calibration).state /2) );
# Différence de température en l'aller et le retour
- platform: template
name: "test-pompe1 temp diff"
id: test_pompe1_temp_diff
unit_of_measurement: "°K"
lambda: 'return (id(test_pompe1_temp_retour).state - id(test_pompe1_temp_aller).state);'
update_interval: 3s
# Calcul de la puissance pour un débit donné sur l'interface WEB
- platform: template
name: "test-pompe1 power"
id: test_pompe1_power
unit_of_measurement: "kW"
lambda: |-
if ( id(test_pompe1_pompe_state).state == 1 ) {
return ( id(test_pompe1_debit_minute).state / 60 * ( id(test_pompe1_temp_retour).state - id(test_pompe1_temp_aller).state ) * 4.18);
} else {
return 0.0;
}
update_interval: 3s
# Définition des sensors texts
text_sensor:
- platform: version
name: "test-pompe1 Version"
- platform: wifi_info
ip_address:
name: test-pompe1 IP Address
id: wifi_ip
ssid:
name: test-pompe1 Connected SSID
id: wifi_ssid
# Gestion des timers
interval:
# Boucle de régulation
- interval: 1s
then:
- if:
condition:
lambda: 'return id(test_pompe1_regulation_manuel).state == 0;'
then:
- if:
condition:
lambda: 'return (id(test_pompe1_temp_retour).state - id(test_pompe1_temp_aller).state) > (id(test_pompe1_temperature_delta).state + id(test_pompe1_temperature_hysterese).state);'
then:
- if:
condition:
lambda: 'return id(test_pompe1_pompe_state).state == 0;'
then:
- logger.log: "La tempéreature Retour est plus HAUTE que la tempéreature Aller, on allume la bonne pompe !"
- switch.turn_on: test_pompe1_pompe_state
- if:
condition:
lambda: 'return id(test_pompe1_priorite_jacuzzi).state == 0;'
then:
- switch.turn_on: test_pompe1_pompe1
- switch.turn_off: test_pompe1_pompe2
else:
- switch.turn_on: test_pompe1_pompe2
- switch.turn_off: test_pompe1_pompe1
- if:
condition:
lambda: 'return (id(test_pompe1_temp_retour).state - id(test_pompe1_temp_aller).state) < (id(test_pompe1_temperature_delta).state - id(test_pompe1_temperature_hysterese).state);'
then:
- if:
condition:
lambda: 'return id(test_pompe1_pompe_state).state == 1;'
then:
- logger.log: "La tempéreature Retour est plus BASSE que la tempéreature Aller, on éteint toutes les pompes !"
- switch.turn_off: test_pompe1_pompe_state
- switch.turn_off: test_pompe1_pompe1
- switch.turn_off: test_pompe1_pompe2
# Boucle de réveil pour rafraîchir les mesures de température quand les pompes ne tournent pas, autrement on est aveugle !
- interval: 10s
then:
- if:
condition:
lambda: 'return id(test_pompe1_regulation_manuel).state == 0;'
then:
- if:
condition:
lambda: 'return id(test_pompe1_pompe_state).state == 0;'
then:
- switch.turn_on: test_pompe1_regulation_manuel
- switch.turn_on: test_pompe1_pompe_state
- switch.turn_on: test_pompe1_pompe1
- switch.turn_on: test_pompe1_pompe2
- delay: 3s
- switch.turn_off: test_pompe1_pompe2
- switch.turn_off: test_pompe1_pompe1
- switch.turn_off: test_pompe1_pompe_state
- switch.turn_off: test_pompe1_regulation_manuel