2022-05-23 17:52:46 +00:00
|
|
|
esphome:
|
|
|
|
name: a3pool
|
2024-05-13 08:51:20 +00:00
|
|
|
|
|
|
|
esp8266:
|
2022-05-23 17:52:46 +00:00
|
|
|
board: nodemcuv2
|
|
|
|
|
|
|
|
ota:
|
2024-11-18 13:08:12 +00:00
|
|
|
- platform: esphome
|
|
|
|
password: !secret a3poolpasswd
|
2022-05-23 17:52:46 +00:00
|
|
|
|
|
|
|
api:
|
|
|
|
encryption:
|
|
|
|
key: !secret a3poolkey
|
|
|
|
|
|
|
|
logger:
|
|
|
|
|
|
|
|
wifi:
|
|
|
|
ssid: !secret wifi_ssid
|
|
|
|
password: !secret wifi_password
|
|
|
|
fast_connect: true
|
2024-05-29 08:49:54 +00:00
|
|
|
ap:
|
|
|
|
ssid: a3pool_rescue
|
|
|
|
password: !secret rescue_ap_password
|
|
|
|
|
|
|
|
captive_portal:
|
|
|
|
|
2022-05-23 17:52:46 +00:00
|
|
|
|
|
|
|
binary_sensor:
|
|
|
|
- platform: gpio
|
|
|
|
pin:
|
|
|
|
number: 12
|
|
|
|
inverted: true
|
|
|
|
mode:
|
|
|
|
input: true
|
|
|
|
pullup: true
|
|
|
|
id: pump_state
|
|
|
|
|
2024-05-13 08:44:42 +00:00
|
|
|
datetime:
|
2022-07-12 11:59:45 +00:00
|
|
|
- platform: template
|
2024-05-13 08:44:42 +00:00
|
|
|
name: Pool Pump Start Time
|
|
|
|
id: pool_start
|
|
|
|
type: time
|
2022-07-12 11:59:45 +00:00
|
|
|
optimistic: true
|
|
|
|
restore_value: true
|
2024-05-13 08:44:42 +00:00
|
|
|
initial_value: "08:00:00"
|
2022-07-12 11:59:45 +00:00
|
|
|
- platform: template
|
2024-05-13 08:44:42 +00:00
|
|
|
name: Pool Pump End Time
|
|
|
|
id: pool_end
|
|
|
|
type: time
|
2022-07-12 11:59:45 +00:00
|
|
|
optimistic: true
|
|
|
|
restore_value: true
|
2024-05-13 08:44:42 +00:00
|
|
|
initial_value: "20:00:00"
|
2022-07-12 11:59:45 +00:00
|
|
|
|
|
|
|
button:
|
|
|
|
- platform: template
|
|
|
|
name: "Sync To Clock"
|
|
|
|
on_press:
|
|
|
|
then:
|
|
|
|
- lambda: |-
|
2024-05-13 08:44:42 +00:00
|
|
|
int startSec = (int) (id(pool_start).hour * 3600) + (id(pool_start).minute * 60) + id(pool_start).second;
|
|
|
|
int endSec = (int) (id(pool_end).hour * 3600) + (id(pool_end).minute * 60) + id(pool_end).second;
|
|
|
|
int nowSec = (id(a3poolTime).now().hour * 3600) + (id(a3poolTime).now().minute * 60) + id(a3poolTime).now().second;
|
2022-07-12 11:59:45 +00:00
|
|
|
|
|
|
|
if(!id(control).state){
|
|
|
|
// Make sure wierd error or whatever
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-05-13 08:44:42 +00:00
|
|
|
if(startSec < endSec){
|
|
|
|
if(startSec < nowSec && nowSec < endSec){
|
2022-07-12 11:59:45 +00:00
|
|
|
id(pump).turn_on();
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
id(pump).turn_off();
|
|
|
|
}
|
|
|
|
}
|
2024-05-13 08:44:42 +00:00
|
|
|
else if(startSec > endSec){
|
|
|
|
if(endSec < nowSec && nowSec < startSec){
|
2022-07-12 11:59:45 +00:00
|
|
|
id(pump).turn_off();
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
id(pump).turn_on();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-05-23 17:52:46 +00:00
|
|
|
switch:
|
|
|
|
- platform: gpio
|
|
|
|
pin: 5
|
|
|
|
id: relay
|
|
|
|
on_turn_on:
|
|
|
|
- delay: 500ms
|
|
|
|
- switch.turn_off: relay
|
|
|
|
- platform: template
|
|
|
|
name: "Automate Control"
|
2022-07-12 11:59:45 +00:00
|
|
|
id: control
|
2022-05-23 17:52:46 +00:00
|
|
|
optimistic: true
|
2024-04-30 09:04:02 +00:00
|
|
|
restore_mode: RESTORE_DEFAULT_OFF
|
2022-05-23 17:52:46 +00:00
|
|
|
- platform: template
|
|
|
|
optimistic: false
|
|
|
|
name: pump
|
2022-06-28 09:37:19 +00:00
|
|
|
id: pump
|
2022-05-23 17:52:46 +00:00
|
|
|
lambda: |-
|
|
|
|
if (id(pump_state).state) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
turn_on_action:
|
|
|
|
- if:
|
|
|
|
condition:
|
|
|
|
lambda: 'return id(pump_state).state == false;'
|
|
|
|
then:
|
|
|
|
- switch.turn_on: relay
|
|
|
|
- delay: 500ms
|
|
|
|
- switch.turn_off: relay
|
|
|
|
turn_off_action:
|
|
|
|
- if:
|
|
|
|
condition:
|
|
|
|
lambda: 'return id(pump_state).state;'
|
|
|
|
then:
|
|
|
|
- switch.turn_on: relay
|
|
|
|
- delay: 500ms
|
|
|
|
- switch.turn_off: relay
|
|
|
|
|
2022-06-28 09:37:19 +00:00
|
|
|
time:
|
|
|
|
timezone: "Europe/Vienna"
|
|
|
|
id: a3poolTime
|
|
|
|
platform: sntp
|
|
|
|
on_time:
|
2024-05-13 09:02:49 +00:00
|
|
|
- seconds: 0
|
|
|
|
months: 4-10
|
2022-06-28 09:37:19 +00:00
|
|
|
then:
|
2022-07-12 11:59:45 +00:00
|
|
|
- if:
|
|
|
|
condition:
|
2024-05-13 09:02:49 +00:00
|
|
|
lambda: 'return id(a3poolTime).now().hour == id(pool_start).hour && id(a3poolTime).now().minute == id(pool_start).minute/* && id(a3poolTime).now().second == id(pool_start).second*/ && id(control).state;'
|
2022-07-12 11:59:45 +00:00
|
|
|
then:
|
|
|
|
- switch.turn_on: pump
|
2024-05-13 09:02:49 +00:00
|
|
|
- seconds: 0
|
|
|
|
months: 4-10
|
2022-06-28 09:37:19 +00:00
|
|
|
then:
|
2022-07-12 11:59:45 +00:00
|
|
|
- if:
|
|
|
|
condition:
|
2024-05-13 20:20:52 +00:00
|
|
|
lambda: 'return id(a3poolTime).now().hour == id(pool_end).hour && id(a3poolTime).now().minute == id(pool_end).minute/* && id(a3poolTime).now().second == id(pool_end).second*/ && id(control).state;'
|
2022-07-12 11:59:45 +00:00
|
|
|
then:
|
|
|
|
- switch.turn_off: pump
|
2022-06-28 09:37:19 +00:00
|
|
|
|
2022-05-23 17:52:46 +00:00
|
|
|
dallas:
|
|
|
|
- pin: D4
|
|
|
|
update_interval: 10s
|
|
|
|
sensor:
|
|
|
|
- platform: dallas
|
|
|
|
address: 0xd1000007494b3628
|
|
|
|
name: "Pool Temperature"
|
|
|
|
- platform: dallas
|
|
|
|
address: 0x440000073de2e728
|
|
|
|
name: "Solar Temperature"
|
|
|
|
|