-
Notifications
You must be signed in to change notification settings - Fork 0
/
esphome-circulation-pump-controller.yaml
260 lines (225 loc) · 5.56 KB
/
esphome-circulation-pump-controller.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
substitutions:
devicename: wh-circulation-
upper_devicename: Water Heater Circulation
esphome:
name: "wh-circulation"
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "D1XBLdjCVQMNj3YrrlzBsB64H7lh5HwXzpJKhMLg/4E="
services:
- service: motion_detected
then:
if:
condition:
and:
- switch.is_on: circulationpumpmotion
- lambda: 'return id(motiontimerreset) == true;'
then:
- logger.log: "Motion Pump Run"
- lambda: 'id(motiontimerreset) = false;'
- script.execute: pump_run
ota:
password: "4c6230961f157cc5cd0ee0518d5a87b6"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: none
manual_ip:
static_ip: 192.168.1.241
gateway: 192.168.1.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "WH Circulation Hotspot"
password: "im3A50bgmTfv"
captive_portal:
globals:
- id: motiontimerreset
type: bool
restore_value: False
dallas:
- pin: GPIO2
update_interval: 10s
sensor:
- platform: dallas
address: 0x9f021319f117aa28
name: Water In Temperature
id: 'water_in_temp'
- platform: dallas
address: 0x570120598a043e28
name: Water Loop Temperature
id: 'water_return_temp'
- platform: dallas
address: 0x803c01f095189328
name: Garage Outside Temperature
id: 'garage_outside_temp'
filters:
- sliding_window_moving_average:
window_size: 30
send_every: 1
send_first_at: 1
- platform: dallas
address: 0x113c01f095473228
name: Garage WH Exhaust
- platform: dallas
address: 0x043c01f0955d7a28
name: Garage WH Temperature
binary_sensor:
- platform: template
name: "Pump Running"
id: pumprunning
lambda: |-
if (id(pump_run).is_running()) {
return true;
} else {
return false;
}
- platform: template
name: "Outside Freeze"
id: "outside_freeze"
lambda: |-
if (id(garage_outside_temp).state <= 1) {
return true;
} else {
return false;
}
- platform: template
name: "Outside Deep Freeze"
id: "outside_deep_freeze"
lambda: |-
if (id(garage_outside_temp).state <= -6) {
return true;
} else {
return false;
}
switch:
- platform: template
name: "Water Heater Pump"
id: circulationpumpon
restore_state: true
turn_on_action:
- logger.log: "Circulation On"
- script.execute: pump_run
- switch.template.publish:
id: circulationpumpon
state: ON
turn_off_action:
- logger.log: "Circulation Off"
- script.stop: pump_run
- script.execute: pump_off
- switch.template.publish:
id: circulationpumpon
state: OFF
lambda: |-
if (id(circulationpumpon).state) {
return true;
} else {
return false;
}
- platform: template
name: "Water Heater Pump Motion"
id: circulationpumpmotion
restore_state: true
turn_on_action:
- logger.log: "Circulation On"
#- script.execute: pump_run
- lambda: 'id(motiontimerreset) = true;'
- switch.template.publish:
id: circulationpumpmotion
state: ON
turn_off_action:
- logger.log: "Circulation Off"
- script.stop: pump_run
- script.execute: pump_off
- switch.template.publish:
id: circulationpumpmotion
state: OFF
lambda: |-
if (id(circulationpumpmotion).state) {
return true;
} else {
return false;
}
button:
- platform: template
name: Circulation Pump Once
id: btnCirculateOnce
# Optional variables:
icon: "mdi:water-pump"
on_press:
- logger.log: "Button pressed"
- script.execute: pump_run
# Status LED
status_led:
pin: GPIO25
script:
- id: pump_run
mode: restart
then:
- output.turn_on: relayk1
- output.turn_on: relayk2
- delay: 5s
- output.turn_on: relayk3
- delay: 3min
- output.turn_off: relayk1
- output.turn_off: relayk2
- output.turn_off: relayk3
- id: pump_off
mode: restart
then:
- output.turn_off: relayk1
- output.turn_off: relayk2
- output.turn_off: relayk3
interval:
# for pump switch (normal pump run or deep freeze)
- interval: 18min
then:
if:
condition:
or:
- switch.is_on: circulationpumpon
- binary_sensor.is_on: outside_deep_freeze
then:
- logger.log: "Interval Fire"
- script.execute: pump_run
# for pump motion switch (run pump only when motion)
- interval: 18min
then:
if:
condition:
or:
- switch.is_on: circulationpumpmotion
then:
- logger.log: "Interval Motion Reset"
- lambda: 'id(motiontimerreset) = true;'
# for freeze protection (run every 30 mins)
- interval: 30min
then:
if:
condition:
and:
- binary_sensor.is_off: outside_deep_freeze
- binary_sensor.is_on: outside_freeze
then:
- logger.log: "Interval Fire"
- script.execute: pump_run
output:
- platform: gpio
id: relayk1
pin: GPIO21
- platform: gpio
id: relayk2
pin: GPIO19
- platform: gpio
id: relayk3
pin: GPIO18
- platform: gpio
id: relayk4
pin: GPIO05