-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathpool.yaml
More file actions
451 lines (428 loc) · 10.4 KB
/
Copy pathpool.yaml
File metadata and controls
451 lines (428 loc) · 10.4 KB
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
# Note this device is a work in progress
substitutions:
device_id: pool
device_name: Pool
api_key: !secret pool_key
pwd: !secret pool_pwd
esp32_variant: esp32s3
packages:
device_base: !include ./packages/device_base_esp32.yaml
external_components:
- source:
type: local
path: ./components
components: [pool_controller]
- source:
type: git
url: https://github.com/latonita/esphome
ref: waveshare_expander
components: [waveshare_io_ch32v003]
refresh: 1h
esphome:
on_boot:
then:
- light.turn_off: lcd_backlight
- output.set_level:
id: backlight_pwm_output
level: 0%
binary_sensor:
- platform: gpio
id: flow_main
name: "Main Pump Flow"
icon: mdi:waves-arrow-right
pin:
pcf8574: io_expander
number: 4
mode:
input: true
inverted: true
- platform: gpio
id: flow_aux
name: "Auxiliary Pump Flow"
icon: mdi:waves-arrow-right
pin:
pcf8574: io_expander
number: 5
mode:
input: true
inverted: true
display:
- platform: mipi_rgb
id: pool_display
model: RPI
update_interval: never
auto_clear_enabled: false
color_order: RGB
pclk_frequency: 18MHz
pclk_inverted: true
dimensions:
width: 1024
height: 600
de_pin:
number: 5
hsync_pin:
number: 46
ignore_strapping_warning: true
vsync_pin:
number: 3
ignore_strapping_warning: true
pclk_pin: 7
reset_pin:
waveshare_io_ch32v003: wave_io
number: 3
hsync_back_porch: 152
hsync_front_porch: 48
hsync_pulse_width: 162
vsync_back_porch: 13
vsync_front_porch: 3
vsync_pulse_width: 45
data_pins:
red:
- 1 # r3
- 2 # r4
- 42 # r5
- 41 # r6
- 40 # r7
green:
- 39 # g2
- 0 # g3
- 45 # g4
- 48 # g5
- 47 # g6
- 21 # g7
blue:
- 14 # b3
- 38 # b4
- 18 # b5
- 17 # b6
- 10 # b7
font:
- file: "gfonts://Roboto"
id: font_roboto_24
size: 24
- file: "gfonts://Roboto"
id: font_roboto_16
size: 16
- file: "https://github.com/Templarian/MaterialDesign-Webfont/raw/v7.4.47/fonts/materialdesignicons-webfont.ttf"
id: font_mdi_wifi
size: 28
glyphs:
- "\U000F092B" # wifi-strength-outline (no signal)
- "\U000F091F" # wifi-strength-1
- "\U000F0922" # wifi-strength-2
- "\U000F0925" # wifi-strength-3
- "\U000F0928" # wifi-strength-4 (full)
i2c:
id: i2c_bus
sda: GPIO8
scl: GPIO9
light:
- platform: monochromatic
id: lcd_backlight
output: backlight_pwm_output
default_transition_length: 0ms
restore_mode: ALWAYS_OFF
lvgl:
displays:
- pool_display
touchscreens:
- touchscreen_id: pool_touchscreen
on_idle:
timeout: 15sec
then:
- light.turn_off: lcd_backlight
- lvgl.pause:
bg_color: 0x1a1a2e
default_font: font_roboto_24
pages:
- id: main_page
widgets:
- label:
id: lbl_title
text: "Pool Controller"
align: CENTER
text_color: 0xffffff
text_font: font_roboto_24
- label:
id: lbl_wifi
text: "\U000F092B"
align: TOP_RIGHT
x: -10
y: 10
text_color: 0xaaaaaa
text_font: font_mdi_wifi
- label:
id: lbl_datetime
text: "--- --- -- --:-- --"
align: TOP_RIGHT
x: -48
y: 14
text_color: 0xaaaaaa
text_font: font_roboto_24
output:
- platform: waveshare_io_ch32v003
id: backlight_pwm_output
inverted: true
power_supply: backlight_enable
- platform: gpio
id: heater_output
pin:
pcf8574: io_expander
number: 0
mode: OUTPUT
inverted: true
- platform: gpio
id: fill_output
pin:
pcf8574: io_expander
number: 1
mode: OUTPUT
inverted: true
- platform: gpio
id: cleaner_output
pin:
pcf8574: io_expander
number: 2
mode: OUTPUT
inverted: true
- platform: gpio
id: pump_output
pin:
pcf8574: io_expander
number: 3
mode: OUTPUT
inverted: true
pcf8574:
- id: "io_expander"
address: 0x20
pcf8575: false
interrupt_pin:
number: GPIO6
mode: INPUT_PULLUP
pool_controller:
primary_pump:
name: "Pump"
id: pool_pump
icon: mdi:pump
output: pump_output
# current_sensor: pool_pump_current
# enable_anomaly_detection: true
# use_current_for_state: true
schedule_select:
id: pump_select
name: Pump Schedule
icon: mdi:clock-outline
restore_mode: Always Off
on_turn_on:
- component.update: pump_power
on_turn_off:
- component.update: pump_power
schedules:
- name: Normal
runtimes:
- start_time: "4:00"
end_time: "6:00"
minutes_per_hour: 60
- start_time: "6:00"
end_time: "18:00"
minutes_per_hour: 40
days_of_week: MON-FRI
- start_time: "21:00"
end_time: "22:00"
minutes_per_hour: 60
days_of_week: MON-FRI
- start_time: "6:00"
end_time: "22:00"
minutes_per_hour: 40
days_of_week: SAT,SUN
- name: Always Except Peak
runtimes:
- start_time: "0:00"
end_time: "18:00"
minutes_per_hour: 60
days_of_week: MON-FRI
- start_time: "21:00"
end_time: "24:00"
minutes_per_hour: 60
days_of_week: MON-FRI
- start_time: "0:00"
end_time: "24:00"
minutes_per_hour: 60
days_of_week: SAT,SUN
auxiliary_pumps:
- id: pool_cleaner
name: "Cleaner"
icon: mdi:robot-vacuum
output: cleaner_output
# current_sensor: pool_cleaner_current
# enable_anomaly_detection: true
# use_current_for_state: true
schedule_select:
id: cleaner_select
name: Cleaner Schedule
icon: mdi:clock-outline
on_turn_on:
- component.update: cleaner_power
on_turn_off:
- component.update: cleaner_power
schedules:
- name: Normal
runtimes:
- start_time: "4:00"
end_time: "5:00"
minutes_per_hour: 60
- name: Double Time
runtimes:
- start_time: "4:00"
end_time: "6:00"
minutes_per_hour: 60
restore_mode: Always Off
# pool_heater:
# name: Heater
# id: pool_heater
# output: heater_output
# temperature_sensor: water_temp
power_supply:
- id: backlight_enable
pin:
waveshare_io_ch32v003: wave_io
number: 2
mode:
output: true
enable_time: 10ms
keep_on_time: 10s
psram:
mode: octal
speed: 80MHz
sensor:
- id: !extend wifi_rssi
on_value:
then:
- lvgl.label.update:
id: lbl_wifi
text: !lambda |-
if (x >= -55) return std::string("\U000F0928"); // 4 bars
if (x >= -67) return std::string("\U000F0925"); // 3 bars
if (x >= -80) return std::string("\U000F0922"); // 2 bars
if (x >= -90) return std::string("\U000F091F"); // 1 bar
return std::string("\U000F092B"); // outline
- platform: template
id: pump_power
name: Pump Power
unit_of_measurement: "W"
device_class: power
state_class: measurement
accuracy_decimals: 1
update_interval: never
lambda: |-
return id(pool_pump).state ? 1500.0 : 0.0;
filters:
- heartbeat:
period: 10s
optimistic: true
- platform: total_daily_energy
name: Pump
power_id: pump_power
method: left
- platform: template
id: cleaner_power
name: Cleaner Power
unit_of_measurement: "W"
device_class: power
state_class: measurement
accuracy_decimals: 1
update_interval: never
lambda: |-
return id(pool_cleaner).state ? 875.0 : 0.0;
filters:
- heartbeat:
period: 10s
optimistic: true
- platform: total_daily_energy
name: Cleaner
power_id: cleaner_power
method: left
# - platform: total_daily_energy
# name: "Pool Pump Total Daily Energy"
# icon: mdi:flash
# power_id: pool_pump_power
# method: left
# filters:
# - throttle: 1min
# - platform: total_daily_energy
# name: "Pool Cleaner Total Daily Energy"
# icon: mdi:flash
# power_id: pool_cleaner_power
# method: left
# filters:
# - throttle: 1min
# - platform: ezo
# id: orp
# address: 98
# unit_of_measurement: "mV"
# update_interval: 10s
# - platform: ezo
# id: ph
# address: 99
# unit_of_measurement: "pH"
# update_interval: 10s
# - platform: ezo
# id: water_temp
# address: 101
# accuracy_decimals: 2
# unit_of_measurement: "°C"
# update_interval: 10s
# - platform: ezo
# id: return_temp
# address: 102
# accuracy_decimals: 2
# unit_of_measurement: "°C"
# update_interval: 10s
switch:
- platform: output
output: heater_output
name: Heater Test
device_class: switch
restore_mode: RESTORE_DEFAULT_OFF
time:
- id: !extend time_source
on_time_sync:
then:
- lvgl.label.update:
id: lbl_datetime
text: !lambda |-
auto t = id(time_source).now();
if (!t.is_valid()) return std::string("");
return t.strftime("%a %b %d %I:%M %p");
on_time:
- seconds: 0
then:
- lvgl.label.update:
id: lbl_datetime
text: !lambda |-
auto t = id(time_source).now();
if (!t.is_valid()) return std::string("");
return t.strftime("%a %b %d %I:%M %p");
touchscreen:
- platform: gt911
id: pool_touchscreen
display: pool_display
interrupt_pin:
number: GPIO4
mode: INPUT_PULLUP
reset_pin:
waveshare_io_ch32v003: wave_io
number: 1
mode: OUTPUT
on_touch:
then:
- if:
condition:
light.is_off: lcd_backlight
then:
- lvgl.resume:
- light.turn_on: lcd_backlight
waveshare_io_ch32v003:
- id: wave_io
address: 0x24
i2c_id: i2c_bus