This is my hot tub controler with outdoor shower controler. It is based on a ESP32 and a 4 channel relay module. It has a DS18B20 temperature sensor for the hot tub and a DS18B20 for the water in the hot tub. It also has a DS18B20 for the outdoor shower and a DS18B20 for the water in system.
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
esphome:
name: pottastyring
platform: ESP32
board: nodemcu-32s
wifi:
ssid: ""
password: ""
domain: .lan
manual_ip:
static_ip: 192.168.x.x
gateway: 192.168.x.x
subnet: 255.255.255.0
dns1: 192.168.x.x
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "hottub"
password: ""
captive_portal:
web_server:
port: 80
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
time:
- platform: sntp
id: timer
servers:
- 0.pool.ntp.org
- 1.pool.ntp.org
- 2.pool.ntp.org
dallas:
- pin: GPIO13
sensor:
- platform: dallas
address: 0x67011464EA7EFF28
name: "Pottur hiti"
id: pottur_hiti
- platform: dallas
address: 0x8B0314649975FF28
name: "Vatn i pott"
id: vatn_i_hiti
- platform: dallas
address: 0x110000045976f328
name: "Hiti Skapur"
id: Hiti_skapur
- platform: dallas
address: 0xe10314645814ff28
name: "Hiti Uti"
id: hiti_uti
binary_sensor:
- platform: gpio
filters:
- delayed_on: 100ms
id: fylla
pin:
number: GPIO17
mode: INPUT_PULLUP
inverted: True
name: "Pottur fylla takki"
on_press:
if:
condition:
lambda: 'return id(pottur_hiti).state < 20;'
then:
- logger.log: "The sensor value is below 20!"
- switch.turn_on: relay_1
- delay: 1min
- switch.turn_on: relay_4
- delay: 30min
- switch.turn_off: relay_1
- delay: 3min
- climate.control:
id: pottur_climate
mode: "HEAT"
else:
- logger.log: "The sensor value is above 20!"
- platform: gpio
filters:
- delayed_on: 500ms
id: sturta
pin:
number: GPIO21
mode: INPUT_PULLUP
inverted: True
name: "Sturta takki"
on_press:
if:
condition:
lambda: 'return id(pottur_hiti).state > 38;'
then:
- logger.log: "The sensor value is above 38!"
- climate.control:
id: pottur_climate
mode: "OFF"
- delay: 10sec
- switch.turn_on: relay_3
- delay: 4min
- switch.turn_off: relay_3
else:
- logger.log: "The sensor value is below 20!"
- switch.turn_on: relay_3
- delay: 4min
- switch.turn_off: relay_3
- platform: gpio
filters:
- delayed_on: 500ms
id: nidurfall
pin:
number: GPIO33
mode: INPUT_PULLUP
inverted: True
name: "taema takki"
on_press:
then:
- switch.turn_off: relay_4
- climate.control:
id: pottur_climate
mode: "off"
switch:
- platform: gpio
restore_mode: ALWAYS_OFF
name: "Pottur fylla relay"
pin: GPIO25
id: relay_1
- platform: gpio
restore_mode: ALWAYS_OFF
name: "Pottur hita relay"
pin: GPIO26
id: relay_2
- platform: gpio
restore_mode: ALWAYS_OFF
name: "Sturta relay"
pin: GPIO27
id: relay_3
- platform: gpio
restore_mode: ALWAYS_ON
name: "Loka nidurfalli"
pin: GPIO18
id: relay_4
climate:
- platform: bang_bang
id: pottur_climate
visual:
min_temperature: 38
max_temperature: 42
temperature_step: 1.0
name: "Pottur vatn"
sensor: pottur_hiti
default_target_temperature_low: 38 °C
default_target_temperature_high: 40 °C
heat_action:
if:
condition:
lambda: 'return id(pottur_hiti).state > 32;'
then:
- logger.log: "The sensor is above 32! then full"
- switch.turn_on: relay_1
- switch.turn_on: relay_2
else:
- logger.log: "The sensor value is below 32!"
- switch.turn_on: relay_1
- delay: 1min
- switch.turn_on: relay_4
- delay: 30min
- switch.turn_on: relay_2
idle_action:
- switch.turn_off: relay_2
- switch.turn_off: relay_1
mqtt:
broker: 192.168.x.x
username: xxx
password: xxx