-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathesphome-480.yaml
2411 lines (2322 loc) · 79.6 KB
/
esphome-480.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
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:
name: "your-device-name" #소문자만
device_description: Your device description
light_1_name: "서재등" # 내부 스위치명
light_1_room: "서 재" # 내부 스위치 위치
light_2_name: "전체 전등" # HA 스위치명
light_2_room: "조 명" # HA 스위치 위치
light_switch_2: switch.light_switch_lb_right #HA 스위치 entity id
indoor_temp: sensor.smartmi_air_purifier_temperature # HA 실내 온도 센서 entity id
indoor_hum: sensor.smartmi_air_purifier_humidity # HA 실내 습도 센서 entity id
aircon_id: climate.eeokeon #HA 에어컨 entity id
latitude: "37" # 집의 위도
longitude: "126" # 집의 경도
weather_characters: " !#%'()+,-./0123456789:;<>?@ABCDEFGHIJKLMNOPQRSTUVWYZ[]_abcdefghijklmnopqrstuvwxyz{|}°²³µ맑음흐림대체로비뇌우안개폭호구름많동서남북알수없매좋높보통쾌적나쁨최악시내위험자외오존미세초먼지선월화목금토일풍데이터습도실온단양아조감건함주"
allowed_characters: " !#%'()+,-./0123456789:;<>?@ABCDEFGHIJKLMNOPQRSTUVWYZ[]_abcdefghijklmnopqrstuvwxyz{|}°²³µ실내외거서재주방다용도화장안베란우좌측전체에어컨가습창문생시볼륨로비간접보조블라인드현설버티컬온관중등냉고송명자수동난풍제꺼짐강약정기날씨디오메뉴너지소량사월당태양광발모일통계단남은필터취침켜공청닫힘열림면밝대절복귀"
title_characters: " !#%'()+,-./0123456789:;<>?@ABCDEFGHIJKLMNOPQRSTUVWYZ[]_abcdefghijklmnopqrstuvwxyz{|}오전후일월화수목금토"
esphome:
name: "${name}"
comment: "${device_description}"
platformio_options:
build_flags: "-DBOARD_HAS_PSRAM"
board_build.arduino.memory_type: qio_opi
board_build.flash_mode: dio
#board_upload.maximum_ram_size: 524288
on_boot:
then:
- light.turn_on:
id: backlight
brightness: !lambda return id(backlight_brightness).state / 100;
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
sdkconfig_options:
COMPILER_OPTIMIZATION_SIZE: y
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
CONFIG_SPIRAM_RODATA: y
flash_size: 16MB
partitions: "default_16MB.csv"
psram:
mode: octal
speed: 80MHz
# Enable logging
logger:
level: DEBUG
#baud_rate: 0
# Enable Home Assistant API
api:
encryption:
key: !secret api_key
on_client_connected:
- if:
condition:
lambda: 'return (0 == client_info.find("Home Assistant "));'
then:
- lvgl.widget.show: wifi_connected
- lvgl.widget.hide: wifi_disconnected
on_client_disconnected:
- if:
condition:
lambda: 'return (0 == client_info.find("Home Assistant "));'
then:
- lvgl.widget.hide: wifi_connected
- lvgl.widget.show: wifi_disconnected
ota:
- platform: esphome
password: !secret hotspot_pw
wifi:
id: iptime
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: HIGH
fast_connect: false
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${name} hotspot"
password: !secret hotspot_pw
captive_portal:
i2c:
scl: GPIO45
sda: GPIO19
scan: True
spi:
clk_pin: GPIO48
mosi_pin: GPIO47
#uart:
# tx_pin: GPIO43
#rx_pin: GPIO44
#baud_rate: 9600
light:
- platform: monochromatic
output: backlight_pwm
id: backlight
name: "${name} Back Light"
restore_mode: RESTORE_AND_ON
on_turn_on:
then:
- light.control:
id: backlight
brightness: !lambda return id(backlight_brightness).state / 100;
- lvgl.resume:
on_turn_off:
then:
- lvgl.pause:
- platform: binary
output: internal_relay
name: ${name} Light Switch
id: light_switch_1
restore_mode: RESTORE_DEFAULT_OFF
on_turn_on:
then:
- lvgl.widget.update:
id: light_switch_button_1
state:
checked: true
- lvgl.widget.update:
id: light_switch_button_checked
state:
checked: true
on_turn_off:
then:
- lvgl.widget.update:
id: light_switch_button_1
state:
checked: false
- lvgl.widget.update:
id: light_switch_button_checked
state:
checked: false
output:
- platform: ledc
id: backlight_pwm
pin: GPIO38
frequency: 1000Hz
min_power: 0.3
zero_means_zero: True
- platform: gpio
id: internal_relay
pin: 40
# LCD 디스플레이 설정
display:
- platform: st7701s
id: my_display
update_interval: never
auto_clear_enabled: false
data_rate: 2MHz
spi_mode: MODE3
color_order: RGB
invert_colors: false
dimensions:
width: 480
height: 480
cs_pin: 39
de_pin: 18
hsync_pin: 16
vsync_pin: 17
pclk_pin: 21
pclk_frequency: 12MHz
pclk_inverted: false
hsync_pulse_width: 8
hsync_front_porch: 10
hsync_back_porch: 20
vsync_pulse_width: 8
vsync_front_porch: 10
vsync_back_porch: 10
init_sequence:
- 1
# Custom sequences are an array, first byte is command, the rest are data.
- [0xFF, 0x77, 0x01, 0x00, 0x00, 0x10] # CMD2_BKSEL_BK0
- [0xCD, 0x00] # disable MDT flag
data_pins:
red:
- 11 # R1
- 12 # R2
- 13 # R3
- 14 # R4
- 0 # R5
green:
- 8 # G0
- 20 # G1
- 3 # G2
- 46 # G3
- 9 # G4
- 10 # G5
blue:
- 4 # B1
- 5 # B2
- 6 # B3
- 7 # B4
- 15 # B5
# 터치 스크린 설정
touchscreen:
platform: gt911
transform:
mirror_x: false
mirror_y: false
id: my_touchscreen
display: my_display
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
);
- if:
condition:
- light.is_off: backlight
then:
- light.turn_on:
id: backlight
brightness: !lambda return id(backlight_brightness).state / 100;
time:
- platform: homeassistant
id: time_comp
on_time_sync:
- script.execute: time_update
- script.execute: date_update
on_time:
- minutes: '*'
seconds: '0'
then:
- script.execute: time_update
- script.execute: date_update
sun:
id: sun_time
latitude: $latitude
longitude: $longitude
number:
- platform: template
name: "${name} Weather Return Time"
optimistic: true
id: return_timeout
unit_of_measurement: "s"
initial_value: 30
restore_value: true
min_value: 10
max_value: 300
step: 5
mode: box
- platform: template
name: "${name} LCD Screen Timeout"
optimistic: true
id: screen_timeout
unit_of_measurement: "s"
initial_value: 300
restore_value: true
min_value: 10
max_value: 300
step: 5
mode: box
- platform: template
name: "${name} BackLight Brightness"
optimistic: true
id: backlight_brightness
unit_of_measurement: "%"
initial_value: 50
restore_value: true
min_value: 5
max_value: 100
step: 5
mode: box
on_value:
then:
lvgl.slider.update:
id: slide_brightness
value: !lambda return x;
script:
# Time update
- id: time_update
then:
- lvgl.label.update:
id: title_time
text: !lambda |-
static char time_buf[17];
auto now = id(time_comp).now();
bool is_pm = now.hour >= 12;
int hour_12 = now.hour % 12;
if (hour_12 == 0) {
hour_12 = 12; // 12 AM/PM should be displayed as 12, not 0
}
snprintf(time_buf, sizeof(time_buf), "%s %2d:%02d", is_pm ? "오후" : "오전", hour_12, now.minute );
return time_buf;
- id: date_update
then:
- lvgl.label.update:
id: title_date
text: !lambda |-
static char date_buf[30];
auto now = id(time_comp).now();
const char* weekdays[] = {"일", "월", "화", "수", "목", "금", "토"};
snprintf(date_buf, sizeof(date_buf), "%04d-%02d-%02d (%s)", now.year, now.month, now.day_of_month, weekdays[now.day_of_week - 1]);
return date_buf;
- id: light_up
then:
- if:
condition:
light.is_off: backlight
then:
- light.turn_on:
id: backlight
brightness: !lambda return id(backlight_brightness).state / 100;
image:
#날씨 아이콘
- file: "weather/sunny.png"
id: sunny
type: RGB565
resize: 150x150
use_transparency: true
- file: "weather/cloudy.png"
id: cloudy
type: RGB565
resize: 150x150
use_transparency: true
- file: "weather/clearnight.png"
id: clearnight
type: RGB565
resize: 150x150
use_transparency: true
- file: "weather/hail.png"
id: hail
type: RGB565
resize: 150x150
use_transparency: true
- file: "weather/lightning.png"
id: lightning
type: RGB565
resize: 150x150
use_transparency: true
- file: "weather/nightpartlycloud.png"
id: nightpartlycloud
type: RGB565
resize: 150x150
use_transparency: true
- file: "weather/partlycloud.png"
id: partlycloud
type: RGB565
resize: 150x150
use_transparency: true
- file: "weather/scloudy.png"
id: scloud
type: RGB565
resize: 150x150
use_transparency: true
- file: "weather/pouring.png"
id: pouring
type: RGB565
resize: 150x150
use_transparency: true
- file: "weather/rainy.png"
id: rainy
type: RGB565
resize: 150x150
use_transparency: true
- file: "weather/snowy.png"
id: snowy
type: RGB565
resize: 150x150
use_transparency: true
- file: "weather/windy.png"
id: windy
type: RGB565
resize: 150x150
use_transparency: true
# 폰트 설정
font:
- file: "fonts/Roboto-Regular.woff"
id: regular_20
size: 20
bpp: 4
glyphs: ${allowed_characters}
- file: "fonts/Roboto-Bold.woff"
id: regular_25
size: 25
bpp: 4
glyphs: ${allowed_characters}
extras:
- file: 'fonts/materialdesignicons-webfont.ttf' # http://materialdesignicons.com/cdn/7.4.47/
glyphs: [
"\U000F0769", # mdi:ceiling-light
"\U000F18DD", # mdi:ceiling-light-multiple
"\U000F179B", # mdi:light-recessed
"\U000F141E", # mdi:dome-light
"\U000F1054", # mdi:outdoor-lamp
"\U000F1356" # mdi:television-ambient-light
]
- file: "fonts/Roboto-Bold.woff"
id: regular_40
size: 40
bpp: 4
glyphs: ${allowed_characters}
extras:
- file: 'fonts/materialdesignicons-webfont.ttf' # http://materialdesignicons.com/cdn/7.4.47/
glyphs: [
"\U000F040A", # mdi:play
"\U000F03E4", # mdi:pause
"\U000F04DB", # mdi:stop
"\U000F057E", # mdi:volume-high
"\U000F0581", # mdi:volume-off
"\U000F0143", # mdi:chevron-up
"\U000F0140", # mdi:chevron-down
"\U000F1A2E", # mdi:blinds-vertical-closed
"\U000F1A2D", # mdi:blinds-vertical
"\U000F084E", # mdi:arrow-expand-horizontal
"\U000F084C" # mdi:arrow-collapse-horizontal
]
- file: "fonts/Roboto-Regular.woff"
id: weather_60
size: 60
bpp: 4
glyphs: ${weather_characters}
- file: "fonts/Roboto-Regular.woff"
id: weather_40
size: 35
bpp: 4
glyphs: ${weather_characters}
- file: "fonts/Roboto-Regular.woff"
id: weather_30
size: 30
bpp: 4
glyphs: ${weather_characters}
- file: "fonts/Roboto-Regular.woff"
id: weather_20
size: 23
bpp: 4
glyphs: ${weather_characters}
extras:
- file: 'fonts/materialdesignicons-webfont.ttf' # http://materialdesignicons.com/cdn/7.4.47/
glyphs: [
"\U000F0143", # mdi:chevron-up
"\U000F0140", # mdi:chevron-down
"\U000F059C", # mdi:weather-sunset-up
"\U000F059B", # mdi:weather-sunset-down
"\U000F054A", # mdi:umbrella
"\U000F17FF", # mdi:sun-wireless-outline
"\U000F0C16", # mdi:alpha-o-circle
"\U000F00B5", # mdi:blur
"\U000F00B6" # mdi:blur-linear
]
- file: "fonts/Roboto-Regular.woff"
id: title_font
size: 18
bpp: 4
glyphs: ${title_characters}
extras:
- file: 'fonts/materialdesignicons-webfont.ttf' # http://materialdesignicons.com/cdn/7.4.47/
glyphs: [
"\U000F05A9", # mdi:wifi
"\U000F16C5", # mdi:wifi-remove
"\U000F1A73", # mdi:solar-power-variant
"\U000F192C" # mdi:transmission-tower-export
]
- file: "fonts/materialdesignicons-webfont.ttf"
id: icon_font_90
size: 90
bpp: 4
glyphs: [
"\U000F0595", # mdi:weather-partly-cloudy
"\U000F0335", # mdi:lightbulb
"\U000F0F54", # mdi:home-thermometer
"\U000F0439", # mdi:radio
"\U000F1A2D", # mdi:blinds-vertical
"\U000F07AE", # mdi:cctv
"\U000F1A57", # mdi:meter-electric
"\U000F081C", # mdi:door-open
"\U000F081B", # mdi:door-closed
"\U000F11DB", # mdi:window-closed-variant
"\U000F11DC", # mdi:window-open-variant
"\U000F0493", # mdi:cog
"\U000F0425", # mdi:power
"\U000F18F2", # mdi:mdi:refresh-auto
"\U000F0C11", # mdi:alpha-m-circle-outline
"\U000F04B2" # mdi:sleep
]
switch:
# 홈어시스턴트 조명
- platform: homeassistant
entity_id: $light_switch_2
name: light_switch_2
id: light_switch_2
on_turn_on:
then:
- lvgl.widget.update:
id: light_switch_button_2
state:
checked: true
- lvgl.widget.update:
id: light_switch2_button_checked
state:
checked: true
on_turn_off:
then:
- lvgl.widget.update:
id: light_switch_button_2
state:
checked: false
- lvgl.widget.update:
id: light_switch2_button_checked
state:
checked: false
text_sensor:
- platform: version
name: "${name} Esphome Version"
- platform: wifi_info
ip_address:
name: ESP IP Address
mac_address:
name: ESP Mac Wifi Address
- platform: sun
name: Sun Rise
id: sun_rise
type: sunrise
internal: True
on_value:
- lvgl.label.update:
id: home_weather_sunrise
text:
format: "#FFA500 \U000F059C# %s"
args: [ x.c_str() ]
- platform: sun
name: Sun set
id: sun_set
type: sunset
internal: True
on_value:
- lvgl.label.update:
id: home_weather_sunset
text:
format: "%s #FF0000 \U000F059C#"
args: [ x.c_str() ]
#네이버 날씨
- platform: homeassistant
entity_id: weather.naver_weather_1
name: naver weather
id: naver_weather_1
on_value:
- if:
condition:
or:
- lambda: 'return id(naver_weather_1).state == "sunny";'
- lambda: 'return id(naver_weather_1).state == "clear";'
then:
- lvgl.image.update:
id: home_weather_icon
src: sunny
- if:
condition:
or:
- lambda: 'return id(naver_weather_1).state == "clear-night";'
- lambda: 'return id(naver_weather_1).state == "night";'
then:
- lvgl.image.update:
id: home_weather_icon
src: clearnight
- if:
condition:
- lambda: 'return id(naver_weather_1).state == "partlycloudy";'
then:
- lvgl.image.update:
id: home_weather_icon
src: partlycloud
- if:
condition:
and:
- lambda: 'return id(naver_weather_1).state == "partlycloudy";'
- sun.is_below_horizon:
then:
- lvgl.image.update:
id: home_weather_icon
src: nightpartlycloud
- if:
condition:
- lambda: 'return id(naver_weather_1).state == "cloudy";'
- sun.is_below_horizon:
then:
- lvgl.image.update:
id: home_weather_icon
src: scloud
- if:
condition:
and:
- lambda: 'return id(naver_weather_1).state == "cloudy";'
then:
- lvgl.image.update:
id: home_weather_icon
src: cloudy
- if:
condition:
- lambda: 'return id(naver_weather_1).state == "rainy";'
then:
- lvgl.image.update:
id: home_weather_icon
src: rainy
- if:
condition:
- lambda: 'return id(naver_weather_1).state == "pouring";'
then:
- lvgl.image.update:
id: home_weather_icon
src: pouring
- if:
condition:
- lambda: 'return id(naver_weather_1).state == "hail";'
then:
- lvgl.image.update:
id: home_weather_icon
src: hail
- if:
condition:
- lambda: 'return id(naver_weather_1).state == "snowy";'
then:
- lvgl.image.update:
id: home_weather_icon
src: snowy
- if:
condition:
- lambda: 'return id(naver_weather_1).state == "windy";'
then:
- lvgl.image.update:
id: home_weather_icon
src: windy
- if:
condition:
or:
- lambda: 'return id(naver_weather_1).state == "lightning";'
- lambda: 'return id(naver_weather_1).state == "lightning-rainy";'
- lambda: 'return id(naver_weather_1).state == "thender";'
then:
- lvgl.image.update:
id: home_weather_icon
src: lightning
- platform: homeassistant
entity_id: sensor.naver_weather_nowweather_1
name: naver weather nowweather
id: naver_weather_nowweather_1
on_value:
then:
- lvgl.label.update:
id: home_weather_text
text:
format: "%s"
args: [ x.c_str() ]
- platform: homeassistant
entity_id: sensor.naver_weather_windbearing_1
name: naver weather windbearing
id: naver_weather_windbearing_1
on_value:
- lvgl.label.update:
id: home_weather_hum
text:
format: "#47ACF5 습도# %.0f%% #02D109 %s풍# %.1f m/s"
args: [ 'id(naver_weather_humidity_1).state' , x.c_str(),'id(naver_weather_windspeed_1).state']
- platform: homeassistant
entity_id: sensor.naver_weather_rainystarttmr_1
name: naver weather rainystarttmr
id: naver_weather_rainystarttmr_1
on_value:
- if:
condition:
- lambda: 'return id(naver_weather_rainystarttmr_1).state != "비안옴";'
then:
- lvgl.widget.show: home_weather_rainystarttmr
- lvgl.label.update:
id: home_weather_rainystarttmr
text:
format: "\U000F054A %s 비 내림 (%smm)"
args: [ x.c_str(), id(naver_weather_rainfall_1).state.c_str() ]
else:
- lvgl.widget.hide: home_weather_rainystarttmr
- platform: homeassistant
entity_id: sensor.naver_weather_rainfall_1
name: naver weather rainfall
id: naver_weather_rainfall_1
- platform: homeassistant
entity_id: sensor.naver_weather_finedustgrade_1
name: naver_weather_finedustgrade_1
id: naver_weather_finedustgrade_1
on_value:
- lvgl.label.update:
id: home_weather_pm10
text: !lambda |-
static char buf[15];
std::string x_str = (id(naver_weather_finedustgrade_1).state);
snprintf(buf, sizeof(buf), "%s", x_str.c_str());
if (x_str == "좋음") {
lv_obj_set_style_text_color(id(home_weather_pm10), lv_color_hex(0x005AC7), LV_STATE_DEFAULT); // 딥블루
} else if (x_str == "보통") {
lv_obj_set_style_text_color(id(home_weather_pm10), lv_color_hex(0x00FF00), LV_STATE_DEFAULT); // 녹색
} else if (x_str == "나쁨") {
lv_obj_set_style_text_color(id(home_weather_pm10), lv_color_hex(0xFFA500), LV_STATE_DEFAULT); // 오렌지색
} else if (x_str == "매우나쁨") {
lv_obj_set_style_text_color(id(home_weather_pm10), lv_color_hex(0xFF0000), LV_STATE_DEFAULT); // 레드
}
return buf;
- platform: homeassistant
entity_id: sensor.naver_weather_ultrafinedustgrade_1
name: naver_weather_ultrafinedustgrade_1
id: naver_weather_ultrafinedustgrade_1
on_value:
- lvgl.label.update:
id: home_weather_pm25
text: !lambda |-
static char buf[15];
std::string x_str = (id(naver_weather_ultrafinedustgrade_1).state);
snprintf(buf, sizeof(buf), "%s", x_str.c_str());
if (x_str == "좋음") {
lv_obj_set_style_text_color(id(home_weather_pm25), lv_color_hex(0x005AC7), LV_STATE_DEFAULT); // 딥블루
} else if (x_str == "보통") {
lv_obj_set_style_text_color(id(home_weather_pm25), lv_color_hex(0x00FF00), LV_STATE_DEFAULT); // 녹색
} else if (x_str == "나쁨") {
lv_obj_set_style_text_color(id(home_weather_pm25), lv_color_hex(0xFFA500), LV_STATE_DEFAULT); // 오렌지색
} else if (x_str == "매우나쁨") {
lv_obj_set_style_text_color(id(home_weather_pm25), lv_color_hex(0xFF0000), LV_STATE_DEFAULT); // 레드
}
return buf;
- platform: homeassistant
entity_id: sensor.naver_weather_ozongrade_1
name: naver weather ozongrade
id: naver_weather_ozongrade_1
on_value:
- lvgl.label.update:
id: home_weather_ozongrade
text: !lambda |-
static char buf[15];
std::string x_str = (id(naver_weather_ozongrade_1).state);
snprintf(buf, sizeof(buf), "%s", x_str.c_str());
if (x_str == "좋음") {
lv_obj_set_style_text_color(id(home_weather_ozongrade), lv_color_hex(0x005AC7), LV_STATE_DEFAULT); // 딥블루
} else if (x_str == "보통") {
lv_obj_set_style_text_color(id(home_weather_ozongrade), lv_color_hex(0x00FF00), LV_STATE_DEFAULT); // 녹색
} else if (x_str == "나쁨") {
lv_obj_set_style_text_color(id(home_weather_ozongrade), lv_color_hex(0xFFA500), LV_STATE_DEFAULT); // 오렌지색
} else if (x_str == "매우나쁨") {
lv_obj_set_style_text_color(id(home_weather_ozongrade), lv_color_hex(0xFF0000), LV_STATE_DEFAULT); // 레드
}
return buf;
- platform: homeassistant
entity_id: sensor.naver_weather_todayuvgrade_1
name: naver weather todayuvgrade
id: naver_weather_todayuvgrade_1
on_value:
- lvgl.label.update:
id: home_weather_todayuvgrade
text: !lambda |-
static char buf[15];
std::string x_str = (id(naver_weather_todayuvgrade_1).state);
snprintf(buf, sizeof(buf), "%s", x_str.c_str());
if (x_str == "좋음") {
lv_obj_set_style_text_color(id(home_weather_todayuvgrade), lv_color_hex(0x005AC7), LV_STATE_DEFAULT); // 딥블루
} else if (x_str == "보통") {
lv_obj_set_style_text_color(id(home_weather_todayuvgrade), lv_color_hex(0x00FF00), LV_STATE_DEFAULT); // 녹색
} else if (x_str == "높음") {
lv_obj_set_style_text_color(id(home_weather_todayuvgrade), lv_color_hex(0xFFA500), LV_STATE_DEFAULT); // 오렌지색
} else if (x_str == "매우높음") {
lv_obj_set_style_text_color(id(home_weather_todayuvgrade), lv_color_hex(0xFF0000), LV_STATE_DEFAULT); // 레드
}
return buf;
#실외 센서
# 에어컨 텍스트 센서
- platform: homeassistant
entity_id: $aircon_id
name: aircon_mode
id: aircon_mode
on_value:
- lvgl.label.update:
id: aircon_mode_text
text:
format: "%s"
args: [ x.c_str() ]
- if:
condition:
lambda: 'return id(aircon_mode).state == "heat_cool";'
then:
- lvgl.dropdown.update:
id: aircon_mode_set
selected_index: 0
- lvgl.label.update:
id: aircon_mode_text
text: "자동"
- if:
condition:
lambda: 'return id(aircon_mode).state == "heat";'
then:
- lvgl.dropdown.update:
id: aircon_mode_set
selected_index: 1
- lvgl.label.update:
id: aircon_mode_text
text: "난방"
- if:
condition:
lambda: 'return id(aircon_mode).state == "cool";'
then:
- lvgl.dropdown.update:
id: aircon_mode_set
selected_index: 2
- lvgl.label.update:
id: aircon_mode_text
text: "냉방"
- if:
condition:
lambda: 'return id(aircon_mode).state == "dry";'
then:
- lvgl.dropdown.update:
id: aircon_mode_set
selected_index: 3
- lvgl.label.update:
id: aircon_mode_text
text: "제습"
- if:
condition:
lambda: 'return id(aircon_mode).state == "fan_only";'
then:
- lvgl.dropdown.update:
id: aircon_mode_set
selected_index: 4
- lvgl.label.update:
id: aircon_mode_text
text: "송풍"
- if:
condition:
lambda: 'return id(aircon_mode).state == "off";'
then:
- lvgl.dropdown.update:
id: aircon_mode_set
selected_index: 5
- lvgl.label.update:
id: aircon_mode_text
text: "꺼짐"
- script.execute: light_up
- if:
condition:
lvgl.is_idle:
timeout: 30s
then:
- lvgl.page.show: climate_page
- platform: homeassistant
entity_id: $aircon_id
attribute: fan_mode
name: aircon_fan_mode
id: aircon_fan_mode
on_value:
- if:
condition:
lambda: 'return id(aircon_fan_mode).state == "diffuse";'
then:
- lvgl.dropdown.update:
id: aircon_fan_mode_Set
selected_index: 1
- if:
condition:
lambda: 'return id(aircon_fan_mode).state == "high";'
then:
- lvgl.dropdown.update:
id: aircon_fan_mode_Set
selected_index: 2
- if:
condition:
lambda: 'return id(aircon_fan_mode).state == "medium";'
then:
- lvgl.dropdown.update:
id: aircon_fan_mode_Set
selected_index: 3
- if:
condition:
lambda: 'return id(aircon_fan_mode).state == "low";'
then:
- lvgl.dropdown.update:
id: aircon_fan_mode_Set
selected_index: 4
- if:
condition:
lvgl.is_idle:
timeout: 30s
then:
- script.execute: light_up
- lvgl.page.show: climate_page
binary_sensor:
- platform: status
name: "${name} Connection Status"
button:
- platform: restart
name: "${name} Restart"
id: re_start
entity_category: diagnostic
sensor:
# 와이파이 신호 세기
- platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
name: "WiFi Signal dB"
id: wifi_signal_db
internal: true
entity_category: "diagnostic"
- platform: copy # Reports the WiFi signal strength in %
source_id: wifi_signal_db
name: "${name} WiFi Signal Percent"
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "Signal %"
entity_category: "diagnostic"
device_class: ""
icon: mdi:wifi
#HA Sensors
# Naver Weather
- platform: homeassistant
entity_id: sensor.naver_weather_todaymintemp_1
name: naver weather todaymintemp
id: naver_weather_todaymintemp_1
accuracy_decimals: 1
- platform: homeassistant
entity_id: sensor.naver_weather_todaymaxtemp_1
name: naver weather todaymaxtemp
id: naver_weather_todaymaxtemp_1
accuracy_decimals: 1
on_value:
- lvgl.label.update:
id: home_weather_minmax
text:
format: "#47ACF5 %.1f°#|#FF0000 %.1f°#"
args: [ 'id(naver_weather_todaymintemp_1).state', 'x' ]
- platform: homeassistant
entity_id: sensor.naver_weather_nowtemp_1
name: naver weather nowtemp
id: naver_weather_nowtemp_1
accuracy_decimals: 1
- platform: homeassistant
entity_id: sensor.naver_weather_humidity_1
name: naver weather humidity
id: naver_weather_humidity_1
on_value:
- lvgl.label.update:
id: home_weather_hum
text:
format: "#47ACF5 습도# %.0f%% #02D109 %s풍# %.1f m/s"
args: [ 'x', 'id(naver_weather_windbearing_1).state.c_str()', 'id(naver_weather_windspeed_1).state']
- platform: homeassistant
entity_id: sensor.naver_weather_todayfeeltemp_1
name: naver weather todayfeeltemp
id: naver_weather_todayfeeltemp_1