-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwallpanel.yaml
More file actions
2769 lines (2656 loc) · 84.9 KB
/
wallpanel.yaml
File metadata and controls
2769 lines (2656 loc) · 84.9 KB
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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
substitutions:
device_name: "wallpanel"
friendly_name: "Wallpanel"
comment: "ESP32-P4"
api_password: !secret api_password
ota_password: !secret ota_password
esphome:
name: ${device_name}
comment: ${comment}
friendly_name: ${friendly_name}
platformio_options:
build_flags: "-DBOARD_HAS_PSRAM"
board_build.esp-idf.memory_type: qio_opi
board_build.flash_mode: dio
board_upload.maximum_ram_size: 524288
board_build.flash_size: 16MB
on_boot:
- priority: -100
then:
- light.turn_on:
id: backlight
brightness: !lambda return id(display_brightness).state / 100.0;
# Update LVGL sliders/labels met opgeslagen waarden
- lvgl.slider.update:
id: brightness_slider
value: !lambda return id(display_brightness).state;
- lvgl.label.update:
id: brightness_value_label
text: !lambda |-
char buf[16];
snprintf(buf, sizeof(buf), "%.0f%%", id(display_brightness).state);
return buf;
- lvgl.slider.update:
id: timeout_slider
value: !lambda return id(display_timeout).state;
- lvgl.label.update:
id: timeout_value_label
text: !lambda |-
char buf[16];
snprintf(buf, sizeof(buf), "%.0fs", id(display_timeout).state);
return buf;
api:
encryption:
key: ${api_password}
ota:
- platform: esphome
id: my_ota
password: ${ota_password}
wifi:
# networks:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: ${device_name}
password: ${wifi_password}
esp32:
board: esp32-p4-evboard
cpu_frequency: 360MHz
flash_size: 16MB
framework:
type: esp-idf
advanced:
enable_idf_experimental_features: true
# new:
disable_vfs_support_termios: false
disable_vfs_support_select: false
disable_vfs_support_dir: false
# new:
sdkconfig_options:
CONFIG_SPIRAM_XIP_FROM_PSRAM: "y" # Stop screen flashing during OTA
<<: !include common/images.yaml
<<: !include common/ha_theme.yaml
logger:
hardware_uart: USB_SERIAL_JTAG
esp32_hosted:
variant: esp32c6
active_high: true
reset_pin: 54
cmd_pin: 19
clk_pin: 18
d0_pin: 14
d1_pin: 15
d2_pin: 16
d3_pin: 17
slot: 1
psram:
speed: 200MHz
# Required for online_image component
http_request:
timeout: 10s
debug:
# Buienradar image from converted PNG
online_image:
- url: http://192.168.2.2:8123/local/esphomefiles/buienradar_frame_1.png
id: buienradar_frame_1
type: RGB565
byte_order: little_endian
format: PNG
resize: 314x220
update_interval: 5min # Sync met HA updates (elke 5 min)
- url: http://192.168.2.2:8123/local/esphomefiles/buienradar_frame_2.png
id: buienradar_frame_2
type: RGB565
byte_order: little_endian
format: PNG
resize: 314x220
update_interval: 303s # Gespreid: 5min + 3s
- url: http://192.168.2.2:8123/local/esphomefiles/buienradar_frame_3.png
id: buienradar_frame_3
type: RGB565
byte_order: little_endian
format: PNG
resize: 314x220
update_interval: 306s # Gespreid: 5min + 6s
- url: http://192.168.2.2:8123/local/esphomefiles/buienradar_frame_4.png
id: buienradar_frame_4
type: RGB565
byte_order: little_endian
format: PNG
resize: 314x220
update_interval: 309s # Gespreid: 5min + 9s
- url: http://192.168.2.2:8123/local/esphomefiles/buienradar_frame_5.png
id: buienradar_frame_5
type: RGB565
byte_order: little_endian
format: PNG
resize: 314x220
update_interval: 312s # Gespreid: 5min + 12s
# - url: http://192.168.2.2:8123/local/esphomefiles/buienradar_frame_6.png
# id: buienradar_frame_6
# type: RGB565
# byte_order: little_endian
# format: PNG
# resize: 314x220
# update_interval: 5min # Sync met HA updates (elke 5 min)
# - url: http://192.168.2.2:8123/local/esphomefiles/buienradar_frame_7.png
# id: buienradar_frame_7
# type: RGB565
# byte_order: little_endian
# format: PNG
# resize: 314x220
# update_interval: 5min # Sync met HA updates (elke 5 min)
# - url: http://192.168.2.2:8123/local/esphomefiles/buienradar_frame_8.png
# id: buienradar_frame_8
# type: RGB565
# byte_order: little_endian
# format: PNG
# resize: 314x220
# update_interval: 5min # Sync met HA updates (elke 5 min)
# - url: http://192.168.2.2:8123/local/esphomefiles/buienradar_frame_9.png
# id: buienradar_frame_9
# type: RGB565
# byte_order: little_endian
# format: PNG
# resize: 314x220
# update_interval: 5min # Sync met HA updates (elke 5 min)
# - url: http://192.168.2.2:8123/local/esphomefiles/buienradar_frame_10.png
# id: buienradar_frame_10
# type: RGB565
# byte_order: little_endian
# format: PNG
# resize: 314x220
# update_interval: 5min # Sync met HA updates (elke 5 min)
- url: http://192.168.2.2:8123/local/esphomefiles/energieprijzen.png
id: energieprijzen_image
type: RGB565
byte_order: little_endian
format: PNG
resize: 648x50
update_interval: 15min
on_download_finished:
- logger.log: "Energy price chart downloaded, updating widget"
- lvgl.image.update:
id: energieprijzen_widget
src: energieprijzen_image
- lvgl.widget.redraw:
id: energieprijzen_widget
- url: http://192.168.2.2:8123/local/esphomefiles/energiegrafiek.png
id: energiegrafiek_image
type: RGB565
byte_order: little_endian
format: PNG
resize: 984x480
update_interval: 15min
on_download_finished:
- logger.log: "Energiegrafiek downloaded, updating widget"
- lvgl.image.update:
id: energiegrafiek_widget
src: energiegrafiek_image
- lvgl.widget.redraw:
id: energiegrafiek_widget
- url: http://192.168.2.2:8123/local/esphomefiles/agenda.png
id: agenda_image
type: RGB565
byte_order: little_endian
format: PNG
resize: 314x220
update_interval: 15min
on_download_finished:
- logger.log: "Agenda image downloaded, updating widget"
- lvgl.image.update:
id: agenda_widget
src: agenda_image
- lvgl.widget.redraw:
id: agenda_widget
- url: http://192.168.2.2:8123/local/esphomefiles/camera1.jpg
id: camera1_image
type: RGB565
byte_order: little_endian
format: JPEG
resize: 314x220
update_interval: 10s
- url: http://192.168.2.2:8123/local/esphomefiles/camera2.jpg
id: camera2_image
type: RGB565
byte_order: little_endian
format: JPEG
resize: 314x220
update_interval: 15s
time:
- platform: homeassistant
id: ha_time
on_time:
- seconds: 0
then:
- lvgl.label.update:
id: header_datetime
text: !lambda |-
static const char* dagen[] = {"Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag"};
static const char* maanden[] = {"", "jan", "feb", "mrt", "apr", "mei", "jun", "jul", "aug", "sep", "okt", "nov", "dec"};
auto time = id(ha_time).now();
static char buf[100];
sprintf(buf, "%s %d %s %04d - %02d:%02d",
dagen[time.day_of_week - 1],
time.day_of_month,
maanden[time.month],
time.year,
time.hour,
time.minute);
return buf;
globals:
- id: buienradar_current_frame
type: int
restore_value: no
initial_value: '1'
- id: camera_current
type: int
restore_value: no
initial_value: '1'
- id: consumption_start
type: float
restore_value: yes
initial_value: '0.0'
- id: production_start
type: float
restore_value: yes
initial_value: '0.0'
- id: clean_mode_active
type: bool
restore_value: no
initial_value: 'false'
- id: clean_mode_countdown
type: int
restore_value: no
initial_value: '30'
interval:
- interval: 60s
then:
- lvgl.label.update:
id: header_datetime
text: !lambda |-
static const char* dagen[] = {"Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag"};
static const char* maanden[] = {"", "jan", "feb", "mrt", "apr", "mei", "jun", "jul", "aug", "sep", "okt", "nov", "dec"};
auto time = id(ha_time).now();
static char buf[100];
sprintf(buf, "%s %d %s %04d - %02d:%02d",
dagen[time.day_of_week - 1],
time.day_of_month,
maanden[time.month],
time.year,
time.hour,
time.minute);
return buf;
- interval: 1s
then:
- lambda: |-
if (id(clean_mode_active)) {
int countdown = id(clean_mode_countdown);
countdown--;
id(clean_mode_countdown) = countdown;
if (countdown <= 0) {
id(clean_mode_active) = false;
id(clean_mode_countdown) = 30;
}
}
- if:
condition:
lambda: 'return id(clean_mode_active);'
then:
- lvgl.widget.show: clean_mode_overlay
- lvgl.widget.show: clean_mode_overlay_settings
- lvgl.label.update:
id: clean_mode_timer
text: !lambda |-
char buf[16];
sprintf(buf, "%d", id(clean_mode_countdown));
return buf;
- lvgl.label.update:
id: clean_mode_timer_settings
text: !lambda |-
char buf[16];
sprintf(buf, "%d", id(clean_mode_countdown));
return buf;
else:
- lvgl.widget.hide: clean_mode_overlay
- lvgl.widget.hide: clean_mode_overlay_settings
- interval: 500ms
then:
- lambda: |-
// Cycle through buienradar animation frames (1-5)
int frame = id(buienradar_current_frame);
// Increment frame, loop back to 1 after 5
frame++;
if (frame > 5) {
frame = 1;
}
id(buienradar_current_frame) = frame;
- if:
condition:
lambda: 'return id(buienradar_current_frame) == 1;'
then:
- lvgl.image.update:
id: buienradar_widget
src: buienradar_frame_1
- if:
condition:
lambda: 'return id(buienradar_current_frame) == 2;'
then:
- lvgl.image.update:
id: buienradar_widget
src: buienradar_frame_2
- if:
condition:
lambda: 'return id(buienradar_current_frame) == 3;'
then:
- lvgl.image.update:
id: buienradar_widget
src: buienradar_frame_3
- if:
condition:
lambda: 'return id(buienradar_current_frame) == 4;'
then:
- lvgl.image.update:
id: buienradar_widget
src: buienradar_frame_4
- if:
condition:
lambda: 'return id(buienradar_current_frame) == 5;'
then:
- lvgl.image.update:
id: buienradar_widget
src: buienradar_frame_5
# - if:
# condition:
# lambda: 'return id(buienradar_current_frame) == 6;'
# then:
# - lvgl.image.update:
# id: buienradar_widget
# src: buienradar_frame_6
# - if:
# condition:
# lambda: 'return id(buienradar_current_frame) == 7;'
# then:
# - lvgl.image.update:
# id: buienradar_widget
# src: buienradar_frame_7
# - if:
# condition:
# lambda: 'return id(buienradar_current_frame) == 8;'
# then:
# - lvgl.image.update:
# id: buienradar_widget
# src: buienradar_frame_8
# - if:
# condition:
# lambda: 'return id(buienradar_current_frame) == 9;'
# then:
# - lvgl.image.update:
# id: buienradar_widget
# src: buienradar_frame_9
# - if:
# condition:
# lambda: 'return id(buienradar_current_frame) == 10;'
# then:
# - lvgl.image.update:
# id: buienradar_widget
# src: buienradar_frame_10
- interval: 5s
then:
- lambda: |-
// Toggle between camera 1 and 2
int cam = id(camera_current);
cam = (cam == 1) ? 2 : 1;
id(camera_current) = cam;
- if:
condition:
lambda: 'return id(camera_current) == 1;'
then:
- lvgl.image.update:
id: camera_widget
src: camera1_image
- if:
condition:
lambda: 'return id(camera_current) == 2;'
then:
- lvgl.image.update:
id: camera_widget
src: camera2_image
sensor:
- platform: debug
free:
name: "Free Heap"
- platform: debug
block:
name: "Heap Block"
- platform: debug
loop_time:
name: "Loop Time"
- platform: uptime
name: "Uptime"
- platform: homeassistant
id: indoor_temperature
entity_id: sensor.indoor_temperature
on_value:
then:
- lvgl.label.update:
id: indoor_temp_label
text: !lambda |-
char buf[10];
sprintf(buf, "%.1f°C", x);
return buf;
- platform: homeassistant
id: outdoor_temperature
entity_id: sensor.outdoor_temperature
on_value:
then:
- lvgl.label.update:
id: outdoor_temp_label
text: !lambda |-
char buf[10];
sprintf(buf, "%.1f°C", x);
return buf;
- platform: homeassistant
id: solar_radiation
entity_id: sensor.solar_radiation
on_value:
then:
- lvgl.label.update:
id: solar_radiation_label
text: !lambda |-
char buf[20];
sprintf(buf, "%.0f W/m2", x);
return buf;
# Energy meters - totals
- platform: homeassistant
id: energy_consumption_today
entity_id: sensor.energy_consumption_today
internal: true
on_value:
then:
- lvgl.label.update:
id: energy_consumption_label
text: !lambda |-
if (std::isnan(x)) x = 0.0f;
char buf[10];
sprintf(buf, "%.1fkWh", x);
return buf;
- platform: homeassistant
id: energy_production_today
entity_id: sensor.energy_production_today
internal: true
on_value:
then:
- lvgl.label.update:
id: energy_production_label
text: !lambda |-
if (std::isnan(x)) x = 0.0f;
char buf[10];
sprintf(buf, "%.1fkWh", x);
return buf;
# Net energy (positive = producing more, negative = consuming more)
- platform: template
id: daily_net_energy
name: "Daily Net Energy"
unit_of_measurement: "kWh"
device_class: energy
accuracy_decimals: 3
lambda: |-
float consumption = id(energy_consumption_today).state;
float production = id(energy_production_today).state;
if (std::isnan(consumption)) consumption = 0.0f;
if (std::isnan(production)) production = 0.0f;
return production - consumption;
update_interval: 60s
on_value:
then:
- lvgl.label.update:
id: energy_net_label
text: !lambda |-
if (std::isnan(x) || std::isinf(x)) {
return std::string("0.0");
}
char buf[20];
sprintf(buf, "%+.1f", x); // + shows sign always
return buf;
- lvgl.arc.update:
id: energy_meter
value: !lambda |-
// Map -10 to +10 kWh range to 0-100 for arc
// -10 kWh (verbruik) = 0% (links), 0 kWh (balans) = 50% (midden), +10 kWh (productie) = 100% (rechts)
if (std::isnan(x) || std::isinf(x)) {
return 50;
}
float val = x;
if (val < -10) val = -10;
if (val > 10) val = 10;
return (int)((val + 10) * 5);
indicator:
arc_color: !lambda |-
// Red for negative (consuming), green for positive (producing)
if (x < -0.5) {
return lv_color_hex(0xFF3B30); // Red
} else if (x > 0.5) {
return lv_color_hex(0x34C759); // Green
} else {
return lv_color_hex(0x0A84FF); // Blue for near-zero
}
- platform: homeassistant
id: zonnescherm_position
entity_id: cover.zonnescherm_met_positie
attribute: current_position
on_value:
then:
- lvgl.slider.update:
id: zonnescherm_slider
value: !lambda 'return x;'
- lvgl.label.update:
id: zonnescherm_status
text: !lambda |-
char buf[10];
sprintf(buf, "%.0f%%", x);
return buf;
- platform: homeassistant
id: screen_voor_position
entity_id: cover.screen_voor_met_positie
attribute: current_position
on_value:
then:
- lvgl.slider.update:
id: screen_voor_slider
value: !lambda 'return x;'
- lvgl.label.update:
id: screen_voor_status
text: !lambda |-
char buf[10];
sprintf(buf, "%.0f%%", x);
return buf;
- platform: homeassistant
id: screen_achter_position
entity_id: cover.screen_achter_met_positie
attribute: current_position
on_value:
then:
- lvgl.slider.update:
id: screen_achter_slider
value: !lambda 'return x;'
- lvgl.label.update:
id: screen_achter_status
text: !lambda |-
char buf[10];
sprintf(buf, "%.0f%%", x);
return buf;
- platform: homeassistant
id: screen_badkamer_position
entity_id: cover.screen_badkamer_met_positie
attribute: current_position
on_value:
then:
- lvgl.slider.update:
id: screen_badkamer_slider
value: !lambda 'return x;'
- lvgl.label.update:
id: screen_badkamer_status
text: !lambda |-
char buf[10];
sprintf(buf, "%.0f%%", x);
return buf;
text_sensor:
- platform: template
name: "Reset Reason"
lambda: |-
switch (esp_reset_reason()) {
case ESP_RST_POWERON: return std::string("POWERON");
case ESP_RST_EXT: return std::string("EXT_RESET");
case ESP_RST_SW: return std::string("SOFTWARE");
case ESP_RST_PANIC: return std::string("PANIC");
case ESP_RST_INT_WDT: return std::string("INT_WDT");
case ESP_RST_TASK_WDT: return std::string("TASK_WDT");
case ESP_RST_WDT: return std::string("WDT");
case ESP_RST_DEEPSLEEP: return std::string("DEEPSLEEP");
case ESP_RST_BROWNOUT: return std::string("BROWNOUT");
case ESP_RST_SDIO: return std::string("SDIO");
default: return std::string("UNKNOWN");
}
- platform: homeassistant
id: thermostaat_mode
entity_id: input_select.thermostaat_mode
on_value:
then:
- lvgl.dropdown.update:
id: thermostat_dropdown
selected_text: !lambda return x.c_str();
binary_sensor:
- platform: homeassistant
id: thuiswerken_status
entity_id: input_boolean.thuiswerken
on_state:
then:
- if:
condition:
binary_sensor.is_on: thuiswerken_status
then:
- lvgl.widget.update:
id: shortcut_thuiswerken
bg_color: 0x34C759
else:
- lvgl.widget.update:
id: shortcut_thuiswerken
bg_color: ha_bg_card
- platform: homeassistant
id: henry_waiting
entity_id: input_boolean.stofzuiger_wacht_op_input
on_state:
then:
- if:
condition:
binary_sensor.is_on: henry_waiting
then:
- light.turn_on: backlight
- lvgl.resume:
- lvgl.widget.show: henry_modal_overlay
else:
- lvgl.widget.hide: henry_modal_overlay
number:
- platform: template
name: Screen Timeout
optimistic: true
id: display_timeout
unit_of_measurement: "s"
initial_value: 20
restore_value: true
min_value: 5
max_value: 60
step: 5
mode: box
on_value:
- lvgl.slider.update:
id: timeout_slider
value: !lambda return x;
- lvgl.label.update:
id: timeout_value_label
text: !lambda |-
char buf[16];
snprintf(buf, sizeof(buf), "%.0fs", x);
return buf;
- platform: template
name: Screen Brightness
optimistic: true
id: display_brightness
unit_of_measurement: "%"
initial_value: 50
restore_value: true
min_value: 10
max_value: 100
step: 5
mode: box
on_value:
- light.turn_on:
id: backlight
brightness: !lambda return x / 100.0;
- lvgl.slider.update:
id: brightness_slider
value: !lambda return x;
- lvgl.label.update:
id: brightness_value_label
text: !lambda |-
char buf[16];
snprintf(buf, sizeof(buf), "%.0f%%", x);
return buf;
switch:
- platform: template
name: Screen Timeout Enabled
id: screen_timeout_enabled
optimistic: true
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lvgl.widget.update:
id: lvgl_screen_timeout_switch
state:
checked: true
on_turn_off:
- lvgl.widget.update:
id: lvgl_screen_timeout_switch
state:
checked: false
button:
- platform: restart
id: restart_button
name: "Restart"
# -------------------------------
# Fonts
# -------------------------------
font:
- file: "gfonts://Roboto"
id: roboto_20
size: 20
glyphs: "!\"%()+=-,_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz'/&@#?"
- file: "gfonts://Roboto"
id: roboto_16
size: 16
glyphs: "!\"%()+=-,_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz'/&@#?"
- file: "gfonts://Roboto"
id: roboto_14
size: 14
glyphs: "!\"%()+=-,_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz'/&@#?"
# -------------------------------
# LVGL Display
# -------------------------------
display:
- platform: mipi_dsi
model: JC1060P470
id: my_lcd
auto_clear_enabled: false # Required for LVGL - LVGL manages rendering
update_interval: never # was 33ms
reset_pin:
number: GPIO5 # was 27
dimensions:
width: 1024
height: 600
# new:
hsync_pulse_width: 20
i2c:
- id: i2c_bus
sda: GPIO7
scl: GPIO8
#scan: true
frequency: 400kHz
touchscreen:
- platform: gt911
interrupt_pin: GPIO21
update_interval: never
#calibration:
# x_min: 0
# x_max: 1024
# y_min: 0
# y_max: 800
id: my_touchscreen
on_release:
- if:
condition: lvgl.is_paused
then:
- logger.log: "Screen resuming"
- lvgl.resume:
- lvgl.widget.redraw:
- light.turn_on: backlight
esp_ldo:
- voltage: 2.5V
channel: 3
light:
- platform: monochromatic
output: backlight_pwm
id: backlight
name: LCD Backlight
icon: mdi:wall-sconce-flat-outline
restore_mode: RESTORE_DEFAULT_ON
on_turn_on:
- lvgl.resume:
output:
- platform: ledc
pin: GPIO23
id: backlight_pwm
frequency: 1000Hz
# --- LVGL (Home Assistant Dark Theme) ---
lvgl:
buffer_size: 50% # Use internal RAM to prevent blank screen issues (PSRAM timing problems)
byte_order: little_endian
on_idle:
timeout: !lambda "return (id(display_timeout).state * 1000);"
then:
- if:
condition:
switch.is_on: screen_timeout_enabled
then:
- logger.log: "LVGL is idle - turning off screen"
- light.turn_off: backlight
- lvgl.pause:
else:
- logger.log: "LVGL is idle but timeout is disabled"
displays:
- my_lcd
touchscreens:
- my_touchscreen
# Apply Home Assistant dark theme globally
theme:
obj:
bg_opa: TRANSP
border_width: 0
pages:
- id: coverpage
bg_color: ha_bg_primary
widgets:
# ==================== HEADER SECTION (50px) ====================
# Date and time display (secret button to settings)
- button:
id: header_datetime_btn
x: 20
y: 10
width: 320
height: 40
bg_opa: TRANSP
border_width: 0
shadow_width: 0
widgets:
- label:
id: header_datetime
text: "Vrijdag 14 november 2025 - 17:09"
text_color: ha_text_primary
text_font: roboto_20
align: LEFT_MID
x: 5
on_press:
- logger.log: "Opening settings page"
- lvgl.page.show: page_settings
# Energy price chart (right-aligned, 2 cards width = 648px)
# Position: 1024 - 648 - 20 (margin) = 356
- button:
id: energieprijzen_btn
x: 356
y: 0
width: 648
height: 50
align: TOP_LEFT
bg_opa: TRANSP
border_width: 0
shadow_width: 0
pad_all: 0
on_press:
- lvgl.page.show: page_energiegrafiek
widgets:
- image:
id: energieprijzen_widget
src: energieprijzen_image
align: TOP_LEFT
# ==================== MAIN CARDS / WIDGETS SECTION (500px) ====================
# Row 1 - Y: 70 - Climate, Cameras, Agenda (20px margin from header)
# Card 1: Climate
- obj:
id: card_climate
x: 20
y: 70
width: 314
height: 220
bg_color: ha_bg_card
radius: 12
border_width: 0
scrollbar_mode: "off"
widgets:
# Indoor temperature tile
- obj:
id: indoor_tile
x: 10
y: 10
width: 142
height: 70
bg_color: 0x3D1F1F
radius: 8
border_width: 0
scrollbar_mode: "off"
widgets:
- image:
src: thermometer_hot
x: 8
y: 8
image_recolor: 0xFF6B6B
image_recolor_opa: COVER
- label:
text: "Binnen"
x: 8
y: 38
text_color: 0xFF6B6B
text_font: roboto_14
- label:
id: indoor_temp_label
text: "--°C"
align: TOP_RIGHT
x: -8
y: 8
text_color: 0xFF6B6B
text_font: roboto_20
# Outdoor temperature tile
- obj:
id: outdoor_tile
x: 162
y: 10
width: 142
height: 70
bg_color: 0x1F2D3D
radius: 8
border_width: 0
scrollbar_mode: "off"
widgets:
- image:
src: thermometer_cold
x: 8
y: 8
image_recolor: 0x6BB6FF
image_recolor_opa: COVER
- label:
text: "Buiten"
x: 8
y: 38
text_color: 0x6BB6FF
text_font: roboto_14
- label:
id: outdoor_temp_label
text: "--°C"
align: TOP_RIGHT
x: -8
y: 8
text_color: 0x6BB6FF
text_font: roboto_20
# Thermostat mode label
- label:
text: "Thermostat Mode"
x: 10