-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaquapi_config.yaml
603 lines (544 loc) · 13.4 KB
/
aquapi_config.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
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
substitutions:
# names
name: "aquapi"
friendly_name: "AquaPi"
# App Version - Updated: 8/2023
app_version: "0.21.4"
# Import Config
import_config: "false"
# Logger Level
# Can use VERBOSE for more information
logger: "DEBUG"
# pins
dallasPin: "16"
opticalHighPin: "33"
opticalLowPin: "32"
sdaPin: "21"
sclPin: "22"
# EZO Circuit Addresses
# pH circuit, who's address is 99
addPH: "99"
# EC circuit, who's address is 100
addEC: "100"
# DO circuit, who's address is 97
addDO: "97"
# RTD circuit, who's address is 102
addRTD: "102"
# PMP circuit, who's address is 103
addPMP: "103"
# HUM circuit, who's address is 111
addHUM: "111"
# CO2 circuit, who's address is 105
addCO2: "105"
# Calibration variables
# 0C using Ice Water; 100C using Boiling Water
# Calibration Temp. 1
cal_0: "0.0"
cal_100: "100.0"
# Calibration Temp. 2
cal_0_2: "0.0"
cal_100_2: "100.0"
# Sensor update intevals. 60s = 1 minute, never = disable updates
# Water Level
update_water: "60s"
# Temp. Probes
update_temp: "60s"
# EZO pH
update_ph: "60s"
# EZO EC
update_ec: "60s"
# EZO DO
update_do: "60s"
# EZO RTD
update_rtd: "60s"
# EZO PMP
update_pmp: "60s"
# EZO HUM
update_hum: "60s"
# EZO CO2
update_co2: "60s"
esphome:
name: "${name}"
friendly_name: "${friendly_name}"
# Automatically add the mac address to the name
name_add_mac_suffix: true
comment: AquaPi ESP32 - Aquarium Controller & Monitor
project:
name: TheRealFalseReality.aquapi
version: "${app_version}"
on_boot:
priority: 200
then:
- component.update: water_level
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
level: "${logger}"
# Enable Home Assistant API
api:
ota:
dashboard_import:
package_import_url: github://TheRealFalseReality/aquapi/aquapi_config.yaml@main
import_full_config: ${import_config}
wifi:
ap:
captive_portal:
web_server:
# Sets up Bluetooth LE (Only on ESP32) to allow the user to provision wifi credentials to the device.
esp32_improv:
authorizer: none
improv_serial:
# i2c Pins
i2c:
sda: ${sdaPin}
scl: ${sclPin}
scan: true
id: bus_a
# Internal Blue LED
light:
- platform: status_led
pin: GPIO2
id: internal_led
# 18B20 sensor Pin
dallas:
- pin: ${dallasPin}
update_interval: "${update_temp}"
sensor:
# Internal Magnetic Sensor
- platform: esp32_hall
name: "ESP32 Hall Sensor"
entity_category: "diagnostic"
# Internal Temp.
- platform: internal_temperature
name: "Internal Temperature"
# Wifi Signal
- platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
name: "WiFi Signal dB"
id: wifi_signal_db
entity_category: "diagnostic"
# Wifi %
- platform: copy # Reports the WiFi signal strength in %
source_id: wifi_signal_db
name: "WiFi Signal Strength"
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "%"
entity_category: "diagnostic"
# Uptime sensor
- platform: uptime
name: Uptime
# EZO Circuits (yellow - SCL/RX, blue - SDA/TX)
# EZO Circuit - pH
- platform: ezo
icon: mdi:ph
name: "pH"
id: ph_ezo
address: ${addPH}
unit_of_measurement: ""
accuracy_decimals: 2
update_interval: "${update_ph}"
state_class: "measurement"
# EZO Circuit - EC
# Salinity
- platform: ezo
icon: mdi:shaker-outline
name: "Salinity"
id: ec_ezo
address: ${addEC}
unit_of_measurement: "ppt"
accuracy_decimals: 2
update_interval: "${update_ec}"
state_class: "measurement"
# Specific Gravity
- platform: copy
source_id: ec_ezo
name: "Specific Gravity"
filters:
- lambda: return x;
unit_of_measurement: ""
accuracy_decimals: 3
state_class: "measurement"
disabled_by_default: true
# Conductivity
- platform: copy
source_id: ec_ezo
name: "Conductivity"
icon: mdi:flash
filters:
- lambda: return x;
unit_of_measurement: "μS/cm"
accuracy_decimals: 3
state_class: "measurement"
disabled_by_default: true
# EZO Circuit - RTD
# Temperature
- platform: ezo
icon: mdi:thermometer-lines
name: "Temperature EZO"
id: temp_ezo
address: ${addRTD}
# unit_of_measurement: "°C"
accuracy_decimals: 2
update_interval: "${update_rtd}"
state_class: "measurement"
device_class: "temperature"
disabled_by_default: true
# EZO Circuit - HUM
# Humidity
- platform: ezo
icon: mdi:water-percent
name: "Humidity"
id: hum_ezo
address: ${addHUM}
unit_of_measurement: "%"
accuracy_decimals: 2
update_interval: "${update_hum}"
state_class: "measurement"
device_class: "humidity"
disabled_by_default: true
# EZO Circuit - CO2
# Cardbon Dioxide
- platform: ezo
icon: mdi:molecule-co2
name: "Cardbon Dioxide"
id: co2_ezo
address: ${addCO2}
unit_of_measurement: "ppm"
accuracy_decimals: 2
update_interval: "${update_co2}"
state_class: "measurement"
device_class: "carbon_dioxide"
disabled_by_default: true
# EZO Circuit - Dissolved Oxygen
- platform: ezo
icon: mdi:molecule
name: "Dissolved Oxygen"
id: do_ezo
address: ${addDO}
unit_of_measurement: "mg/L"
accuracy_decimals: 2
update_interval: "${update_do}"
state_class: "measurement"
disabled_by_default: true
# EZO Circuit - Pump
- platform: ezo
icon: mdi:pump
name: "Pump"
id: pmp_ezo
address: ${addPMP}
unit_of_measurement: ""
accuracy_decimals: 2
update_interval: "${update_pmp}"
state_class: "measurement"
disabled_by_default: true
# Temperature Probe 1
- platform: dallas
id: temp_1
icon: mdi:thermometer-lines
index: 0
name: "Temperature"
filters:
- calibrate_linear:
method: least_squares
datapoints:
- 0.0 -> ${cal_0}
- 100.0 -> ${cal_100}
on_value:
then:
- component.update: temp_range
# Temperature Probe 2
- platform: dallas
id: temp_2
icon: mdi:thermometer-lines
index: 1
name: "Temperature 2"
filters:
- calibrate_linear:
method: least_squares
datapoints:
- 0.0 -> ${cal_0_2}
- 100.0 -> ${cal_100_2}
disabled_by_default: true
on_value:
then:
- component.update: temp_range_2
# Convert to Fahrenheit - Temp. 1
- platform: template
id: temp_f
lambda: |-
return id(temp_1).state * 9 / 5 + 32;
# Convert to Fahrenheit - Temp. 2
- platform: template
id: temp_f_2
lambda: |-
return id(temp_2).state * 9 / 5 + 32;
# Calibration Temp. at 0C
- platform: template
name: Calibration at 0°C - Temp. 1
id: cal_0_sen
icon: mdi:snowflake-alert
unit_of_measurement: "°C"
disabled_by_default: true
entity_category: "diagnostic"
lambda: |-
return {${cal_0}};
# Calibration Temp. at 100C
- platform: template
name: Calibration at 100°C - Temp. 1
id: cal_100_sen
icon: mdi:water-thermometer
unit_of_measurement: "°C"
disabled_by_default: true
entity_category: "diagnostic"
lambda: |-
return {${cal_100}};
# Calibration Temp. 2 at 0C
- platform: template
name: Calibration at 0°C - Temp. 2
id: cal_0_2_sen
icon: mdi:snowflake-alert
unit_of_measurement: "°C"
disabled_by_default: true
entity_category: "diagnostic"
lambda: |-
return {${cal_0_2}};
# Calibration Temp. 2 at 100C
- platform: template
name: Calibration at 100°C - Temp. 2
id: cal_100_2_sen
icon: mdi:water-thermometer
unit_of_measurement: "°C"
disabled_by_default: true
entity_category: "diagnostic"
lambda: |-
return {${cal_100_2}};
binary_sensor:
# Aquapi API Status
- platform: status
name: "Status"
# Optical Sensor - LOW (yellow)
- platform: gpio
id: os_low
pin:
number: ${opticalLowPin}
inverted: true
mode:
input: true
pullup: true
name: "Optical Sensor: Low"
filters:
- delayed_on_off: 30ms
on_state:
then:
component.update: water_level
# Optical Sensor - HIGH (blue)
- platform: gpio
id: os_high
pin:
number: ${opticalHighPin}
inverted: true
mode:
input: true
pullup: true
name: "Optical Sensor: High"
filters:
- delayed_on_off: 30ms
on_state:
then:
component.update: water_level
text_sensor:
# Hostname
- platform: template
name: "Hostname"
id: hostname
icon: mdi:cellphone-arrow-down
lambda: |-
return {"${name}"};
entity_category: "diagnostic"
# Wifi Info
- platform: wifi_info
ip_address:
name: IP Address
icon: mdi:ip-network
# ssid:
# name: Connected SSID
# icon: mdi:wifi-arrow-left-right
# bssid:
# name: Connected BSSID
# icon: mdi:wifi-star
mac_address:
name: Mac Address
icon: mdi:chip
# AquaPi Version
- platform: template
name: "AquaPi Version"
id: aquapi_version
icon: mdi:update
update_interval: 600s
lambda: |-
return {"${app_version}"};
entity_category: "diagnostic"
# GitHub Project URL
- platform: template
name: GitHub
id: github
icon: mdi:github
lambda: |-
return {"github.com/TheRealFalseReality/aquapi"};
entity_category: "diagnostic"
# Water Level
- platform: template
icon: mdi:waves-arrow-up
name: "Water Level"
id: water_level
update_interval: "${update_water}"
lambda: |-
if(id(os_high).state == true && id(os_low).state == true) {
// Water Level is High
return {"High"};
}
if(id(os_high).state == false && id(os_low).state == false) {
// Water Level is Low
return {"Low"};
}
if(id(os_high).state == false && id(os_low).state == true) {
// Water Level is Normal
return {"Normal"};
} else {
return {"Uknown or Error"};
}
# Temperature Range 1
- platform: template
name: Temperature Range
id: temp_range
icon: mdi:thermometer-water
update_interval: "${update_temp}"
lambda: |-
if(id(temp_f).state <= id(range_cool).state) {
return {"Cool"};
}
if(id(temp_f).state < id(range_warm).state && id(temp_f).state > id(range_cool).state) {
return {"OK"};
}
if(id(temp_f).state >= id(range_warm).state) {
return {"Warm"};
}
else {
return {"Unknown"};
}
# Temperature Range 2
- platform: template
name: Temperature 2 Range
id: temp_range_2
icon: mdi:thermometer-water
update_interval: "${update_temp}"
disabled_by_default: true
lambda: |-
if(id(temp_f_2).state <= id(range_cool).state) {
return {"Cool"};
}
if(id(temp_f_2).state < id(range_warm).state && id(temp_f_2).state > id(range_cool).state) {
return {"OK"};
}
if(id(temp_f_2).state >= id(range_warm).state) {
return {"Warm"};
}
else {
return {"Unknown"};
}
button:
# Soft Restart
- platform: restart
name: "Restart"
# Facroty Reset
- platform: factory_reset
name: Factory Reset (USE WITH CAUTION)
disabled_by_default: true
# Safe Mode Restart
- platform: safe_mode
name: "Restart in Safe Mode"
id: restart_safe
disabled_by_default: false
# Shutdown
- platform: shutdown
name: "Shutdown"
disabled_by_default: true
# EC
# Output Parameters
# Output Salinity
- platform: template
name: "EC - Output - Salinity"
id: ec_sal
on_press:
then:
- lambda: |-
id(ec_ezo).send_custom("O,EC,0");
id(ec_ezo).send_custom("O,TDS,0");
id(ec_ezo).send_custom("O,S,1");
id(ec_ezo).send_custom("O,SG,0");
entity_category: "Config"
disabled_by_default: true
# Output Specific Gravity
- platform: template
name: "EC - Output - Specific Gravity"
id: ec_sg
on_press:
then:
- lambda: |-
id(ec_ezo).send_custom("O,EC,0");
id(ec_ezo).send_custom("O,TDS,0");
id(ec_ezo).send_custom("O,S,0");
id(ec_ezo).send_custom("O,SG,1");
entity_category: "Config"
disabled_by_default: true
# Output Conductivity
- platform: template
name: "EC - Output - Conductivity"
id: ec_cond
on_press:
then:
- lambda: |-
id(ec_ezo).send_custom("O,EC,1");
id(ec_ezo).send_custom("O,TDS,0");
id(ec_ezo).send_custom("O,S,0");
id(ec_ezo).send_custom("O,SG,0");
entity_category: "Config"
disabled_by_default: true
number:
# Temperature when Cool
- platform: template
name: "Temp. Cool"
id: range_cool
icon: mdi:water-thermometer
optimistic: true
mode: box
min_value: 0.0
max_value: 100.0
step: 0.5
restore_value: True
initial_value: 72
entity_category: "Config"
on_value:
then:
- component.update: temp_range
- component.update: temp_range_2
# Temperature when Warm
- platform: template
name: "Temp. Warm"
icon: mdi:water-alert
id: range_warm
optimistic: true
mode: box
min_value: 0.0
max_value: 100.0
step: 0.5
restore_value: True
initial_value: 82
entity_category: "Config"
on_value:
then:
- component.update: temp_range
- component.update: temp_range_2