· 4 months ago · May 26, 2025, 10:06 AM
1INFO ESPHome 2025.5.0
2INFO Reading configuration /config/esphome/esp-swimming-pool.yaml...
3INFO Detected timezone 'Europe/Lisbon'
4substitutions:
5 device_name: esp-swimming-pool
6 device_internal_name: esp_swimming_pool
7 device_friendly_name: ESP Swimming Pool
8 device_comment: Monitors the Swimming Pool Temperature and Controls Motor Pump
9 device_ip_address: 192.168.68.71
10 device_sampling_time: 30s
11 project_owner: joaopedros2
12 project_version: '1'
13 region: Europe/Lisbon
14esphome:
15 project:
16 name: joaopedros2.ESP32-DevKitC-V4
17 version: '1'
18 name: esp-swimming-pool
19 friendly_name: ESP Swimming Pool
20 comment: Monitors the Swimming Pool Temperature and Controls Motor Pump
21 on_boot:
22 - priority: 600.0
23 then:
24 - ds1307.read_time: {}
25 - delay: 5s
26 - if:
27 condition:
28 lambda: !lambda |-
29 auto now = id(esp_swimming_pool_ds1307_time).now();
30
31 auto timer1_start = id(esp_swimming_pool_timer_1_start).state_as_esptime();
32 auto timer1_stop = id(esp_swimming_pool_timer_1_stop).state_as_esptime();
33 auto timer2_start = id(esp_swimming_pool_timer_2_start).state_as_esptime();
34 auto timer2_stop = id(esp_swimming_pool_timer_2_stop).state_as_esptime();
35 auto timer3_start = id(esp_swimming_pool_timer_3_start).state_as_esptime();
36 auto timer3_stop = id(esp_swimming_pool_timer_3_stop).state_as_esptime();
37
38 bool within_timer1 = id(esp_swimming_pool_timer_1_active).state &&
39 (now.hour > timer1_start.hour || (now.hour == timer1_start.hour && now.minute >= timer1_start.minute)) &&
40 (now.hour < timer1_stop.hour || (now.hour == timer1_stop.hour && now.minute <= timer1_stop.minute));
41
42 bool within_timer2 = id(esp_swimming_pool_timer_2_active).state &&
43 (now.hour > timer2_start.hour || (now.hour == timer2_start.hour && now.minute >= timer2_start.minute)) &&
44 (now.hour < timer2_stop.hour || (now.hour == timer2_stop.hour && now.minute <= timer2_stop.minute));
45
46 bool within_timer3 = id(esp_swimming_pool_timer_3_active).state &&
47 (now.hour > timer3_start.hour || (now.hour == timer3_start.hour && now.minute >= timer3_start.minute)) &&
48 (now.hour < timer3_stop.hour || (now.hour == timer3_stop.hour && now.minute <= timer3_stop.minute));
49
50 return within_timer1 || within_timer2 || within_timer3;
51 then:
52 - switch.turn_on:
53 id: esp_swimming_pool_motor_switch
54 else:
55 - switch.turn_off:
56 id: esp_swimming_pool_motor_switch
57 min_version: 2025.5.0
58 build_path: build/esp-swimming-pool
59 area: ''
60 platformio_options: {}
61 includes: []
62 libraries: []
63 name_add_mac_suffix: false
64 debug_scheduler: false
65esp32:
66 board: az-delivery-devkit-v4
67 flash_size: 4MB
68 framework:
69 version: 2.0.5
70 advanced:
71 ignore_efuse_custom_mac: false
72 source: ~3.20005.0
73 platform_version: platformio/espressif32@5.4.0
74 type: arduino
75 variant: ESP32
76 cpu_frequency: 160MHZ
77preferences:
78 flash_write_interval: 10min
79logger:
80 level: INFO
81 baud_rate: 115200
82 tx_buffer_size: 512
83 deassert_rts_dtr: false
84 task_log_buffer_size: 768
85 hardware_uart: UART0
86 logs: {}
87i2c:
88- id: esp_swimming_pool_i2c
89 sda: 21
90 scl: 22
91 scan: false
92 frequency: 400000.0
93sensor:
94- platform: internal_temperature
95 id: esp_swimming_pool_internal_temperature
96 name: Internal Temperature
97 icon: mdi:thermometer
98 unit_of_measurement: °C
99 device_class: temperature
100 state_class: measurement
101 update_interval: 30s
102 disabled_by_default: true
103 force_update: false
104 accuracy_decimals: 1
105 entity_category: diagnostic
106- platform: uptime
107 id: esp_swimming_pool_uptime_sensor
108 name: Uptime Sensor
109 update_interval: 30s
110 internal: true
111 disabled_by_default: false
112 force_update: false
113 unit_of_measurement: s
114 icon: mdi:timer-outline
115 accuracy_decimals: 0
116 device_class: duration
117 state_class: total_increasing
118 entity_category: diagnostic
119 type: seconds
120- platform: wifi_signal
121 id: esp_swimming_pool_wifi_rssi
122 name: WiFi RSSI
123 icon: mdi:wifi
124 update_interval: 30s
125 entity_category: diagnostic
126 disabled_by_default: false
127 force_update: false
128 unit_of_measurement: dBm
129 accuracy_decimals: 0
130 device_class: signal_strength
131 state_class: measurement
132- platform: inkbird_ibsth1_mini
133 mac_address: 49:24:03:27:01:6C
134 temperature:
135 id: esp_swimming_pool_inkbird_ibs_p01b_temperature
136 name: Inkbird IBS-P01B Temperature
137 device_class: temperature
138 disabled_by_default: false
139 force_update: false
140 unit_of_measurement: °C
141 accuracy_decimals: 1
142 state_class: measurement
143 battery_level:
144 id: esp_swimming_pool_inkbird_ibs_p01b_battery
145 name: Inkbird IBS-P01B Battery
146 accuracy_decimals: 0
147 device_class: battery
148 disabled_by_default: false
149 force_update: false
150 unit_of_measurement: '%'
151 state_class: measurement
152 entity_category: diagnostic
153api:
154 id: esp_swimming_pool_ha_api
155 encryption:
156 key: +KPFlzx0e+ntmNR3bO3kiF10jABsgFpdCXE0xG56RJk=
157 reboot_timeout: 0s
158 port: 6053
159 password: ''
160ota:
161- platform: esphome
162 password: ksmdye
163 version: 2
164 port: 3232
165safe_mode:
166 disabled: false
167 reboot_timeout: 10min
168 num_attempts: 5
169 boot_is_good_after: 1min
170mdns:
171 disabled: false
172 services: []
173network:
174 enable_ipv6: false
175 min_ipv6_addr_count: 0
176binary_sensor:
177- platform: status
178 id: esp_swimming_pool_status
179 name: Status
180 icon: mdi:network-pos
181 device_class: connectivity
182 entity_category: diagnostic
183 disabled_by_default: false
184- platform: gpio
185 id: esp_swimming_pool_engine_state
186 name: Engine State
187 icon: mdi:engine
188 pin:
189 number: 23
190 inverted: true
191 mode:
192 input: true
193 pullup: true
194 output: false
195 open_drain: false
196 pulldown: false
197 ignore_pin_validation_error: false
198 ignore_strapping_warning: false
199 drive_strength: 20.0
200 filters:
201 - delayed_on_off: 50ms
202 device_class: power
203 disabled_by_default: false
204text_sensor:
205- platform: version
206 id: esp_swimming_pool_esphome_version
207 name: ESPHome Version
208 icon: mdi:package
209 hide_timestamp: true
210 entity_category: diagnostic
211 disabled_by_default: true
212- platform: template
213 id: esp_swimming_pool_uptime
214 name: Uptime
215 icon: mdi:clock-start
216 lambda: !lambda |-
217 int seconds = (id(esp_swimming_pool_uptime_sensor).state);
218 int days = seconds / (24 * 3600);
219 seconds = seconds % (24 * 3600);
220 int hours = seconds / 3600;
221 seconds = seconds % 3600;
222 int minutes = seconds / 60;
223 seconds = seconds % 60;
224 if ( days > 3650 ) {
225 return { "Starting up" };
226 } else if ( days ) {
227 return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
228 } else if ( hours ) {
229 return { (String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
230 } else if ( minutes ) {
231 return { (String(minutes) +"m "+ String(seconds) +"s").c_str() };
232 } else {
233 return { (String(seconds) +"s").c_str() };
234 }
235 update_interval: 30s
236 entity_category: diagnostic
237 disabled_by_default: false
238- platform: wifi_info
239 ip_address:
240 id: esp_swimming_pool_ip_address
241 name: IP Address
242 icon: mdi:ip-network
243 entity_category: diagnostic
244 disabled_by_default: false
245 update_interval: 1s
246 ssid:
247 id: esp_swimming_pool_connected_ssid
248 name: Connected SSID
249 icon: mdi:access-point
250 entity_category: diagnostic
251 disabled_by_default: false
252 update_interval: 1s
253 mac_address:
254 id: esp_swimming_pool_mac_address
255 name: Mac WiFi Address
256 icon: mdi:network-outline
257 entity_category: diagnostic
258 disabled_by_default: true
259 dns_address:
260 id: esp_swimming_pool_dns_address
261 name: DNS Address
262 icon: mdi:dns
263 entity_category: diagnostic
264 disabled_by_default: true
265 update_interval: 1s
266- platform: template
267 name: Motor Status
268 id: esp_swimming_pool_motor_status
269 icon: mdi:engine
270 lambda: !lambda |-
271 if (id(esp_swimming_pool_motor_switch).state && id(esp_swimming_pool_engine_state).state) {
272 return {"Auto On"};
273 } else if (id(esp_swimming_pool_motor_switch).state && !id(esp_swimming_pool_engine_state).state) {
274 return {"Standby"};
275 } else if (!id(esp_swimming_pool_motor_switch).state && id(esp_swimming_pool_engine_state).state) {
276 return {"Manual On"};
277 } else {
278 return {"Off"};
279 }
280 update_interval: 1s
281 disabled_by_default: false
282button:
283- platform: restart
284 id: esp_swimming_pool_device_restart
285 name: Restart
286 icon: mdi:restart
287 disabled_by_default: false
288 entity_category: config
289 device_class: restart
290- platform: safe_mode
291 id: esp_swimming_pool_device_safe_mode
292 name: Use Safe Mode
293 icon: mdi:restart-alert
294 disabled_by_default: true
295 entity_category: config
296 device_class: restart
297- platform: shutdown
298 id: esp_swimming_pool_device_shutdown
299 name: Shutdown
300 icon: mdi:power
301 disabled_by_default: true
302 entity_category: config
303wifi:
304 networks:
305 - ssid: Home-Network_IoT
306 password: x053xzs7#
307 priority: 0.0
308 manual_ip:
309 static_ip: 192.168.68.71
310 gateway: 192.168.68.1
311 subnet: 255.255.252.0
312 dns1: 192.168.68.205
313 dns2: 8.8.8.8
314 domain: .local
315 fast_connect: true
316 ap:
317 ssid: esp-swimming-pool
318 password: x053xzs7#
319 ap_timeout: 1min
320 reboot_timeout: 15min
321 power_save_mode: LIGHT
322 passive_scan: false
323 enable_on_boot: true
324 use_address: 192.168.68.71
325captive_portal: {}
326web_server:
327 port: 80
328 version: 3
329 include_internal: true
330 auth:
331 username: admin
332 password: ksmdye
333 local: true
334 enable_private_network_access: true
335 ota: true
336 log: true
337 css_url: ''
338 js_url: https://oi.esphome.io/v3/www.js
339esp32_ble:
340 id: esp_swimming_pool_ble
341 enable_on_boot: true
342 io_capability: none
343 advertising_cycle_time: 10s
344esp32_ble_tracker:
345 id: esp_swimming_pool_ble_tracker
346 scan_parameters:
347 interval: 1100ms
348 window: 1100ms
349 active: true
350 continuous: true
351 duration: 5min
352 max_connections: 3
353 software_coexistence: true
354bluetooth_proxy:
355 id: esp_swimming_pool_ble_proxy
356 active: true
357 connection_slots: 3
358 connections:
359 - {}
360 - {}
361 - {}
362time:
363- platform: ds1307
364 id: esp_swimming_pool_ds1307_time
365 update_interval: 4294967295
366 timezone: WET0WEST,M3.5.0/1,M10.5.0
367 address: 0x68
368- platform: sntp
369 id: esp_swimming_pool_sntp_time
370 timezone: WET0WEST,M3.5.0/1,M10.5.0
371 on_time_sync:
372 - then:
373 - ds1307.write_time: {}
374 update_interval: 15min
375 servers:
376 - 0.pool.ntp.org
377 - 1.pool.ntp.org
378 - 2.pool.ntp.org
379switch:
380- platform: gpio
381 id: esp_swimming_pool_motor_switch
382 name: Motor Switch
383 icon: mdi:engine
384 pin:
385 number: 18
386 mode:
387 output: true
388 input: false
389 open_drain: false
390 pullup: false
391 pulldown: false
392 inverted: false
393 ignore_pin_validation_error: false
394 ignore_strapping_warning: false
395 drive_strength: 20.0
396 inverted: true
397 restore_mode: RESTORE_DEFAULT_OFF
398 disabled_by_default: false
399 entity_category: config
400 interlock_wait_time: 0ms
401- platform: gpio
402 id: esp_swimming_pool_lights
403 name: Lights Switch
404 icon: mdi:lightbulb-group
405 pin:
406 number: 19
407 mode:
408 output: true
409 input: false
410 open_drain: false
411 pullup: false
412 pulldown: false
413 inverted: false
414 ignore_pin_validation_error: false
415 ignore_strapping_warning: false
416 drive_strength: 20.0
417 inverted: true
418 restore_mode: RESTORE_DEFAULT_OFF
419 disabled_by_default: false
420 entity_category: config
421 interlock_wait_time: 0ms
422- platform: template
423 id: esp_swimming_pool_timer_1_active
424 name: Timer 1 Active
425 icon: mdi:progress-clock
426 optimistic: true
427 restore_mode: RESTORE_DEFAULT_OFF
428 disabled_by_default: false
429 entity_category: config
430 assumed_state: false
431- platform: template
432 id: esp_swimming_pool_timer_2_active
433 name: Timer 2 Active
434 icon: mdi:progress-clock
435 optimistic: true
436 restore_mode: RESTORE_DEFAULT_OFF
437 disabled_by_default: false
438 entity_category: config
439 assumed_state: false
440- platform: template
441 id: esp_swimming_pool_timer_3_active
442 name: Timer 3 Active
443 icon: mdi:progress-clock
444 optimistic: true
445 restore_mode: RESTORE_DEFAULT_OFF
446 disabled_by_default: false
447 entity_category: config
448 assumed_state: false
449- platform: template
450 id: esp_swimming_pool_temperature_automation
451 name: Temperature Automation
452 icon: mdi:thermometer-auto
453 optimistic: true
454 restore_mode: RESTORE_DEFAULT_OFF
455 disabled_by_default: false
456 entity_category: config
457 assumed_state: false
458number:
459- platform: template
460 id: esp_swimming_pool_temperature_trigger
461 name: Temperature Trigger
462 unit_of_measurement: °C
463 device_class: temperature
464 optimistic: true
465 restore_value: true
466 initial_value: 17.5
467 min_value: -5.0
468 max_value: 40.0
469 step: 0.1
470 mode: BOX
471 disabled_by_default: false
472 entity_category: config
473 update_interval: 60s
474datetime:
475- platform: template
476 id: esp_swimming_pool_timer_1_start
477 name: Timer 1 Start
478 icon: mdi:clock-start
479 optimistic: true
480 initial_value:
481 hour: 9
482 minute: 0
483 second: 0
484 restore_value: true
485 disabled_by_default: false
486 entity_category: config
487 on_time:
488 - then:
489 - if:
490 condition:
491 switch.is_on:
492 id: esp_swimming_pool_timer_1_active
493 then:
494 - switch.turn_on:
495 id: esp_swimming_pool_motor_switch
496 type: TIME
497 update_interval: 60s
498- platform: template
499 id: esp_swimming_pool_timer_1_stop
500 name: Timer 1 Stop
501 icon: mdi:clock-end
502 optimistic: true
503 initial_value:
504 hour: 10
505 minute: 0
506 second: 0
507 restore_value: true
508 disabled_by_default: false
509 entity_category: config
510 on_time:
511 - then:
512 - if:
513 condition:
514 switch.is_on:
515 id: esp_swimming_pool_timer_1_active
516 then:
517 - switch.turn_off:
518 id: esp_swimming_pool_motor_switch
519 type: TIME
520 update_interval: 60s
521- platform: template
522 id: esp_swimming_pool_timer_2_start
523 name: Timer 2 Start
524 icon: mdi:clock-start
525 optimistic: true
526 initial_value:
527 hour: 14
528 minute: 0
529 second: 0
530 restore_value: true
531 disabled_by_default: false
532 entity_category: config
533 on_time:
534 - then:
535 - if:
536 condition:
537 switch.is_on:
538 id: esp_swimming_pool_timer_2_active
539 then:
540 - switch.turn_on:
541 id: esp_swimming_pool_motor_switch
542 type: TIME
543 update_interval: 60s
544- platform: template
545 id: esp_swimming_pool_timer_2_stop
546 name: Timer 2 Stop
547 icon: mdi:clock-end
548 optimistic: true
549 initial_value:
550 hour: 16
551 minute: 0
552 second: 0
553 restore_value: true
554 disabled_by_default: false
555 entity_category: config
556 on_time:
557 - then:
558 - if:
559 condition:
560 switch.is_on:
561 id: esp_swimming_pool_timer_2_active
562 then:
563 - switch.turn_off:
564 id: esp_swimming_pool_motor_switch
565 type: TIME
566 update_interval: 60s
567- platform: template
568 id: esp_swimming_pool_timer_3_start
569 name: Timer 3 Start
570 icon: mdi:clock-start
571 optimistic: true
572 initial_value:
573 hour: 19
574 minute: 0
575 second: 0
576 restore_value: true
577 disabled_by_default: false
578 entity_category: config
579 on_time:
580 - then:
581 - if:
582 condition:
583 switch.is_on:
584 id: esp_swimming_pool_timer_3_active
585 then:
586 - switch.turn_on:
587 id: esp_swimming_pool_motor_switch
588 type: TIME
589 update_interval: 60s
590- platform: template
591 id: esp_swimming_pool_timer_3_stop
592 name: Timer 3 Stop
593 icon: mdi:clock-end
594 optimistic: true
595 initial_value:
596 hour: 20
597 minute: 0
598 second: 0
599 restore_value: true
600 disabled_by_default: false
601 entity_category: config
602 on_time:
603 - then:
604 - if:
605 condition:
606 switch.is_on:
607 id: esp_swimming_pool_timer_3_active
608 then:
609 - switch.turn_off:
610 id: esp_swimming_pool_motor_switch
611 type: TIME
612 update_interval: 60s
613select:
614- platform: template
615 id: esp_swimming_pool_schedule
616 name: Schedule
617 icon: mdi:sun-snowflake-variant
618 options:
619 - summer
620 - winter
621 initial_option: summer
622 optimistic: true
623 restore_value: true
624 disabled_by_default: false
625 entity_category: config
626 update_interval: 60s
627
628INFO Configuration is valid!