-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhadisplay-v1-1.yaml
More file actions
1343 lines (1284 loc) · 37.1 KB
/
Copy pathhadisplay-v1-1.yaml
File metadata and controls
1343 lines (1284 loc) · 37.1 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
#-------------------------------------------
# based on
# https://github.com/iamfaraz/Waveshare_ST7262_ESPHome_LVGL
#-------------------------------------------
substitutions:
name: hadisplay-v1-1
friendly_name: "Home Assistant Display"
device_description: "Smart Dashboard Waveshare ESP32-S3-Touch-LCD-7"
desk_lamp: "\U000F095F"
lightbulb: "\U000F0335"
ceiling_light: "\U000F0769"
lamp: "\U000F06B5"
floor_lamp: "\U000F08DD"
string_lights: "\U000F12BA"
clock: "\U000F0150"
ceiling_fan: "\U000F1797"
light_recessed: "\U000F179B"
blinds_horizontal: "\U000F1A2B"
blinds_horizontal_closed: "\U000F1A2C"
curtains_closed: "\U000F1847"
curtains: "\U000F1846"
wallsconce: "\U000F091C"
bed: "\U000F02E3"
bed_empty: "\U000F08A0"
thermometer_high: "\U000F10C2"
humidity: "\U000F058E"
wallsconce_variant: "\U000F091E"
kiss: "\U000F0C73"
hvac: "\U000F0D43"
pump_icon: "\U000F058F"
homeicon: "\U000F02DC"
lefticon: "\U000F0141"
righticon: "\U000F0142"
esphome:
name: ${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: 8MB
esp32:
board: esp32-s3-devkitc-1
variant: esp32s3
flash_size: 8MB
framework:
type: esp-idf
sdkconfig_options:
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: y
CONFIG_ESP32S3_DATA_CACHE_64KB: y
CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
CONFIG_SPIRAM_RODATA: y
CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y
psram:
mode: octal
speed: 80MHz
# Enable logging
logger:
level: DEBUG
hardware_uart: UART0
# Enable Home Assistant API
api:
encryption:
key: !secret enc_key
ota:
- platform: esphome
password: !secret ota_pass
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# manual_ip:
# # # Set this to the IP of the ESP
# static_ip: 192.168.1.138
# # # Set this to the IP address of the router. Often ends with .1
# gateway: 192.168.1.1
# # # The subnet of the network. 255.255.255.0 works for most home networks.
# subnet: 255.255.255.0
# dns1: 192.168.1.1
# # Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "HADisplay Fallback Hotspot"
password: !secret wifi_rcvr
web_server:
port: 80
################################################
#-------------------------------------------
# External comonents no more used
#-------------------------------------------
#external_components:
# - source: github://pr#7427
# components: [lvgl]
# CH422G I/O Expander
# https://github.com/esphome/esphome/pull/7356
# - source: github://pr#7356
# components: [ch422g]
# rpi_dpi_rgb
# https://github.com/esphome/esphome/pull/7383
# - source: github://pr#7383
# components: [rpi_dpi_rgb]
################################################
#-------------------------------------------
# I2C do NOT disable!
#-------------------------------------------
i2c:
- id: bus_a
sda: GPIO8
scl: GPIO9
scan: true
#-------------------------------------------
# CANBUS part1 (UART2/USB pins)
#-------------------------------------------
canbus:
- platform: esp32_can
tx_pin: GPIO20
rx_pin: GPIO19
can_id: 4
bit_rate: 50kbps
#-------------------------------------------
# RS485 (UART1 remaped pins)
#-------------------------------------------
uart:
- id: uart_rs485
tx_pin: GPIO16
rx_pin: GPIO15
baud_rate: 115200
#-------------------------------------------
# timeservers pool and TZ for Poland
#-------------------------------------------
time:
- platform: sntp
timezone: Europe/Warsaw
servers:
- 0.pl.pool.ntp.org
- 1.pl.pool.ntp.org
- 2.pl.pool.ntp.org
id: sntp_time
on_time_sync:
then:
- script.execute: lv_time_update
on_time:
- seconds: 0
minutes: "*"
then:
- script.execute: lv_time_update
script:
#-------------------------------------------
# time display in 24h format
#-------------------------------------------
- id: lv_time_update
then:
- lvgl.label.update:
id: display_time
text: !lambda |-
static char time_buf[17];
auto now = id(sntp_time).now();
snprintf(time_buf, sizeof(time_buf), "%02d:%02d", now.hour, now.minute);
return time_buf;
font:
#-------------------------------------------
# glyphs for MDI icons
#-------------------------------------------
- file:
type: gfonts
family: Roboto
id: roboto24
size: 24
bpp: 4
extras:
- file: "fonts/materialdesignicons-webfont.ttf" # http://materialdesignicons.com/cdn/7.4.47/
glyphs: [
"\U000F004B",
"\U000F006E",
"\U000F012C",
"\U000F179B",
"\U000F0748",
"\U000F1A1B",
"\U000F02DC",
"\U000F0A02",
"\U000F035F",
"\U000F0156",
"\U000F0C5F",
"\U000f0084",
"\U000f0091",
"\U000F058E",
"\U000F10C3",
"\U000F03F0", # mdi-percent
"\U000F0504", # mdi- celcius
"\U000F091E",
"\U000F0140", # mdi-arrow_down
"\U000F0141", # mdi-arrow_left
"\U000F0142", # mdi-arrow_right
"\U000F0143", # mdi-arrow_up
]
- file: "fonts/materialdesignicons-webfont.ttf" # http://materialdesignicons.com/cdn/7.4.47/
id: weather70
size: 70
bpp: 4
glyphs: &mdi-weather-glyphs
- "\U000F0590" # mdi-weather-cloudy
- "\U000F0F2F" # mdi-weather-cloudy-alert
- "\U000F0E6E" # mdi-weather-cloudy-arrow-right
- "\U000F0591" # mdi-weather-fog
- "\U000F0592" # mdi-weather-hail
- "\U000F0F30" # mdi-weather-hazy
- "\U000F0898" # mdi-weather-hurricane
- "\U000F0593" # mdi-weather-lightning
- "\U000F067E" # mdi-weather-lightning-rainy
- "\U000F0594" # mdi-weather-clear-night
- "\U000F0F31" # mdi-weather-night-partly-cloudy
- "\U000F0595" # mdi-weather-partly-cloudy
- "\U000F0F32" # mdi-weather-partly-lightning
- "\U000F0F33" # mdi-weather-partly-rainy
- "\U000F0F34" # mdi-weather-partly-snowy
- "\U000F0F35" # mdi-weather-partly-snowy-rainy
- "\U000F0596" # mdi-weather-pouring
- "\U000F0597" # mdi-weather-rainy
- "\U000F0598" # mdi-weather-snowy
- "\U000F0F36" # mdi-weather-snowy-heavy
- "\U000F067F" # mdi-weather-snowy-rainy
- "\U000F0599" # mdi-weather-sunny
- "\U000F0F37" # mdi-weather-sunny-alert
- "\U000F14E4" # mdi-weather-sunny-off
- "\U000F059A" # mdi-weather-sunset
- "\U000F059B" # mdi-weather-sunset-down
- "\U000F059C" # mdi-weather-sunset-up
- "\U000F0F38" # mdi-weather-tornado
- "\U000F059D" # mdi-weather-windy
- "\U000F059E" # mdi-weather-windy-variant
- file: "fonts/materialdesignicons-webfont.ttf" # http://materialdesignicons.com/cdn/7.4.47/
id: light32
size: 32
bpp: 4
glyphs: [
"\U000F0335", # mdi-lightbulb
"\U000F095F", # mdi-desk-lamp
"\U000F0769", # mdi-ceiling-light
"\U000F08DD", # mdi-floor-lamp
"\U000F12BA", # mdi-string-lights
"\U000F0150", # mdi-clock
"\U000F1797", # mdi-ceiling_fan
"\U000F179B", # mdi-light_recessed
"\U000F1A2B", # mdi-blinds_horizontal
"\U000F1A2C", # mdi-blinds_horizontal_closed
"\U000F1847", # mdi-curtains_closed
"\U000F1846", # mdi-curtains
"\U000F091C", # mdi-wallsconce
"\U000F02E3", # mdi-bed
"\U000F08A0", # mdi-bed_empty
"\U000F10C2", # mdi-thermometer_high
"\U000F058E", # mdi-humidity
"\U000F091E", # mdi-wallsconce_variant
"\U000F0C73", # mdi-kiss
"\U000F0D43", # mdi- hvac
"\U000F058F", # mdi-water_pump
]
- file: "gfonts://Roboto"
id: roboto55
size: 55
extras:
- file: "fonts/materialdesignicons-webfont.ttf" # http://materialdesignicons.com/cdn/7.4.47/
glyphs: [
"\U000F004B",
"\U000F006E",
"\U000F012C",
"\U000F179B",
"\U000F0748",
"\U000F1A1B",
"\U000F02DC",
"\U000F0A02",
"\U000F035F",
"\U000F0156",
"\U000F0C5F",
"\U000f0084",
"\U000f0091",
"\U000F058E",
"\U000F10C3",
"\U000F03F0", # mdi-percent
"\U000F0504", # mdi- celcius
"\U000F091E",
"\U000F0140", # mdi-arrow_down
"\U000F0141", # mdi-arrow_left
"\U000F0142", # mdi-arrow_right
"\U000F0143", # mdi-arrow_up
]
- file: "gfonts://Roboto"
id: roboto10
size: 10
bpp: 4
#-------------------------------------------
# glyphs for polish character set
#-------------------------------------------
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: "gfonts://Roboto"
id: roboto22
size: 22
bpp: 4
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:
type: gfonts
family: Roboto
weight: 900
id: roboto90
size: 90
bpp: 4
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:
type: gfonts
family: Roboto
weight: 900
id: roboto55bold
bpp: 4
size: 55
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:
type: gfonts
family: Roboto
weight: 900
id: roboto40bold
size: 40
- file: "gfonts://Roboto"
bpp: 4
id: roboto40
size: 40
- file:
type: gfonts
family: Roboto
weight: 900
id: roboto30bold
bpp: 4
size: 30
- file: "gfonts://Roboto"
id: roboto30
bpp: 4
size: 30
image:
# - file: "images/800x480/ha_logo2_800x480.png" # image may be copyrighted
# id: logodisp_bg
# resize: 800x480
# type: RGB565
# - file: "images/800x480/plants.png"
- file: "images/800x480/acacia.png"
id: disp_bg
# resize: 800x480
type: RGB565
transparency: opaque
#-------------------------------------------
# CH422G GPIO-expander hub
# NO addres configurable!
# uses 24 adresses 0x20-0x27 and 0x30-0x3f
#-------------------------------------------
ch422g:
- id: io_ex
switch:
#-------------------------------------------
# backlight switch (on/off) external GPIO
# Toggles backlight of Waveshare ESP32-S3-Touch-LCD-4.3
#-------------------------------------------
- platform: gpio
id: backlight_switch
name: "Backlight Toggle"
pin:
ch422g: io_ex
number: 2
allow_other_uses: true
# CH422G saves the last state internally, but gpio switch sets state as off except when using RESTORE_ modes
restore_mode: ALWAYS_ON
on_turn_on:
- lvgl.resume:
- lvgl.widget.redraw:
- logger.log: "Backlight Switch Turned On!"
on_turn_off:
- lvgl.pause:
- logger.log: "Backlight Switch Turned Off!"
#-------------------------------------------
# CANBUS part2 enable switch=disable USB debug
#-------------------------------------------
- platform: gpio
id: canbus_switch
name: "canbus enable"
pin:
ch422g: io_ex
number: 5
mode:
output: true
inverted: false
allow_other_uses: false
# CH422G saves the last state internally, but gpio switch sets state as off except when using RESTORE_ modes
restore_mode: ALWAYS_ON
# deep_sleep:
# run_duration:
# default: 30s
# touch_wakeup_reason: 30s
# touch_wakeup: True
# sleep_duration: 10min
touchscreen:
platform: gt911
# address: 0x5D # 7bit adress 0x5D = 8bit 0xBA write and 0xBB read, max freq i2c 400 kHz
id: my_touchscreen
update_interval: 16ms
interrupt_pin: GPIO4
reset_pin:
ch422g: io_ex
number: 1
on_touch:
- lambda: |-
ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
touch.x,
touch.y,
touch.x_raw,
touch.y_raw
);
on_release:
- if:
condition: lvgl.is_paused
then:
- logger.log: "LVGL resuming"
- lvgl.resume:
- lvgl.widget.redraw:
- switch.turn_on: backlight_switch
display:
- platform: rpi_dpi_rgb
id: my_display
#rotation: 90
auto_clear_enabled: false
update_interval: never
color_order: RGB
pclk_frequency: 14MHz
dimensions:
width: 800
height: 480
de_pin:
number: 5
reset_pin:
ch422g: io_ex
number: 3
enable_pin:
ch422g: io_ex
number: 2
allow_other_uses: true
hsync_pin:
number: 46
ignore_strapping_warning: true
vsync_pin:
number: 3
ignore_strapping_warning: true
pclk_pin: 7
pclk_inverted: false
hsync_back_porch: 10
hsync_front_porch: 20
hsync_pulse_width: 10
vsync_back_porch: 10
vsync_front_porch: 10
vsync_pulse_width: 10
data_pins:
red:
- 1 # R3
- 2 # R4
- 42 # R5
- 41 # R6
- 40 # R7
green:
- 39 # G2
- 0 # G3
- 45 # G4
- 48 # G5
- 47 # G6
- 21 # G7
blue:
- 14 # B3
- 38 # B4
- 18 # B5
- 17 # B6
- 10 # B7
sensor:
#-------------------------------------------
# ADC IN
#-------------------------------------------
- platform: adc
pin: GPIO6
name: "ADC IN"
update_interval: 60s
attenuation: auto
#-------------------------------------------
# Home Assistant Sensors
#-------------------------------------------
- platform: homeassistant
entity_id: weather.openweathermap
attribute: temperature
id: outdoor_temp
on_value:
- lvgl.label.update:
id: weather_label
text:
format: "%.1f\U000F0504"
args: ["x"]
- platform: homeassistant
entity_id: weather.openweathermap
attribute: humidity
id: outdoor_humi
on_value:
- lvgl.label.update:
id: weather_humidity_label
text:
format: "%.0f\U000F03F0"
args: ["x"]
- platform: homeassistant
entity_id: sensor.atc_a7df_temperature
id: salon_temp
on_value:
- lvgl.label.update:
id: temp_text
text:
format: "\U000F10C3 %.1f\U000F0504"
args: ["x"]
- platform: homeassistant
entity_id: sensor.atc_a7df_humidity
id: salon_humi
on_value:
- lvgl.label.update:
id: humidity_text
text:
format: "\U000F058E %.0f\U000F03F0"
args: ["x"]
- platform: homeassistant
entity_id: sensor.current_load
id: current_load
on_value:
- lvgl.label.update:
id: current_load_text
text:
format: "%.0fW"
args: ["x"]
- platform: homeassistant
entity_id: sensor.grid_meter_phase_a_power_2
id: grid_power
on_value:
- lvgl.label.update:
id: grid_power_text
text:
format: "%.3fkW"
args: ["x"]
- platform: homeassistant
entity_id: sensor.solar_inverter_pv_output_power
id: pv_power
on_value:
- lvgl.label.update:
id: pv_power_text
text:
format: "%.0fW"
args: ["x"]
- platform: homeassistant
entity_id: sensor.max_pv_power
id: max_pv_power
on_value:
- lvgl.label.update:
id: max_pv_power_text
text:
format: "%.0fW"
args: ["x"]
# - platform: homeassistant
# entity_id: sensor.solar_inverter_battery_capacity
# id: battery_capacity
# on_value:
# - lvgl.label.update:
# id: battery_capacity_text
- platform: homeassistant
entity_id: sensor.pv_daily_production
id: pv_units_today
on_value:
- lvgl.label.update:
id: pv_units_today_text
text:
format: "%.1fkWh"
args: ["x"]
- platform: homeassistant
entity_id: sensor.grid_reverse_meter
id: grid_sold
on_value:
- lvgl.label.update:
id: grid_sold_text
text:
format: "%.1fkWh"
args: ["x"]
- platform: homeassistant
entity_id: sensor.grid_forward_meter
id: grid_bought
on_value:
- lvgl.label.update:
id: grid_bought_text
text:
format: "%.1fkWh"
args: ["x"]
- platform: homeassistant
entity_id: sensor.daily_home_energy
id: total_unit_consumed
on_value:
- lvgl.label.update:
id: total_unit_consumed_text
text:
format: "%.1fkWh"
args: ["x"]
- platform: wifi_signal
name: "WiFi Signal"
id: wifi_signal_db
update_interval: 60s
entity_category: diagnostic
internal: true
- platform: copy
source_id: wifi_signal_db
name: "WiFi Strength"
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "%"
entity_category: diagnostic
text_sensor:
- platform: template
name: "Time"
id: time_text
update_interval: 20s
lambda: |-
static char time_buf[17];
auto now = id(sntp_time).now();
bool is_pm = now.hour >= 12;
snprintf(time_buf, sizeof(time_buf), "%02d:%02d", now.hour, now.minute);
return {time_buf};
- platform: wifi_info
ip_address:
name: "IP Address"
entity_category: diagnostic
ssid:
name: "Connected SSID"
entity_category: diagnostic
mac_address:
name: "Mac Address"
entity_category: diagnostic
number:
- platform: template
name: LVGL Screen timeout
optimistic: true
id: display_timeout
unit_of_measurement: "s"
initial_value: 45
restore_value: true
min_value: 10
max_value: 180
step: 5
mode: box
binary_sensor:
# - platform: esp32_touch
# id: my_touchscreen
- platform: homeassistant
id: kitchen_light
entity_id: light.kuchnia
publish_initial_state: true
on_state:
then:
lvgl.widget.update:
id: lv_button_1
state:
checked: !lambda return x;
- platform: homeassistant
id: living_room_light
entity_id: light.salon_tv
publish_initial_state: true
on_state:
then:
lvgl.widget.update:
id: lv_button_2
state:
checked: !lambda return x;
- platform: homeassistant
id: desk_lamp_switch
entity_id: light.lampka_biurkowa_biala
publish_initial_state: true
on_state:
then:
lvgl.widget.update:
id: lv_desk_lamp_btn
state:
checked: !lambda return x;
- platform: homeassistant
id: frontyard_light_switch
entity_id: switch.frontyard_light_switch_1_2
publish_initial_state: true
on_state:
then:
lvgl.widget.update:
id: lv_frontyard_light_btn
state:
checked: !lambda return x;
- platform: homeassistant
id: water_pump_switch
entity_id: switch.water_pump_switch_1
publish_initial_state: true
on_state:
then:
lvgl.widget.update:
id: lv_button_3
state:
checked: !lambda return x;
color:
- id: text_color
hex: FFFFFF
- id: light_red
hex: FF3340
- id: red
hex: FF0000
- id: white
hex: FFFFFF
- id: light_blue
hex: 009EFF
- id: grey
hex: 989898
- id: light_green
hex: A8F698
- id: orange
hex: CC5E14
- id: green
hex: 2CAE65
- id: blue
hex: 3792CB
- id: dark_blue
hex: 0000FF
#-------------------------------------------
# lvgl Buttons
#-------------------------------------------
lvgl:
touchscreens:
- touchscreen_id: my_touchscreen
on_idle:
timeout: !lambda "return (id(display_timeout).state * 1000);"
then:
- logger.log: "LVGL is idle"
- switch.turn_off: backlight_switch
- lvgl.pause:
color_depth: 16
#disp_bg_image: logodisp_bg
disp_bg_image: disp_bg
page_wrap: true
bg_opa: TRANSP
style_definitions:
- id: style_line
line_color: 0x0000FF
line_width: 8
line_rounded: true
- id: date_style
text_font: roboto24
align: center
text_color: 0x333333
bg_opa: cover
radius: 4
pad_all: 2
####Header_Footer##########
- id: header_footer
bg_color: 0x1b1b1b
bg_grad_color: 0x1b1b1b
bg_grad_dir: VER
bg_opa: COVER
border_width: 0
radius: 0
pad_all: 0
pad_row: 0
pad_column: 0
border_color: 0x0077b3
text_color: 0xFFFFFF
width: 100%
height: 40
theme:
buttonmatrix:
bg_opa: TRANSP
# border_color: 0x0077b3
# border_width: 0
text_color: 0xFFFFFF
pad_all: 0
items: # set all your buttonmatrix buttons to use your custom defined styles and font
bg_color: 0x1b1b1b
bg_grad_color: 0x1b1b1b
bg_grad_dir: VER
bg_opa: COVER
# border_color: 0x0077b3
# border_width: 1
text_color: 0xFFFFFF
text_font: roboto24
pressed:
bg_color: 0xFF6700
bg_grad_color: 0xa6521b
checked:
bg_color: 0xFF6700
bg_grad_color: 0x03324A
text_color: 0x005580
button:
text_font: roboto24
scroll_on_focus: true
radius: 5
width: 100
height: 150
pad_left: 10px
pad_top: 10px
pad_bottom: 10px
pad_right: 10px
shadow_width: 0
bg_color: 0x000000
border_width: 3
border_color: white
border_side: ['TOP', 'BOTTOM', 'LEFT', 'RIGHT']
text_color: text_color
checked:
# bg_color: 0xCC5E14 # Orange
# bg_color: green # Green
# bg_color: 0x026a6e # Dark Green
#bg_color: 0x0000FF # Blue
bg_color: 0x3792CB # Blue
text_color: text_color
obj:
text_font: roboto24
scroll_on_focus: true
radius: 5
width: 400
height: 150
pad_left: 10px
pad_top: 10px
pad_bottom: 10px
pad_right: 10px
shadow_width: 0
bg_color: 0x000000
border_width: 3
border_color: white
border_side: ['TOP', 'BOTTOM', 'LEFT', 'RIGHT']
text_color: text_color
top_layer:
widgets:
- buttonmatrix:
align: bottom_mid
styles: header_footer
pad_all: 0
outline_width: 0
id: top_layer
items:
styles: header_footer
rows:
- buttons:
- id: page_prev
text: $lefticon
on_press:
then:
- lvgl.page.previous:
animation: MOVE_RIGHT
time: 100ms
- id: page_home
text: $homeicon
on_press:
then:
lvgl.page.show: main_page
- id: page_next
text: $righticon
on_press:
then:
- lvgl.page.next:
animation: MOVE_LEFT
time: 100ms
# - label:
# text_font: roboto24
# text: "- %"
# id: humidity_text
# align: top_right
# x: -20
# y: 7
# # text_align: right
# text_color: 0xFFFFFF
# - label:
# text_font: roboto24
# text: "-.-°C"
# id: temp_text
# align: top_left
# x: 12
# y: 7
# text_color: 0xFFFFFF
pages:
- id: main_page
layout:
type: grid
grid_row_align: CENTER
grid_column_align: CENTER
grid_rows: [150px, 150px]
grid_columns: [400px, 100px, 100px, 100px]
pad_row: 20px
pad_column: 20px
width: 100%
pad_all: 5
widgets:
- obj:
checkable: true
id: lv_clock_obj
grid_cell_row_pos: 0
grid_cell_column_pos: 0
width: 400
height: 150
pad_left: 10px
pad_top: 10px
pad_bottom: 10px
pad_right: 10px
widgets:
- label:
text_font: roboto90
text: "00:00"
id: display_time
align: center
text_align: 'CENTER'
text_color: 0xFFFFFF
- obj:
checkable: true
id: lv_weather_obj
grid_cell_row_pos: 1
grid_cell_column_pos: 0
layout: # enable the FLEX layout for the children widgets
type: FLEX
flex_flow: ROW # the order of the widgets starts top left
flex_align_main: CENTER