-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpool_ezo.yaml
518 lines (483 loc) · 13.2 KB
/
pool_ezo.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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
# Atlas Scientific pool controller
# kit also has two ezo dosing pumps, one for acid and one for chlorine
# https://atlas-scientific.com/peristaltic/ezo-pmp/
# https://atlas-scientific.com/kits/wi-fi-pool-kit/
# note that you may have to ground the system to earth. Drive down a earth rod, connect the rod to GND pin on the ic2 connector for the pumps. Now your pH should read correctly
substitutions:
devicename: "pool-ezo"
name: pool-ezo
esphome:
name: "$devicename"
esp32:
board: featheresp32
framework:
type: arduino
# Enable logging
logger:
# level: verbose
# Enable Home Assistant API
api:
encryption:
key: !secret api_ezo_key
ota:
- platform: esphome
password: !secret ota_ezo_password
wifi:
ssid: !secret wifi__iot2_ssid
password: !secret wifi_iot2_password
manual_ip:
static_ip: 192.168.2.218
gateway: 192.168.2.1
subnet: 255.255.255.0
# use_address: 192.168.2.237
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: ${devicename}
password: !secret wifi_ap_password
captive_portal:
i2c:
sda: 23
scl: 22
# scan: true
id: bus_a
ezo_pmp:
- id: ezo_cl_pmp
address: 103 # Default Address for the EZO-PMP.
update_interval: 10s
- id: ezo_acid_pmp
address: 104 # Default Address for the EZO-PMP.
update_interval: 10s
sensor:
- platform: uptime
name: Relay Uptime
- platform: wifi_signal
name: Relay WiFi Signal
update_interval: 60s
- platform: ezo
name: "pH"
id: ph_ezo
address: 99
unit_of_measurement: "pH"
update_interval: 60s
accuracy_decimals: 2
on_device_information:
then:
- lambda: |-
ESP_LOGI("main", "ph1_on_device_information %s", x.c_str());
on_led:
then:
- lambda: |-
ESP_LOGI("main", "ph1_on_led %d", x);
on_slope:
- lambda: |-
ESP_LOGI("main", "ph1_on_slope %s", x.c_str());
on_calibration:
then:
- lambda: |-
ESP_LOGI("main", "ph1_on_calibration %s", x.c_str());
on_t:
then:
- lambda: |-
ESP_LOGI("main", "ph1_on_t %s", x.c_str());
on_custom:
then:
- lambda: |-
ESP_LOGI("main", "ph1_on_custom %s", x.c_str());
- platform: ezo
name: "orp"
id: orp_ezo
address: 98
unit_of_measurement: "mv"
accuracy_decimals: 0
update_interval: 60s
on_device_information:
then:
- lambda: |-
ESP_LOGI("main", "orp1_on_device_information %s", x.c_str());
on_led:
then:
- lambda: |-
ESP_LOGI("main", "orp1_on_led %d", x);
on_slope:
- lambda: |-
ESP_LOGI("main", "orp1_on_slope %s", x.c_str());
on_calibration:
then:
- lambda: |-
ESP_LOGI("main", "orp1_on_calibration %s", x.c_str());
on_t:
then:
- lambda: |-
ESP_LOGI("main", "orp1_on_t %s", x.c_str());
on_custom:
then:
- lambda: |-
ESP_LOGI("main", "orp1_on_custom %s", x.c_str());
- platform: ezo
name: "temp"
id: temp_ezo
address: 102
unit_of_measurement: "C"
accuracy_decimals: 2
update_interval: 60s
on_value:
then:
- lambda: id(ph_ezo).set_tempcomp_value(id(temp_ezo).state );
- lambda: id(orp_ezo).set_tempcomp_value(id(temp_ezo).state );
- platform: ezo_pmp
id: ezo_cl_pmp
total_volume_dosed:
id: total_cl_volume_dosed
name: Total Clorine Volume Dosed
- platform: ezo_pmp
id: ezo_cl_pmp
absolute_total_volume_dosed:
id: absolute_cl_total_volume_dosed
name: Absolute Clorine Total Volume Dosed
- platform: ezo_pmp
id: ezo_cl_pmp
last_volume_requested:
id: last_cl_volume_requested
name: Last Clorine Volume Requested
- platform: ezo_pmp
id: ezo_cl_pmp
max_flow_rate:
id: max_cl_flow_rate
name: Max Clorine Flow Rate
- platform: ezo_pmp
id: ezo_cl_pmp
pump_voltage:
id: pump_cl_voltage
name: Pump Clorine Voltage
- platform: ezo_pmp
id: ezo_acid_pmp
total_volume_dosed:
id: total_acid_volume_dosed
name: Total Acid Volume Dosed
- platform: ezo_pmp
id: ezo_acid_pmp
absolute_total_volume_dosed:
id: absolute_acid_total_volume_dosed
name: Absolute Acid Total Volume Dosed
- platform: ezo_pmp
id: ezo_acid_pmp
last_volume_requested:
id: last_acid_volume_requested
name: Last Acid Volume Requested
- platform: ezo_pmp
id: ezo_acid_pmp
max_flow_rate:
id: max_acid_flow_rate
name: Max Acid Flow Rate
- platform: ezo_pmp
id: ezo_acid_pmp
pump_voltage:
id: pump_acid_voltage
name: Pump Acid Voltage
- platform: wifi_signal
name: "${devicename} - Wifi Signal"
update_interval: 60s
icon: mdi:wifi
- platform: uptime
name: "${devicename} - Uptime"
update_interval: 60s
icon: mdi:clock-outline
binary_sensor:
- platform: ezo_pmp
id: ezo_cl_pmp
pump_state:
id: pump_cl_state
name: Pump Clorine State
- platform: ezo_pmp
id: ezo_cl_pmp
is_paused:
id: is_cl_paused
name: Is Clorine Paused
- platform: ezo_pmp
id: ezo_acid_pmp
pump_state:
id: pump_acid_state
name: Pump Acid State
- platform: ezo_pmp
id: ezo_acid_pmp
is_paused:
id: is_acid_paused
name: Is Acid Paused
text_sensor:
- platform: ezo_pmp
id: ezo_cl_pmp
dosing_mode:
id: dosing_mode
name: Dosing Mode
- platform: ezo_pmp
id: ezo_cl_pmp
calibration_status:
id: calibration_status
name: Calibration Status
- platform: ezo_pmp
id: ezo_acid_pmp
dosing_mode:
id: dosing_acid_mode
name: Dosing Acid Mode
- platform: ezo_pmp
id: ezo_acid_pmp
calibration_status:
id: calibration_acid_status
name: Calibration Acid Status
- platform: wifi_info
ip_address:
name: "${devicename} - IP Address"
ssid:
name: "${devicename} - Wi-Fi SSID"
bssid:
name: "${devicename} - Wi-Fi BSSID"
- platform: version
name: "${devicename} - ESPHome Version"
hide_timestamp: true
number:
- platform: template
id: volumecl
name: "Volume Cl"
optimistic: true
min_value: 0
max_value: 100
step: 0.01
- platform: template
id: durationcl
name: "Duration Cl"
optimistic: true
min_value: 0
max_value: 100
step: 1
- platform: template
id: volumeacid
name: "Volume Acid"
optimistic: true
min_value: 0
max_value: 100
step: 0.01
- platform: template
id: durationacid
name: "Duration Acid"
optimistic: true
min_value: 0
max_value: 100
step: 1
button:
- platform: template
id: button_dose_cl_over_time
name: "Dose Clorine Over Time"
on_press:
if:
condition:
lambda: return id(pump_acid_state).state == true;
then:
- logger.log: "Acid pump is running. Clorine pumping will be skipped."
else:
- ezo_pmp.dose_volume_over_time:
id: ezo_cl_pmp
volume: !lambda |-
return id(volumecl).state;
duration: !lambda |-
return id(durationcl).state;
- platform: template
id: button_dose_50_ml_cl_over_time
name: "Dose 50 mlClorine Over Time"
on_press:
if:
condition:
lambda: return id(pump_acid_state).state == true;
then:
- logger.log: "Acid pump is running. Clorine pumping will be skipped."
else:
- ezo_pmp.dose_volume_over_time:
id: ezo_cl_pmp
volume: !lambda |-
return 50;
duration: !lambda |-
return 1;
- platform: template
id: button_stop_cl_pump
name: "Stop Cl Pump"
on_press:
- ezo_pmp.stop_dosing:
id: ezo_cl_pmp
- platform: template
id: button_dose_acid_over_time
name: "Dose Acid Over Time"
on_press:
if:
condition:
lambda: return id(pump_cl_state).state == true;
then:
- logger.log: "Chlorine pump is running. Acid pumping will be skipped."
else:
- ezo_pmp.dose_volume_over_time:
id: ezo_acid_pmp
volume: !lambda |-
return id(volumeacid).state;
duration: !lambda |-
return id(durationacid).state;
- platform: template
id: button_dose_50_ml_acid_over_time
name: "Dose 50 ml Acid Over Time"
on_press:
if:
condition:
lambda: return id(pump_cl_state).state == true;
then:
- logger.log: "Chlorine pump is running. Acid pumping will be skipped."
else:
- ezo_pmp.dose_volume_over_time:
id: ezo_acid_pmp
volume: !lambda |-
return 50;
duration: !lambda |-
return 1;
- platform: template
id: button_stop_Acid_pump
name: "Stop Acid Pump"
on_press:
- ezo_pmp.stop_dosing:
id: ezo_acid_pmp
- platform: template
id: button_dose_minus_50_ml_cl_over_time
name: "Clean-chlorine-tubing"
on_press:
if:
condition:
lambda: return id(pump_cl_state).state == true;
then:
- logger.log: "Chlorine pump is running. Cl pumping will be skipped."
else:
- ezo_pmp.dose_volume_over_time:
id: ezo_cl_pmp
volume: -50
duration: 1
- platform: template
id: button_dose_minus_50_ml_acid_over_time
name: "Clean-acid-tubing"
on_press:
if:
condition:
lambda: return id(pump_acid_state).state == true;
then:
- logger.log: "Acid pump is running. Cl pumping will be skipped."
else:
- ezo_pmp.dose_volume_over_time:
id: ezo_acid_pmp
volume: -50
duration: 1
- platform: template
id: button_change_cl_to_acid_address
name: "Change Cl to Acid Address"
# on_press:
# - ezo_pmp.change_i2c_address:
# id: ezo_cl_pmp
# address: 104
- platform: template
name: "Clear PH Calibration"
id: ph_calibrate_clear
on_press:
then:
- lambda: id(ph_ezo).clear_calibration();
- platform: template
name: "PH 7 Calibrate"
id: ph_calibrate_7
on_press:
then:
- lambda: id(ph_ezo).set_calibration_point_mid(7.00);
- platform: template
name: "PH 10 Calibrate"
id: ph_calibrate_10
on_press:
then:
- lambda: id(ph_ezo).set_calibration_point_high(10.00);
- platform: template
name: "PH 4 Calibrate"
id: ph_calibrate_4
on_press:
then:
- lambda: id(ph_ezo).set_calibration_point_low(4.00);
- platform: template
name: "Clear Orp Calibration"
id: orp_calibrate_clear
on_press:
then:
- lambda: id(orp_ezo).clear_calibration();
- platform: template
name: "Orp 225 Calibrate"
id: orp_calibrate_225
on_press:
then:
- lambda: id(orp_ezo).set_calibration_generic(225.00);
- platform: template
name: "Get pH Calibration"
on_press:
- lambda: |-
id(ph_ezo).get_calibration();
- platform: template
name: "Get orp Calibration"
on_press:
- lambda: |-
id(orp_ezo).get_calibration();
- platform: template
name: "Get pH Sensor Info"
on_press:
- lambda: |-
id(ph_ezo).get_device_information();
- platform: template
name: "Get pH Temp Compensation"
on_press:
- lambda: |-
id(ph_ezo).get_t();
- platform: template
name: "Get pH Slope"
on_press:
- lambda: |-
id(ph_ezo).get_slope();
- platform: template
name: "Get orp Slope"
on_press:
- lambda: |-
id(orp_ezo).get_slope();
- platform: template
name: "Update pH"
id: phUpdate
icon: "mdi:ph"
on_press:
- lambda: |-
id(ph_ezo).get_state();
- platform: template
name: "Custom pH"
id: phCustom
icon: "mdi:ph"
on_press:
- lambda: |-
id(ph_ezo).send_custom("Status");
- platform: template
name: "Custom orp"
id: orpCustom
icon: "mdi:ph"
on_press:
- lambda: |-
id(orp_ezo).send_custom("Status");
switch:
- platform: gpio
pin: 12
name: "pH On"
inverted: yes #Makes the ON status turn the pin LOW
internal: true #Hides the switch from Home Assistant so as not to clutter the interface
restore_mode: ALWAYS_ON #Sets the switch status ON at boot
- platform: gpio
pin: 15
name: "Temp On"
inverted: no #This pin needs to be HIGH, so not inverted
internal: true #Hides the switch from Home Assistant so as not to clutter the interface
restore_mode: ALWAYS_ON #Sets the switch status ON at boot
- platform: gpio
pin: 27
name: "ORP On"
inverted: yes #Makes the ON status turn the pin LOW
internal: true #Hides the switch from Home Assistant so as not to clutter the interface
restore_mode: ALWAYS_ON #Sets the switch status ON at boot