-
Notifications
You must be signed in to change notification settings - Fork 0
/
heizungssteuerung.yaml
343 lines (281 loc) · 7.93 KB
/
heizungssteuerung.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
330
331
332
333
334
335
336
337
338
339
340
341
342
esphome:
name: heizung
esp32:
board: esp-wrover-kit
framework:
type: arduino
# Enable logging
logger:
# Enable debug log
debug:
# Enable Home Assistant API
api:
encryption:
key: "asdasdasdasdasd"
services:
- service: play_rtttl
variables:
song_str: string
then:
- rtttl.play:
rtttl: !lambda 'return song_str;'
ota:
password: "dsadsadsadsadsadsa"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Heizung Fallback Hotspot"
password: "uZ1HnNUDHQKa"
spi:
clk_pin: GPIO18
mosi_pin: GPIO23
miso_pin: GPIO19
switch:
- platform: gpio
pin: 33
name: "Heizung Klubheim"
id: heating
icon: tc:heat-index
time:
- platform: homeassistant
id: ha_time
timezone: Europe/Berlin
on_time:
# Every 5 minutes
- seconds: 0
minutes: /5
then:
font:
- file: '/config/esphome/font/slkscr.ttf'
id: my_font
size: 18
image:
- file: "/config/esphome/img/steckdose-color.png"
id: steckdose
resize: 80x80
type: RGB24
color:
- id: my_red
red: 100%
green: 0%
sensor:
- platform: wifi_signal
name: "Heizung WiFi Signal"
update_interval: 60s
- platform: uptime
name: "Heizung Uptime"
- platform: template
name: "temp"
id: "temp"
unit_of_measurement: "°C"
device_class: "temperature"
state_class: "measurement"
accuracy_decimals: 1
# temp sensor aus homeassistant
- platform: homeassistant
name: "Temperature Sensor From Home Assistant"
entity_id: sensor.scd30_temperature_2
id: temperature
text_sensor:
- platform: template
name: "Heizthermostat state"
id: htaction
update_interval: 5s
lambda: |-
switch (id(heizthermostat).action) {
case CLIMATE_ACTION_OFF:
return (std::string) "OFF";
case CLIMATE_ACTION_COOLING:
return (std::string) "COOLING";
case CLIMATE_ACTION_HEATING:
return (std::string) "HEIZEN";
case CLIMATE_ACTION_IDLE:
return (std::string) "UNTAETIG";
default:
return (std::string) "UNKNOWN";
}
# - platform: template
# name: "Heizthermostat preset"
# id: htpreset
# update_interval: 5s
# lambda: |-
# switch (id(heizthermostat).preset) {
# case Home:
# return (std::string) "Home";
# case Eco:
# return (std::string) "Eco";
# case CLIMATE_ACTION_HEATING:
# return (std::string) "HEIZEN";
# case CLIMATE_ACTION_IDLE:
# return (std::string) "UNTAETIG";
# default:
# return (std::string) "UNKNOWN";
# }
touchscreen:
platform: xpt2046
id: my_touchscreen
cs_pin: 14
#calibration_x_min: 3680
#calibration_x_max: 244
#calibration_y_min: 219
#calibration_y_max: 3670
calibration_x_min: 3890
calibration_x_max: 248
calibration_y_min: 229
calibration_y_max: 3664
#swap_x_y: True
on_touch:
- lambda: |-
ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
id(my_touchscreen).x,
id(my_touchscreen).y,
id(my_touchscreen).x_raw,
id(my_touchscreen).y_raw
);
#
binary_sensor:
- platform: template
id: activhome
name: activhome
publish_initial_state: False
- platform: touchscreen
id: touch_home
x_min: 0
x_max: 150
y_min: 120
y_max: 220
on_press:
- logger.log: "Home was touched"
- climate.control:
id: heizthermostat
mode: heat
preset: Home
- rtttl.play: 'scale_up:d=32,o=5,b=100:c#,f#'
- binary_sensor.template.publish:
id: activhome
state: ON
- platform: touchscreen
id: touch_away
x_min: 170
x_max: 320
y_min: 120
y_max: 220
on_press:
- logger.log: "AWAY was touched"
- climate.control:
id: heizthermostat
mode: heat
preset: AWAY
- rtttl.play: 'scale_dwn:d=32,o=5,b=100:f#,c#'
- binary_sensor.template.publish:
id: activhome
state: OFF
output:
# backlight
- platform: ledc
pin: 15
id: gpio_15_backlight_pwm
inverted: true
# buzzer
- platform: ledc
pin: GPIO21
id: rtttl_out
# component buzzer
rtttl:
output: rtttl_out
on_finished_playback:
- logger.log: 'Song ended!'
light:
# backlight for HA
- platform: monochromatic
output: gpio_15_backlight_pwm
name: "ILI9341 Display Backlight"
id: back_light
restore_mode: ALWAYS_ON
climate:
- platform: thermostat
id: heizthermostat
name: "Thermostat Climate Controller"
sensor: temperature
min_heating_off_time: 300s
min_heating_run_time: 300s
min_idle_time: 30s
visual:
min_temperature: 10
max_temperature: 26
temperature_step: 0.5
heat_action:
- switch.turn_on: heating
idle_action:
- switch.turn_off: heating
default_preset: AWAY
on_boot_restore_from: default_preset
preset:
- name: HOME
mode: heat
default_target_temperature_low: 25 °C
- name: AWAY
mode: heat
default_target_temperature_low: 10 °C
preset_change:
- logger.log: Preset has been changed!
display:
- platform: ili9341
model: TFT 2.4
id: touch_display
cs_pin: GPIO5
dc_pin: GPIO4
# if backlight is not controlled by pwm uncomment this
#led_pin:
# number: 15
# inverted: true
reset_pin: GPIO22
rotation: 270
###
# test display with my_red
# lambda: |-
# it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_red));
# it.print(0, 60, id(my_font), id(my_red), TextAlign::TOP_LEFT, "Temp SOLL: %.1f", id(heizthermostat).target_temperature);
# it.printf(0, 80, id(my_font), "Modus: %s", id(heizthermostat).action.c_str());
# switch (id(heizthermostat).action) {
# case CLIMATE_ACTION_OFF:
# it.printf(0, 80, id(my_font), "Modus: OFF");
# case CLIMATE_ACTION_HEATING:
# it.printf(0, 80, id(my_font), "Modus: Heizen");
# case CLIMATE_ACTION_IDLE:
# it.printf(0, 80, id(my_font), "Modus: Warten");
# default:
# it.printf(0, 80, id(my_font), "Modus: Unbekannt");
# }
# it.printf(0, 80, id(my_font), "Modus: %s", id(htaction));
#id(heating).state ? "ON" : "OFF"
# if (id(heizthermostat).preset == eco) {
# it.rectangle(0, 120, 150, 100, id(my_red));
# it.print(20, 150, id(my_font), id(my_red), TextAlign::TOP_LEFT, "Homee");
# }
# else {
# it.rectangle(0, 120, 150, 100, id(my_red));
# it.print(20, 150, id(my_font), id(my_red), TextAlign::TOP_LEFT, "Home");
# }
# // it.rectangle(0, 120, 150, 100, id(my_red));
# // it.print(20, 150, id(my_font), id(my_red), TextAlign::TOP_LEFT, "Home");
lambda: |-
it.fill(Color::BLACK);
it.print(0, 0, id(my_font), id(my_red), TextAlign::TOP_LEFT, "DK0FR Heizungssteuerung");
it.strftime(0, 20, id(my_font), "%a %Y-%m-%d %H:%M:%S", id(ha_time).now());
it.printf(0, 40, id(my_font), "Temp IST: %.1f °C", id(temperature).state);
it.printf(0, 60, id(my_font), "Temp SOLL: %.1f °C", id(heizthermostat).target_temperature);
it.printf(0, 80, id(my_font), "Modus: %s, Heizung %s", id(htaction).state.c_str(), id(heating).state ? "ON" : "OFF");
it.rectangle(0, 120, 150, 100, id(my_red));
it.print(20, 150, id(my_font), id(my_red), TextAlign::TOP_LEFT, "HOME");
it.rectangle(170, 120, 150, 100, id(my_red));
it.print(190, 150, id(my_font), id(my_red), TextAlign::TOP_LEFT, "AWAY");
if (id(activhome).state) {
it.print(20, 170, id(my_font), id(my_red), TextAlign::TOP_LEFT, "AKTIV");
} else {
it.print(190, 170, id(my_font), id(my_red), TextAlign::TOP_LEFT, "AKTIV");
}
it.rectangle(170, 120, 150, 100, id(my_red));
it.print(190, 150, id(my_font), id(my_red), TextAlign::TOP_LEFT, "AWAY");