-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay
1176 lines (973 loc) · 37.1 KB
/
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
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 -------------- #
# ------------------------------------------- #
substitutions:
name: esp32-s3box-3
friendly_name: ESP32-S3-Box-3
frigate_snapshot_url: "http://192.168.1.20:8123/local/cctv/snapshots/frigate1-1730408045.992231-4mcpxe-clean.png"
local_image_format: "RGB565"
base_snapshot_url: "http://192.168.1.20:8123/local/cctv/snapshots/"
base_frigate_url: "http://192.168.1.20:8123/api/frigate/notifications/1730506459.355248-3s2cry/snapshot.jpg?external_auth=1"
camera_snapshot: "frigate1-1730408045.992231-4mcpxe-clean.png"
test_snapshot_url: "https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/280px-PNG_transparency_demonstration_1.png"
test_image_web_url: "https://a.espncdn.com/i/teamlogos/soccer/500/359.png"
test1_web_url: "https://a.espncdn.com/i/teamlogos/soccer/500/364.png"
image_name: "clean.png"
camera_1_url: "http://192.168.1.158:80/media/frigate/clips/frigate1-1730434451.410002-o43cgj-clean.png"
#frigate_url: "http://192.168.1.124/files/camera%20snapshot/frigate1-1730071085.992085-kv11rh-clean.png"
# Display related
#local_image_size: '1080x720'
#local_image_use_transparency: "true"
#BOARD_TFT_WIDTH: "320"
#BOARD_TFT_HEIGHT: "240"
external_media_player: salle_tv ##change this to your external media player enity_id: do not include media_player.
home_assistant_host: http://homeassistant.local:8123 #
font_glyphs: '&@!"''%()+=,-_.:°/$€£¥?0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyzÀàÁáÂâÃãÄäĀāĂăÅåǺǻẠạĄąÆæǼǽĆćĈĉČčĊċÇçĎďĐđÐðÈèÉéÊêẼẽĚěËëĒēĔĕĖėẸẹĘęĜĝǦǧĞğĠġĢģĤĥĦħıÌìÍíÎîĨĩÏïĪīĬĭİỊịĮįȷĴĵĶķĸĹ弾ĻļŁłĿŀŃńÑñŇňŅņƝɲŊŋʼnÒòÓóÔôÕõÖöŌōŎŏŐőỌọǪǫØøǾǿŒœŔŕŘřŖŗŚśŜŝŠšŞşȘșẞߍťŢţȚțŦŧÞþÙùÚúÛûŨũÜüŪūŬŭŮůŰűỤụŲųẀẁẂẃŴŵẄẅỲỳÝýŶŷỸỹŸÿȲȳŹźŽžŻżIJijƏə'
micro_wake_word_model_3: https://github.com/kahrendt/microWakeWord/releases/download/okay_nabu/okay_nabu.json
settings: "\U0000e900" # settings
thermostat: "\U0000e901" # thermostat
lock: "\U0000e902" # security, alarm
camera: "\U0000e903" # camera
curtains: "\U0000e904" # curtains
lights: "\U0000e905" # lights
air_conditioner: "\U0000e906" # air_conditioner
motion: "\U0000e907" # motion, presence
heating: "\U0000e908" # heating
alarm_off: "\U0000e909" # alarm off
alarm_on: "\U0000e90a" # alarm on
ha: "\U0000e90b" # home assistant
color_temp: "\U0000e90c" # color_temp
ventilation: "\U0000e90d" # ventilation
wifi_25: "\U0000e91e" # wifi signal from 25% to 1%
wifi_50: "\U0000e91f" # wifi signal from 50% to 25%
wifi_75: "\U0000e910" # wifi signal from 75% to 50%
wifi_100: "\U0000e911" # wifi signal from 100% to 75% or disable
humidity: "\U0000e912" # humidity
co2: "\U0000e913" # co2
tvoc: "\U0000e914" # air quality
temperature: "\U0000e915" # temperature
illumination: "\U0000e916" # lux
empty: "\U0000e917" # placeholder
vacuum_cleaner: "\U0000e918" # vacuum cleaner
logo: "\U0000e919" # logo
alarm_home: "\U000F068A" # alarm home
alarm_away: "\U000F0BC4" # alarm away
alarm_nigt: "\U000F1828" # armed night
disarmed: "\U000F099E" # disarmed
arming: "\U000F0565" # arming
home: "\U000F1A12" # home
tv: "\U000F07F4" # tv
sound: "\U000F07C5" # sound
Battery: "\U000F0091" # battery
music: "\U000F0384" # music
tools: "\U000F1322" #tools
cctv: "\U000F07AE" #cctv
cog: "\U000F0493" #settings cog
voice: "\U000F05CB" #voice
screen: "\U000F0502" #screen settings
info: "\U000F1C6F" #info
scr: "\U000F0521" #toggle on
screen_off: "\U000F0D90" #screen off
bell: "\U000F009E" #bell
stop: "\U000F04DB" #stop
sleep: "\U000F04B2" #sleep
s_saver: "\U000F1110" #s_saver
light_mut: "\U000F18DD" #light_mut
alarm_bell: "\U000F009E" #alarm bell
clock: "\U000F0150" #clock
source: "\U000F062C" #source
kubernetes: "\U000F10FE" #kubernetes
github: "\U000F02A4" #github
angular: "\U000F06B2" #angular
radio: "\U000F0439" #radio
next: "\U000F0BB1" #next
lightbulb: "\U000F0335"
aircon: "\U000F0D43"
ledstrip: "\U000F1051"
package: "\U000F03D7"
lumiere: "\U000F07D6"
blind: "\U000F00AC"
nightlight: "\U000F1A4C"
network: "\U000F1087"
videocall: "\U000F036B"
application: "\U000F0614"
forklift: "\U000F07C9"
gmail: "\U000F02AB"
slack: "\U000F04B1"
command: "\U000F0633"
# ----------------------------------------- #
# -------------- COLORS ------------------- #
# ----------------------------------------- #
color:
- id: color_black
hex: 0d0d0d
- id: color_dark_gray
hex: 333333
- id: color_gray
hex: 666666
- id: color_white
hex: f2f0eb
- id: color_red
hex: ff0000
- id: color_crimson
hex: f5075c
- id: color_blue
hex: 2fc0ff
- id: color_yellow
hex: e7c12c
- id: color_amber
hex: f4a900
- id: color_mint
hex: 39d19c
- id: color_green
hex: 00ff00
- id: color_orange
hex: f07c40
- id: color_deep_orange
hex: ff6600
- id: color_violet
hex: 9670d6
- id: color_dark_blue
hex: 4867aa
- id: color_nova
hex: 93A4EC
- id: color_navy
hex: aad6ec
- id: color_cyan
hex: 00FFFF
- id: color_magenta
hex: FF00FF
# Nova Colors
- id: nova_color # pink
hex: "e38de3"
- id: pri_color # light (mantle)
hex: "24273a"
- id: sec_color # dark (crust)
hex: "181926"
- id: text_color
hex: "cad3f5"
- id: off_color
hex: "5b6078"
# Blue Colors
- id: blue_color
hex: "6b93e3"
- id: green_color
hex: "a6da95"
- id: yellow_color
hex: "ffd17a"
- id: orange_color
hex: "e0752b"
- id: red_color
hex: "de455c"
- id: color_aqua
hex: "00ffff"
# ------------------------------------------- #
# ---------- GLOBALS VARIABLES -------------- #
# ------------------------------------------- #
globals:
- id: s_saver_visible
type: bool
restore_value: no
initial_value: "false"
- id: page_home_visible
type: bool
restore_value: no
initial_value: "false"
- id: display_timeout_global
type: int
restore_value: true
initial_value: "2"
- id: last_time
type: unsigned long
restore_value: false
initial_value: '0'
- id: language_select
type: bool
restore_value: true
initial_value: "false"
- id: current_pin
type: std::string
initial_value: ""
- id: mute_value
type: bool
restore_value: no
initial_value: "false"
- id: speaker_volume
type: int
restore_value: no
initial_value: '5'
- id: media_state
type: bool
restore_value: no
initial_value: "false"
- id: is_muted
type: bool
initial_value: "false"
- id: frequency_bands
type: float[7]
restore_value: no
- id: sensors_buzzer
type: bool
restore_value: true
initial_value: "false"
- id: motion_sensor
type: bool
restore_value: true
initial_value: "false"
- id: bar_value
type: int
initial_value: "0"
- id: sensor_piscine
type: bool
restore_value: true
initial_value: "false"
- id: global_first_active_timer
type: voice_assistant::Timer
restore_value: false
- id: global_is_timer_active
type: bool
restore_value: false
- id: global_first_timer
type: voice_assistant::Timer
restore_value: false
- id: global_is_timer
type: bool
restore_value: false
- id: image_index
type: int
restore_value: no
initial_value: '0'
- id: total_images
type: int
restore_value: no
initial_value: '4'
lvgl: !include src/display/lvgl.yaml
script: !include src/display/script.yaml
switch: !include src/display/switch.yaml
sensor: !include src/display/sensor.yaml
text_sensor: !include src/display/text_sensor.yaml
image: !include src/display/images.yaml
font: !include src/display/fonts.yaml
# ------------------------------------------- #
# ------------ ESPHOME OPTIONS -------------- #
# ------------------------------------------- #
esphome:
name: display
friendly_name: display
min_version: 2024.9.0
platformio_options:
board_build.flash_mode: dio
on_boot:
priority: -100
then:
- script.execute: show_page_boot
esp32:
board: esp32s3box
variant: esp32s3
flash_size: 16MB
framework:
type: esp-idf
version: recommended
sdkconfig_options:
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
CONFIG_AUDIO_BOARD_CUSTOM: "y"
CONFIG_ESP32_S3_BOX_3_BOARD: "y"
components:
- name: esp32_s3_box_3_board
source: github://jesserockz/esp32-s3-box-3-board@main
refresh: 0s
##############################################################################################################################################################################
######################################################################## AUDIO AND VOICE ASSISTANT ###########################################################################
select:
- platform: template
entity_category: config
name: Wake word engine location
id: wake_word_engine_location
optimistic: true
restore_value: true
options:
- In Home Assistant
- On device
initial_option: In Home Assistant
on_value:
- if:
condition:
lambda: return x == "In Home Assistant";
then:
- micro_wake_word.stop
- delay: 500ms
- lambda: id(va).set_use_wake_word(true);
- voice_assistant.start_continuous:
- text_sensor.template.publish:
id: wakeword_location
state: !lambda 'return "Home Assistant";'
- component.update: my_display
- if:
condition:
lambda: return x == "On device";
then:
- text_sensor.template.publish:
id: wakeword_location
state: !lambda 'return "On Device";'
- lambda: id(va).set_use_wake_word(false);
- voice_assistant.stop
- delay: 500ms
- micro_wake_word.start
- component.update: my_display
i2s_audio:
- id: i2s_shared
i2s_lrclk_pin:
number: GPIO45
ignore_strapping_warning: true
i2s_bclk_pin: GPIO17
i2s_mclk_pin: GPIO2
access_mode: duplex
adf_pipeline:
- platform: i2s_audio
type: audio_out
id: adf_i2s_out
i2s_audio_id: i2s_shared
i2s_dout_pin: GPIO15
adf_alc: false
dac:
i2c_id: bus_a
model: es8311
address: 0x18
enable_pin:
number: GPIO46
ignore_strapping_warning: true
sample_rate: 16000
bits_per_sample: 16bit
fixed_settings: true
- platform: i2s_audio
type: audio_in
id: adf_i2s_in
i2s_audio_id: i2s_shared
i2s_din_pin: GPIO16
pdm: false
adc:
i2c_id: bus_a
model: es7210
address: 0x40
sample_rate: 16000
bits_per_sample: 16bit
fixed_settings: true
media_player:
- platform: adf_pipeline
id: adf_media_player
name: display_s3_box_media_player
internal: false
keep_pipeline_alive: true
announcement_audio:
sample_rate: 24000
bits_per_sample: 16
num_channels: 1
pipeline:
- self
- resampler
- adf_i2s_out
on_play:
- lambda: |-
id(media_state) = true;
- component.update: my_display
on_idle:
- lambda: |-
id(media_state) = false;
- component.update: my_display
microphone:
- platform: adf_pipeline
id: box_mic
keep_pipeline_alive: true
pipeline:
- adf_i2s_in
- resampler
- self
#########################################################################################################################################################################
################################################### micro wake word #####################################################################################################
micro_wake_word:
vad:
models:
- model: ${micro_wake_word_model_3}
on_wake_word_detected:
- if:
condition:
and:
- switch.is_off: output_audio
- switch.is_on: wake_sound
then:
- media_player.play_media:
id: adf_media_player
media_url: 'http://homeassistant.local:8123/local/sounds/ds9intercom.mp3'
- delay: 1s
- media_player.stop
- voice_assistant.start
else:
if:
condition:
and:
- switch.is_on: output_audio
- switch.is_on: wake_sound
then:
- homeassistant.service:
service: media_player.play_media
data:
entity_id: media_player.${external_media_player}
media_content_id: 'http://homeassistant.local:8123/local/sounds/ds9intercom.mp3'
media_content_type: music
- media_player.stop
- voice_assistant.start
else:
if:
condition:
- switch.is_off: wake_sound
then:
- media_player.stop
- voice_assistant.start
- media_player.stop
voice_assistant:
id: va
microphone: box_mic
media_player: adf_media_player
use_wake_word: true
noise_suppression_level: 2
auto_gain: 31dBFS
volume_multiplier: 4.0
on_wake_word_detected:
- if:
condition:
and:
- switch.is_off: output_audio
- switch.is_on: wake_sound
then:
- media_player.play_media:
media_url: '${home_assistant_host}/local/sounds/ds9intercom.mp3'
- delay: 3s
- media_player.stop
- lvgl.page.show: page_spectrum
else:
if:
condition:
and:
- switch.is_on: wake_sound
- switch.is_on: output_audio
then:
- homeassistant.service:
service: media_player.play_media
data:
entity_id: media_player.${external_media_player}
media_content_id: '${home_assistant_host}/local/sounds/commandcodesverified_ep.mp3'
media_content_type: music
- media_player.stop
on_start:
- light.turn_on: display_backlight
- lvgl.page.show: page_spectrum
on_stt_end:
- text_sensor.template.publish:
id: text_request
state: !lambda return x;
on_stt_vad_end:
- lvgl.page.show: page_lcars
- light.turn_on: display_backlight
on_tts_start:
- delay: 3s
- text_sensor.template.publish:
id: text_response
state: !lambda return x;
on_tts_end:
- lvgl.page.show: page_lcars
- if:
condition:
- switch.is_on: output_audio
then:
- homeassistant.service:
service: media_player.play_media
data:
entity_id: media_player.${external_media_player}
media_content_id: !lambda 'return x;'
media_content_type: music
announce: "true"
- delay: 12s
- lvgl.page.show: page_home
on_error:
- if:
condition:
not:
- voice_assistant.is_running
then:
- lvgl.page.show: page_spectrum
on_end:
- if:
condition:
lambda: return id(wake_word_engine_location).state == "On device";
then:
- wait_until:
not:
voice_assistant.is_running:
- micro_wake_word.start
- delay: 100ms
- micro_wake_word.start
else:
- wait_until:
not:
voice_assistant.is_running:
- lambda: id(va).set_use_wake_word(false);
- voice_assistant.stop:
- delay: 100ms
- lambda: id(va).set_use_wake_word(true);
- delay: 100ms
- voice_assistant.start_continuous:
on_timer_started:
- script.execute: timer_ending
on_timer_cancelled:
- lambda: id(time_remaining_0).publish_state ("0:00:00");
- component.update: my_display
on_timer_updated:
- component.update: my_display
on_timer_tick:
- lambda: |-
int seconds = timers[0].seconds_left;
int hours = seconds / 3600;
int minutes = (seconds % 3600) / 60;
seconds %= 60;
id(time_remaining_0).publish_state(str_sprintf("%d:%02d:%02d", hours, minutes, seconds));
- component.update: my_display
on_timer_finished:
if:
condition:
- switch.is_on: output_audio
then:
- switch.turn_on: timer_ringing
- script.execute: timer_started_external
- lvgl.page.show: page_timer_finished
- component.update: my_display
else:
- if:
condition:
- switch.is_off: output_audio
then:
- switch.turn_on: timer_ringing
- script.execute: timer_started
- lvgl.page.show: page_timer_finished
- component.update: my_display
###############################################################################################################################################################################
########################################################################### PSRAM #############################################################################################
psram:
mode: octal
speed: 80MHz
# Enable logging
logger:
hardware_uart: USB_SERIAL_JTAG
debug:
update_interval: 5s
# Enable Home Assistant API
api:
on_client_connected:
- micro_wake_word.start
- if:
condition:
lambda: 'return (0 == client_info.find("Home Assistant "));'
then:
- lvgl.label.update:
id: ha_status
text_color: color_blue
on_client_disconnected:
- if:
condition:
lambda: 'return (0 == client_info.find("Home Assistant "));'
then:
- lvgl.label.update:
id: ha_status
text_color: color_dark_gray
ota:
- platform: esphome
external_components:
- source:
type: git
url: https://github.com/gnumpi/esphome_audio
ref: dev-next
components: [ adf_pipeline, i2s_audio ]
refresh: 0s
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
time:
- platform: homeassistant
id: esptime
on_time:
- minutes: '*'
seconds: 0
then:
- script.execute: time_update
############################################################ script ######################################################################################################
################################################################################################################################################################################
################################################## ------------------ SWITCHS ------------------- ##############################################################################
################################################################################################################################################################################
##################################################################################################################################################################################
# ------------------------------------------- ####################################################################################################################################
##################################################### ---------------- SENSORS ------------------ ################################################################################
# ------------------------------------------- ####################################################################################################################################
# ------------------------------------------- #
# ------------- TEXT SENSORS ---------------- #
# ------------------------------------------- #
# ---------------------------------------------- #
# ---------------- THERMOSTAT ------------------ #
# ---------------------------------------------- #
# -------------------------------------------- #
# ------------------ LIGHTS ------------------ #
# -------------------------------------------- #
light:
- platform: monochromatic
id: display_backlight
name: LCD Backlight
entity_category: config
output: backlight_output
restore_mode: ALWAYS_ON
default_transition_length: 0ms
#########################################################################################################################################################################
############################################################### images ##################################################################################################
# ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- #
###############################################################################################################################################################################
########################################################## font ################################################################################################################
# ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #
###############################################################################################################################################################################
#################################################################################################################################################################################
############################################################### LGVL ###########################################################################################################################
###############################################################################################################################################################################
###############################################################################################################################################################################
###############################################################################################################################################################################
output:
- platform: ledc
pin: GPIO47
id: backlight_output
button:
- platform: restart
id: reboot
name: "Reboot"
entity_category: diagnostic
number:
- id: s_saver_delay
platform: template
name: "Scr/save delay"
icon: 'mdi:sleep'
entity_category: config
unit_of_measurement: 'secs'
optimistic: true
restore_value: true
initial_value: 30
step: 5
min_value: 10
max_value: 999999
on_value:
- component.update: my_display
- component.update: s_saver_delay
- script.execute: saver_enabled
- id: s_saver_blank_delay
platform: template
name: "Scr/off delay"
icon: 'mdi:monitor-off'
entity_category: config
unit_of_measurement: 'secs'
optimistic: true
restore_value: true
initial_value: 30
step: 5
min_value: 10
max_value: 999999
on_value:
- component.update: s_saver_blank_delay
- script.execute: saver_enabled
- component.update: my_display
- id: s_saver_brightness
platform: template
name: "Scr/save Brightness"
icon: 'mdi:sleep'
entity_category: config
unit_of_measurement: '%'
optimistic: true
restore_value: true
initial_value: 30
step: 5
min_value: 20
max_value: 100
on_value:
- component.update: s_saver_brightness
- script.execute: saver_enabled
- component.update: my_display
- id: s_default_brightness
platform: template
name: "Default Brightness"
icon: 'mdi:monitor'
entity_category: config
unit_of_measurement: '%'
optimistic: true
restore_value: true
initial_value: 100
step: 5
min_value: 20
max_value: 100
on_value:
- component.update: s_default_brightness
- script.execute: saver_enabled
- component.update: my_display
i2c:
- id: bus_a
sda: GPIO08
scl: GPIO18
scan: false
sda_pullup_enabled: true
scl_pullup_enabled: true
frequency: 100kHz
######################################################################### touchscreen ##########################################################################################
touchscreen:
platform: gt911
i2c_id: bus_a
id: gt911_touchscreen
update_interval: 16ms
interrupt_pin:
number: GPIO3
ignore_strapping_warning: true
on_touch:
- lambda: id(display_backlight).turn_on().set_brightness(1.0).perform();
spi:
clk_pin: 7
mosi_pin: 6
######################################################################### display ###############################################################################################
display:
- platform: ili9xxx
id: my_display
model: S3BOX
data_rate: 40MHz
cs_pin: 5
dc_pin: 4
reset_pin:
number: 48
inverted: true
update_interval: never
invert_colors: false
auto_clear_enabled: False
#################################################### top left hand physical button ###############################################################################################
binary_sensor:
- platform: gpio
id: top_left_button
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: true
ignore_strapping_warning: true
######################################################### radar sensor ##############################################################################################################
- platform: gpio
pin:
number: GPIO21
name: "Presence detect"
disabled_by_default: false
device_class: "occupancy"
on_state:
if:
condition:
and:
- switch.is_on: s_saver_presc
- lambda: 'return id(s_saver_visible);'
then:
- lvgl.page.show: page_home
- component.update: my_display
- light.turn_on:
id: display_backlight
brightness: 90%
else:
if:
condition:
not:
- lambda: 'return id(page_home_visible);'
then:
- component.update: my_display
- light.turn_on:
id: display_backlight
brightness: 90%
- script.execute: saver_enabled
################################################# red circle home button ####################################################################################################
- platform: gt911
id: home_button
index: 0
on_press:
- lvgl.page.show: page_home
- light.turn_on:
id: display_backlight
brightness: 90%
######################################################## LIGHT ##############################################################################################################
################################################################################################################################################################################
####################################################### ALARM KEY ##################################################################################################################################
key_collector:
- source_id: key_alarm
min_length: 4
max_length: 4
end_keys: "AD"
end_key_required: true
clear_keys: "*"
allowed_keys: "0123456789"
timeout: 3s
on_result:
- if:
condition:
and:
- lambda: 'return id(alarm_status).state == "disarmed";'
- lambda: "return end == 'A';"
then:
- homeassistant.service:
service: alarm_control_panel.alarm_arm_away
data:
entity_id: alarm_control_panel.alarmo
code: !lambda 'return x;'
- lvgl.label.update:
id: label_alarm_code
text: "ARMED"
- lvgl.widget.update:
id: alarm_code
bg_color: color_green
- if:
condition:
and:
- lambda: 'return (id(alarm_status).state == "arming" || id(alarm_status).state == "armed_away" || id(alarm_status).state == "armed_home" || id(alarm_status).state == "armed_night");'
- lambda: "return end == 'D';"
then:
- homeassistant.service:
service: alarm_control_panel.alarm_disarm
data:
entity_id: alarm_control_panel.alarmo
code: !lambda 'return x;'
- lvgl.label.update:
id: label_alarm_code
text: "DISARM"
- lvgl.widget.update:
id: alarm_code
bg_color: color_blue
################################################################################################################################################################################
################################################################### visualizer #################################################################################################
interval: