-
Notifications
You must be signed in to change notification settings - Fork 1
/
elink_1.yaml
329 lines (259 loc) · 13.4 KB
/
elink_1.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
#------------------------------
#-- elink_1.yaml
#-- Affiche un mini dashboard sur un mini display e-link
#-- L'écran est découpé en 5x3 zones où l'on peut afficher l'état d'un paramètre et un mini level meter
#-- zf210517.1854
#--
# sources:
# https://community.home-assistant.io/t/using-ttgo-epaper-display-with-esphome/168877
# https://github.com/esphome/issues/issues/1458
# https://github.com/lewisxhe/Esp-badge/blob/3dcb646971/schematic/T5_V2.3.pdf
# http://www.lilygo.cn/prod_view.aspx?TypeId=50031&Id=1149&FId=t3:50031:3
# https://fr.aliexpress.com/item/32869729970.html
# https://github.com/Xinyuan-LilyGO/LilyGo-T5-Epaper-Series?spm=a2g0o.detail.1000023.17.6b1d6399uhwyEP
# https://github.com/lewisxhe/GxEPD/blob/master/src/GxDEPG0213BN/GxDEPG0213BN.h
# https://www.e-paper-display.com/GDEH0213B72%20V1.1%20Specification4d82.pdf
# https://www.good-display.com/product/218.html
# https://esphome.io/components/binary_sensor/esp32_touch.html
esphome:
name: elink_1
platform: ESP32
board: esp32dev
# Configuration WIFI
wifi:
networks:
- ssid: !secret wifi_ssid
- password: !secret wifi_password
- ssid: !secret wifi_ssid2
- password: !secret wifi_password2
- ssid: !secret wifi_ssid3
- password: !secret wifi_password3
- ssid: !secret wifi_ssid4
- password: !secret wifi_password4
- ssid: !secret wifi_ssid5
- password: !secret wifi_password5
- ssid: !secret wifi_ssid6
- password: !secret wifi_password6
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "elink_1 Fallback Hotspot"
password: !secret ap_wifi_password
captive_portal:
# Enable logging
logger:
# level: VERBOSE
# Enable Home Assistant API
api:
password: !secret api_password
# Enable OTA
ota:
password: !secret ota_password
# WEB Server
web_server:
port: 80
# Serveur date et heure
time:
- platform: sntp
id: sntp_time
# Définition des sensors
sensor:
- platform: wifi_signal
name: "elink_1 Signal Wi-Fi"
id: wifi_power
update_interval: 10s
- platform: uptime
name: "elink_1 uptime"
update_interval: 60s
- platform: homeassistant
name: "elink_1 Inside Temp"
entity_id: sensor.th5_temperature
id: inside_temperature
- platform: homeassistant
name: "elink_1 Inside Hum"
entity_id: sensor.th5_humidite
id: inside_humidity
- platform: homeassistant
name: "elink_1 Inside WIFI"
entity_id: sensor.th5_signal_wi_fi
id: inside_wifi
- platform: homeassistant
name: "elink_1 Outside Temp"
entity_id: sensor.th1_8285_temperature
id: outside_temperature
- platform: homeassistant
name: "elink_1 Outside Hum"
entity_id: sensor.th1_8285_humidite
id: outside_humidity
- platform: homeassistant
name: "elink_1 Outside WIFI"
entity_id: sensor.th1_8285_signal_wi_fi
id: outside_wifi
- platform: homeassistant
name: "elink_1 Outside BAT"
entity_id: sensor.th1_8285_vcc_voltage
id: outside_bat
- platform: homeassistant
name: "Boiler Temp"
entity_id: sensor.sonoff_10006d1001_temperature
id: boiler_temp
- platform: homeassistant
name: "PVS total power"
entity_id: sensor.powermon_totalsolar_kw
id: pvs_pwr_total
- platform: homeassistant
name: "PVS toit power"
entity_id: sensor.sonoff_1000645a68_power
id: pvs_pwr_toit
- platform: homeassistant
name: "PVS jardin power"
entity_id: sensor.sonoff_1000cd8a10_power
id: pvs_pwr_jardin
- platform: homeassistant
name: "elink_1 TVOC"
entity_id: sensor.co2_72_tvoc
id: tvoc
# Définitions des texts sensors
text_sensor:
- platform: wifi_info
ip_address:
name: ESP IP Address
id: wifi_ip
ssid:
name: ESP Connected SSID
id: wifi_ssid
# Définition du bouton physique
binary_sensor:
- platform: gpio
pin:
number: GPIO39
mode: INPUT_PULLUP
inverted: True
name: "btn e-link refresh"
on_press:
- component.update: z_elink
# Définition du bouton virtuel
switch:
- platform: template
name: "switch e-link refresh"
turn_on_action:
- component.update: z_elink
# Définition des polices de caractères
font:
- file: 'arialn.ttf'
id: font1
size: 11
- file: 'arialn.ttf'
id: font2
size: 13
# caractères français
glyphs: "+\"*ç%&/()=?'!$;:_,.-<>° 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzàâäéèêëïîôöùûüÿ"
- file: "Ldfcomicsans-jj7l.ttf"
id: font_cs
size: 20
# - file: "arial_th.ttf"
# id: font_arth
# size: 16
# Définition du display e-link
spi:
clk_pin: 18
mosi_pin: 23
display:
# model: 2.90inv2 #c'est ceci qui marche avec mon e-link TTGO T5 V2.3.1 _ 2.13 zf210505.0002
# https://github.com/lewisxhe/GxEPD/blob/master/src/GxDEPG0213BN/GxDEPG0213BN.h
# J'ai comme résolution utilisable: 250x122 ! note: 128*250, the visible number of display pixels is 122*250, see GDEH0213B72 V1.1 Specification.pdf
- platform: waveshare_epaper
cs_pin: 5
dc_pin: 17
busy_pin: 4
reset_pin: 16
model: 2.90inv2
id: z_elink
rotation: 90°
full_update_every: 1
update_interval: 300s
# http://www.linux-france.org/prj/embedded/sdcc/sdcc_course.formatted_io.html, pour se souvenir le formatage de printf ;-)
lambda: |-
int label_x0 = 0; int label_y0 = 25;
int label_with = 62; int label_height = 30;
int label_xidx = 1; int label_yidx = 1;
int label_level = 1; int label_level_height = 5;
int label_level_y = label_height-label_level_height-2;
int label_level_min = 1; int label_level_max = 1;
// Print header, title and version
it.print(0, 4, id(font2), TextAlign::TOP_LEFT, "Mini dashboard Crissier");
it.print(250, 4, id(font1), TextAlign::TOP_RIGHT, "ver 210517.182826");
// Print inside temperature
label_xidx = 1; label_yidx = 1;
it.rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height, label_with-1, label_height-1, COLOR_ON);
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height, id(font1), TextAlign::TOP_CENTER, "In temp");
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height+10, id(font1), TextAlign::TOP_CENTER , "%.1f°C", id(inside_temperature).state);
label_level_min = 0; label_level_max = 50;
label_level = label_with * ((id(inside_temperature).state-label_level_min)/(label_level_max-label_level_min));
if (id(inside_temperature).has_state()) {
it.filled_rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height+label_level_y, label_level, label_level_height);
}
// Print inside humidity
label_xidx = 2; label_yidx = 1;
it.rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height, label_with-1, label_height-1, COLOR_ON);
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height, id(font1), TextAlign::TOP_CENTER, "In hum");
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height+10, id(font1), TextAlign::TOP_CENTER , "%.0f%%", id(inside_humidity).state);
label_level = label_with * 0.66;
it.filled_rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height+label_level_y, label_level, label_level_height);
// Print inside wifi
label_xidx = 3; label_yidx = 1;
it.rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height, label_with-1, label_height-1, COLOR_ON);
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height, id(font1), TextAlign::TOP_CENTER, "In wifi");
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height+10, id(font1), TextAlign::TOP_CENTER , "%.0fdB", id(inside_wifi).state);
label_level = label_with * 0.99;
it.filled_rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height+label_level_y, label_level, label_level_height);
// Print outside temperature
label_xidx = 1; label_yidx = 2;
it.rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height, label_with-1, label_height-1, COLOR_ON);
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height, id(font1), TextAlign::TOP_CENTER, "Out temp");
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height+10, id(font1), TextAlign::TOP_CENTER , "%.1f°C", id(outside_temperature).state);
label_level = label_with * 0.25;
it.filled_rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height+label_level_y, label_level, label_level_height);
// Print outside humidity
label_xidx = 2; label_yidx = 2;
it.rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height, label_with-1, label_height-1, COLOR_ON);
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height, id(font1), TextAlign::TOP_CENTER, "Out hum");
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height+10, id(font1), TextAlign::TOP_CENTER , "%.0f%%", id(outside_humidity).state);
label_level = label_with * 0.50;
it.filled_rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height+label_level_y, label_level, label_level_height);
// Print outside wifi
label_xidx = 3; label_yidx = 2;
it.rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height, label_with-1, label_height-1, COLOR_ON);
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height, id(font1), TextAlign::TOP_CENTER, "Out wifi");
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height+10, id(font1), TextAlign::TOP_CENTER , "%.0fdB", id(outside_wifi).state);
label_level = label_with * 0.75;
it.filled_rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height+label_level_y, label_level, label_level_height);
// Print outside voltage
label_xidx = 4; label_yidx = 2;
it.rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height, label_with-1, label_height-1, COLOR_ON);
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height, id(font1), TextAlign::TOP_CENTER, "Out bat");
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height+10, id(font1), TextAlign::TOP_CENTER , "%.2fV", id(outside_bat).state);
label_level = label_with * 0.99;
it.filled_rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height+label_level_y, label_level, label_level_height);
// Print PVS power total
label_xidx = 1; label_yidx = 3;
it.rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height, label_with-1, label_height-1, COLOR_ON);
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height, id(font1), TextAlign::TOP_CENTER, "PVS Ptot");
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height+10, id(font1), TextAlign::TOP_CENTER , "%.1fkW", id(pvs_pwr_total).state);
// Print PVS power toit
label_xidx = 2; label_yidx = 3;
it.rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height, label_with-1, label_height-1, COLOR_ON);
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height, id(font1), TextAlign::TOP_CENTER, "PVS Ptoit");
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height+10, id(font1), TextAlign::TOP_CENTER , "%.1fW", id(pvs_pwr_toit).state);
// Print PVS power jardin
label_xidx = 3; label_yidx = 3;
it.rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height, label_with-1, label_height-1, COLOR_ON);
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height, id(font1), TextAlign::TOP_CENTER, "PVS Pjard");
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height+10, id(font1), TextAlign::TOP_CENTER , "%.1fW", id(pvs_pwr_jardin).state);
// Print boiler temperature
label_xidx = 4; label_yidx = 3;
it.rectangle(label_x0+(label_xidx-1)*label_with, label_y0+(label_yidx-1)*label_height, label_with-1, label_height-1, COLOR_ON);
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height, id(font1), TextAlign::TOP_CENTER, "Boiler");
it.printf(label_x0+(label_xidx-1)*label_with+label_with/2, label_y0+(label_yidx-1)*label_height+10, id(font1), TextAlign::TOP_CENTER , "%.1f°C", id(boiler_temp).state);
// Print footer, WIFI SSID, signal, adrs ip, date, time
it.printf(0, 131, id(font1), TextAlign::BOTTOM_LEFT, "%s %.0f dB %s", id(wifi_ssid).state.c_str(), id(wifi_power).state, id(wifi_ip).state.c_str() );
it.strftime(250, 131, id(font1), TextAlign::BOTTOM_RIGHT, "%d-%m-%y %H:%M:%S", id(sntp_time).now());