Seperate events out to own yaml file

This commit is contained in:
2026-05-11 15:37:39 +02:00
parent 21791e8aeb
commit f6bd11f892
4 changed files with 364 additions and 207 deletions
+2 -205
View File
@@ -37,10 +37,9 @@ packages:
files:
path: 'package/3bar_1display.yaml'
vars:
nr_of_pages: '1'
page_names: '{"Start"}'
nr_of_pages: '2'
page_names: '{"Start","Page 2"}'
ref: main
font:
- file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf"
@@ -98,208 +97,6 @@ color:
- id: grey
hex: A6A6A6
event:
- platform: template
name: BAR1 button Left event
id: bar1_btn_left_event
event_types:
- "press page 0"
- "release page 0"
- "long press page 0"
- platform: template
name: BAR1 button Right event
id: bar1_btn_right_event
event_types:
- "press page 0"
- "release page 0"
- "long press page 0"
- platform: template
name: BAR2 button Left event
id: bar2_btn_left_event
event_types:
- "press page 0"
- "release page 0"
- "long press page 0"
- platform: template
name: BAR2 button Right event
id: bar2_btn_right_event
event_types:
- "press page 0"
- "release page 0"
- "long press page 0"
- platform: template
name: BAR3 button Left event
id: bar3_btn_left_event
event_types:
- "press page 0"
- "release page 0"
- "long press page 0"
- platform: template
name: BAR3 button Right event
id: bar3_btn_right_event
event_types:
- "press page 0"
- "release page 0"
- "long press page 0"
binary_sensor:
- id: !extend main_display_btn_left
on_click:
- script.execute: prev_page
- id: !extend main_display_btn_right
on_click:
- script.execute: next_page
- id: !extend bar1_btn_left
on_click:
lambda: |-
switch (id(actual_page)){
case 0:
id(bar1_btn_left_event).trigger("press page 0");
break;
}
on_release:
lambda: |-
switch (id(actual_page)){
case 0:
id(bar1_btn_left_event).trigger("release page 0");
break;
}
on_multi_click:
- timing:
- ON for at least 2s
then:
- lambda: |-
switch (id(actual_page)){
case 0:
id(bar1_btn_left_event).trigger("long press page 0");
break;
}
- id: !extend bar1_btn_right
on_click:
lambda: |-
switch (id(actual_page)){
case 0:
id(bar1_btn_right_event).trigger("press page 0");
break;
}
on_release:
lambda: |-
switch (id(actual_page)){
case 0:
id(bar1_btn_right_event).trigger("release page 0");
break;
}
on_multi_click:
- timing:
- ON for at least 2s
then:
- lambda: |-
switch (id(actual_page)){
case 0:
id(bar1_btn_right_event).trigger("long press page 0");
break;
}
- id: !extend bar2_btn_left
on_click:
lambda: |-
switch (id(actual_page)){
case 0:
id(bar2_btn_left_event).trigger("press page 0");
break;
}
on_release:
lambda: |-
switch (id(actual_page)){
case 0:
id(bar2_btn_left_event).trigger("release page 0");
break;
}
on_multi_click:
- timing:
- ON for at least 2s
then:
- lambda: |-
switch (id(actual_page)){
case 0:
id(bar2_btn_left_event).trigger("long press page 0");
break;
}
- id: !extend bar2_btn_right
on_click:
lambda: |-
switch (id(actual_page)){
case 0:
id(bar2_btn_right_event).trigger("press page 0");
break;
}
on_release:
lambda: |-
switch (id(actual_page)){
case 0:
id(bar2_btn_right_event).trigger("release page 0");
break;
}
on_multi_click:
- timing:
- ON for at least 2s
then:
- lambda: |-
switch (id(actual_page)){
case 0:
id(bar2_btn_right_event).trigger("long press page 0");
break;
}
- id: !extend bar3_btn_left
on_click:
lambda: |-
switch (id(actual_page)){
case 0:
id(bar3_btn_left_event).trigger("press page 0");
break;
}
on_release:
lambda: |-
switch (id(actual_page)){
case 0:
id(bar3_btn_left_event).trigger("release page 0");
break;
}
on_multi_click:
- timing:
- ON for at least 2s
then:
- lambda: |-
switch (id(actual_page)){
case 0:
id(bar3_btn_left_event).trigger("long press page 0");
break;
}
- id: !extend bar3_btn_right
on_click:
lambda: |-
switch (id(actual_page)){
case 0:
id(bar3_btn_right_event).trigger("press page 0");
break;
}
on_release:
lambda: |-
switch (id(actual_page)){
case 0:
id(bar3_btn_right_event).trigger("release page 0");
break;
}
on_multi_click:
- timing:
- ON for at least 2s
then:
lambda: |-
switch (id(actual_page)){
case 0:
id(bar3_btn_right_event).trigger("long press page 0");
break;
}
display:
#########
# MAIN ##