-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilahumclimate.yaml
329 lines (307 loc) · 8.56 KB
/
filahumclimate.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
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
substitutions:
sda_pin: GPIO4 # ESP8266 SDA pin
scl_pin: GPIO5 # ESP8266 SCL pin
dht1_pin: GPIO12 # First DHT22 pin
dht2_pin: GPIO13 # Second DHT22 pin
heat_pin: GPIO14 # Heater Relay pin
fan_pin: GPIO15 # Fan Relay pin
led_pin: GPIO3 # Addressable LED pin (WS2812) / wled supports GPIO2
but_pin: GPIO16 # Rotary Encoder Button
rea_pin: GPIO9 # Rotary Encoder pin A
reb_pin: GPIO10 # Rotary Encoder pin B
esphome:
name: filahumclimate
friendly_name: FilaHumClimate
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: <YOUR_ENCRIPTION_KEY>
ota:
password: <YOUR_OTA_PASS>
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Filahumclimate Fallback Hotspot"
password: <YOUR_AP_PASS>
captive_portal:
i2c:
sda: $sda_pin
scl: $scl_pin
scan: true
font:
- file:
type: gfonts
family: "Madimi One"
id: my_font
size: 15
- file:
type: gfonts
family: "Roboto"
weight: 100
id: my_font2
size: 12
sensor:
- platform: dht
pin: $dht1_pin
model: AM2302
temperature:
name: "Filament Temperature 1"
id: fil_tmp_1
humidity:
name: "Filament Humidity 1"
id: fil_hum_1
accuracy_decimals: 1
on_value_range:
- below: 10
then:
- light.turn_on:
id: leds
brightness: 50%
effect: "Fireworks"
update_interval: 5s
- platform: dht
pin: $dht2_pin
model: AM2302
temperature:
name: "Filament Temperature 2"
id: fil_tmp_2
humidity:
name: "Filament Humidity 2"
id: fil_hum_2
accuracy_decimals: 1
update_interval: 5s
- platform: rotary_encoder
id: encoder
pin_a:
number: $rea_pin
mode: INPUT_PULLUP
pin_b:
number: $reb_pin
mode: INPUT_PULLUP
on_clockwise:
- if:
condition:
switch.is_on: heat_cool
then:
- climate.control:
id: therm
target_temperature_high: !lambda "return id(therm).target_temperature_high + 1;"
else:
- climate.control:
id: therm
target_temperature_low: !lambda "return id(therm).target_temperature_low + 1;"
on_anticlockwise:
then:
- if:
condition:
switch.is_on: heat_cool
then:
- climate.control:
id: therm
target_temperature_high: !lambda "return id(therm).target_temperature_high - 1;"
else:
- climate.control:
id: therm
target_temperature_low: !lambda "return id(therm).target_temperature_low - 1;"
switch:
- platform: gpio
name: "Heating"
id: "heat_state"
pin: $heat_pin
inverted: false
- platform: gpio
name: "Fan"
id: "fan_state"
pin: $fan_pin
inverted: false
- platform: template
id: heat_cool
optimistic: true
binary_sensor:
- platform: gpio
id: button
pin:
number: $but_pin
inverted: true
on_press:
then:
- switch.toggle: heat_cool
on_click:
- min_length: 1000ms
max_length: 20000ms
then:
- select.operation:
id: therm_pre
operation: Next
cycle: true
- if:
condition:
- lambda: 'return id(therm_pre).state == "off";'
then:
- climate.control:
id: therm
custom_preset: Idle
- if:
condition:
- lambda: 'return id(therm_pre).state == "dry";'
then:
- climate.control:
id: therm
custom_preset: Dry
- if:
condition:
- lambda: 'return id(therm_pre).state == "coolfan";'
then:
- climate.control:
id: therm
custom_preset: Cool-FO
- if:
condition:
- lambda: 'return id(therm_pre).state == "cool";'
then:
- climate.control:
id: therm
custom_preset: Cool
select:
- platform: template
name: "Climate presets"
id: therm_pre
options:
- "off"
- "dry"
- "coolfan"
- "cool"
initial_option: "off"
optimistic: true
display:
- platform: "ssd1306_i2c"
model: SH1106_128x32
# reset_pin: GPIO16
address: 0x3C
lambda: |-
it.printf(0, -2, id(my_font), TextAlign::TOP_LEFT, "%.1f°", id(fil_tmp_1).state);
it.printf(0, 14, id(my_font), TextAlign::TOP_LEFT, "%.1f°", id(fil_tmp_2).state);
it.printf(40, -2, id(my_font), TextAlign::TOP_LEFT, "%.1f%%", id(fil_hum_1).state);
it.printf(40, 14, id(my_font), TextAlign::TOP_LEFT, "%.1f%%", id(fil_hum_2).state);
it.printf(90, -2, id(my_font), TextAlign::TOP_LEFT, "%.0f", id(therm).target_temperature_high);
it.printf(90, 14, id(my_font), TextAlign::TOP_LEFT, "%.0f", id(therm).target_temperature_low);
if (id(heat_cool).state) {
it.rectangle(87, 0, 23, 16);
} else {
it.rectangle(87, 16, 23, 16);
}
if (id(therm_pre).state == "off" ) { it.print(117, -3, id(my_font2), "O"); }
if (id(therm_pre).state == "dry") { it.print(117, -3, id(my_font2), "D"); }
if (id(therm_pre).state == "coolfan") { it.print(117, -3, id(my_font2), "F"); }
if (id(therm_pre).state == "cool") { it.print(117, -3, id(my_font2), "C"); }
it.print(117, 8, id(my_font2), "H");
if (id(heat_state).state) { it.rectangle(116, 10, 10, 11); }
it.print(117, 19, id(my_font2), "F");
if (id(fan_state).state) { it.rectangle(116, 21, 10, 11); }
light:
- platform: neopixelbus
type: GRB
variant: WS2811
pin: $led_pin
num_leds: 10
name: "FilaHum Led"
id: leds
effects:
- pulse:
name: "Pulse"
transition_length: 1s
update_interval: 500ms
min_brightness: 10%
max_brightness: 50%
- addressable_rainbow:
name: "Rainbow"
speed: 10
width: 50
- addressable_fireworks:
name: "Fireworks"
update_interval: 32ms
spark_probability: 10%
use_random_color: false
fade_out_rate: 120
climate:
- platform: thermostat
name: "Filament Humidity Controller"
id: therm
visual:
min_temperature: 10
max_temperature: 60
temperature_step:
target_temperature: 1
current_temperature: 0.1
sensor: fil_tmp_1
humidity_sensor: fil_hum_1
min_heating_off_time: 10s
min_heating_run_time: 5s
heat_action:
- switch.turn_on: heat_state
- switch.turn_on: fan_state
- light.turn_on:
id: leds
brightness: 50%
red: 1
green: 0
blue: 0
effect: "Pulse"
min_cooling_off_time: 10s
min_cooling_run_time: 10s
cool_action:
- switch.turn_off: heat_state
- switch.turn_on: fan_state
- light.turn_on:
id: leds
brightness: 50%
red: 0
green: 0
blue: 1
min_fanning_off_time: 10s
min_fanning_run_time: 60s
fan_only_action:
- switch.turn_off: heat_state
- switch.turn_on: fan_state
- light.turn_on:
id: leds
brightness: 50%
red: 0
green: 0.5
blue: 0.5
min_idle_time: 10s
idle_action:
- switch.turn_off: heat_state
- light.turn_on:
id: leds
brightness: 50%
effect: "Rainbow"
off_mode:
- switch.turn_off: heat_state
- switch.turn_off: fan_state
- light.turn_off: leds
default_preset: Idle
on_boot_restore_from: default_preset
preset:
- name: Idle
default_target_temperature_low: 10 °C
default_target_temperature_high: 25 °C
mode: "OFF"
- name: Dry
default_target_temperature_low: 45 °C
default_target_temperature_high: 50 °C
mode: heat
- name: Cool-FO
default_target_temperature_low: 15 °C
default_target_temperature_high: 35 °C
mode: fan_only
- name: Cool
default_target_temperature_low: 15 °C
default_target_temperature_high: 35 °C
mode: cool