Vielen dank an, Dr.Jones für die Bereitstellung seines Projektes.


Pinbelegung:
Display –> ESP-Wromm32
CS ———–> GPIO27
Reset ——–> GPIO5
D/C ———-> GPIO26
SDI(MOSI)—-> GPIO23
SCK ———-> GPIO18
LED ———-> GPIO4
SDO(MISO) –>GPIO19
Konfiguration für das Display
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
display:
- platform: ili9341
model: TFT_2.4
cs_pin: 27
dc_pin: 26
led_pin: 4
reset_pin: 5
rotation: 270
spi:
clk_pin: 18
mosi_pin: 23
miso_pin: 19
output:
- platform: ledc
pin: 4
id: gpio_4_backlight_pwm
light:
- platform: monochromatic
output: gpio_4_backlight_pwm
name: "Touchdisplay Licht"
id: back_light
restore_mode: ALWAYS_ON
Schriften und Farben
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
font:
- file: 'arial.ttf'
id: font1
size: 20
glyphs:
['&', '@', '!', ',', '.', '?', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z','å', 'Ä', 'ä', 'Ö', 'ö', 'Ü', 'ü', '/']
- file: 'arial.ttf'
id: font2
size: 24
glyphs:
['&', '@', '!', ',', '.', '?', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z','å', 'Ä', 'ä', 'Ö', 'ö', 'Ü', 'ü', '/']
color:
- id: my_red
red: 100%
green: 0%
blue: 0%
- id: my_green
red: 0%
green: 100%
blue: 0%
- id: my_blue
red: 0%
green: 0%
blue: 100%
- id: my_turkis
red: 5%
green: 50%
blue: 80%
- id: my_yellow
red: 100%
green: 100%
blue: 0%
Textausgabe
1
2
lambda: |-
it.printf(145, 60, id(font1), my_red, "Smarthome yourself");
Beispiel für Wetterdaten auf dem Display
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
text_sensor:
- platform: homeassistant
id: wetter_ani
entity_id: weather.dwd_weather_berlin_brandenburg
filters:
- substitute:
- "sunny -> sonnig"
- "partlycloudy -> teilweise wolkig"
- "rainy -> Regen"
- "windy -> windig"
- "snowy -> Schnee"
- "lightning -> Gewitter"
- "cloudy -> wolkig"
- platform: homeassistant
id: windgeschwindigkeit
entity_id: weather.dwd_weather_berlin_brandenburg
Beispiel für Textausgabe auf dem Display
1
2
it.printf(145, 80, id(font1), id(wetter_ani).state.c_str());
it.printf(145, 98, id(font1), "Wind: %.1f km/h", id(wind_speed).state);
Vollständiges Esphome Code-Beispiel
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
esphome:
name: touchdisplay
platform: ESP32
board: nodemcu-32s
platformio_options:
upload_speed: 921600
monitor_speed: 115200
logger:
api:
ota:
password: "cc3e253e9022dac095965c5e0563989d"
wifi:
ssid: SSID
password: "PASSWORT"
power_save_mode: none
output_power: 20dB
ap:
ssid: "Touchdisplay Fallback Hotspot"
password: "xVxOKhNVKpWm"
captive_portal:
sensor:
- platform: homeassistant
id: temp_keller
entity_id: sensor.temp_keller
- platform: homeassistant
id: temp_aussen
entity_id: sensor.temp_aussen
- platform: homeassistant
id: wind_speed
entity_id: sensor.wind_speed
- platform: homeassistant
id: ha_disk_use
entity_id: sensor.disk_use
- platform: homeassistant
id: phase_a
entity_id: sensor.shellyem3_c45bbe6c1e95_channel_a_power
- platform: homeassistant
id: phase_b
entity_id: sensor.shellyem3_c45bbe6c1e95_channel_b_power
- platform: homeassistant
id: phase_c
entity_id: sensor.shellyem3_c45bbe6c1e95_channel_c_power
binary_sensor:
- platform: homeassistant
id: lino
entity_id: binary_sensor.pet_lino
time:
- platform: homeassistant
id: homeassistant_time
text_sensor:
- platform: homeassistant
id: abfall_naechster
entity_id: sensor.abfallnaechster
- platform: homeassistant
id: nachster_abfall
entity_id: sensor.nachster_abfall
- platform: homeassistant
id: wetter_ani
entity_id: weather.dwd_weather_berlin_brandenburg
filters:
- substitute:
- "sunny -> sonnig"
- "partlycloudy -> teilweise wolkig"
- "rainy -> Regen"
- "windy -> windig"
- "snowy -> Schnee"
- "lightning -> Gewitter"
- "cloudy -> wolkig"
- platform: homeassistant
id: windgeschwindigkeit
entity_id: weather.dwd_weather_berlin_brandenburg
font:
- file: 'arial.ttf'
id: font1
size: 20
glyphs:
['&', '@', '!', ',', '.', '?', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z','å', 'Ä', 'ä', 'Ö', 'ö', 'Ü', 'ü', '/']
- file: 'arial.ttf'
id: font2
size: 24
glyphs:
['&', '@', '!', ',', '.', '?', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z','å', 'Ä', 'ä', 'Ö', 'ö', 'Ü', 'ü', '/']
color:
- id: my_red
red: 100%
green: 0%
blue: 0%
- id: my_green
red: 0%
green: 100%
blue: 0%
- id: my_blue
red: 0%
green: 0%
blue: 100%
- id: my_turkis
red: 5%
green: 50%
blue: 80%
- id: my_yellow
red: 100%
green: 100%
blue: 0%
image:
- file: "image.jpg"
id: my_image
type: RGB24
- file: "smarthomeinberlin.png"
id: my_logo
resize: 70x70
type: RGB24
- file: "temp.gif"
id: thermometer
- file: "trash.gif"
id: trash
display:
- platform: ili9341
model: TFT_2.4
cs_pin: 27
dc_pin: 26
led_pin: 4
reset_pin: 5
rotation: 270
lambda: |-
it.printf(2, 5, id(font1), "HA Disk use");
it.printf(115, 5, id(font1), "%.1fGB", id(ha_disk_use).state);
it.image(250, 5, id(my_logo));
it.line(0, 80, 400, 80);
it.printf(25, 30, id(font1), "Abholung");
it.print(0, 55, id(font1), id(nachster_abfall).state.c_str());
it.printf(2, 80, id(font1), "Aussen: %.1f°C", id(temp_aussen).state);
it.printf(2, 98, id(font1), "Innen: %.1f°C", id(temp_keller).state);
it.printf(145, 80, id(font1), id(wetter_ani).state.c_str());
it.printf(145, 98, id(font1), "Wind: %.1f km/h", id(wind_speed).state);
it.line(0, 121, 400, 121);
it.image(0, 30, id(trash));
it.line(140, 122, 140, 240);
it.printf(145, 120, id(font1), my_red, "Stromverbrauch");
it.printf(235, 140, id(font1), "%.1f W", id(phase_a).state);
it.printf(235, 160, id(font1), "%.1f W", id(phase_b).state);
it.printf(235, 180, id(font1), "%.1f W", id(phase_c).state);
it.printf(145, 140, id(font1), my_green, "Phase A");
it.printf(145, 160, id(font1), my_turkis, "Phase B");
it.printf(145, 180, id(font1), my_yellow, "Phase C");
it.printf(2, 122, id(font1), "Lino: %s", id(lino).state ? "Zuhause" : "Draussen");
it.line(140, 205, 340, 205);
it.strftime(150, 210, id(font2), "%H:%M %d.%m.%y", id(homeassistant_time).now());
spi:
clk_pin: 18
mosi_pin: 23
miso_pin: 19
output:
- platform: ledc
pin: 4
id: gpio_4_backlight_pwm
light:
- platform: monochromatic
output: gpio_4_backlight_pwm
name: "Touchdisplay Licht"
id: back_light
restore_mode: ALWAYS_ON