Files
ESPHome_ButtonPlusV2/package/1bar_1display_scripts.yaml
T
2024-11-30 18:00:41 +01:00

92 lines
3.2 KiB
YAML

##############################################
## ##
## filename: 1bar_1display_scripts.yaml ##
## description: Specific pre-defined ##
## scripts for 1 BAR 1 Display setup ##
## ##
##############################################
script:
######################
### update scripts ###
######################
- id: update_bar1_left
then:
- lambda: |-
id(cs_pin_bar1_left).turn_on(); // <<
id(cs_pin_bar1_right).turn_off();
id(bar_display).clear();
id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES);
id(bar1_left_draw).execute();
id(bar_display).update();
delay(1);
id(cs_pin_bar1_left).turn_off();
- id: update_bar1_right
then:
- lambda: |-
id(cs_pin_bar1_left).turn_off();
id(cs_pin_bar1_right).turn_on(); // <<
id(bar_display).clear();
id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES);
id(bar1_right_draw).execute();
id(bar_display).update();
delay(1);
id(cs_pin_bar1_right).turn_off();
##################################
### setup mini display scripts ###
##################################
- id: setup_bar_displays
then:
- lambda: |-
id(cs_pin_bar1_left).turn_on();
id(bar_display).setup();
id(cs_pin_bar1_left).turn_off();
delay(5);
id(cs_pin_bar1_right).turn_on();
id(bar_display).setup();
id(cs_pin_bar1_right).turn_off();
####################
### draw scripts ###
####################
- id: bar1_left_draw
then:
- lambda: |-
if (id(show_todos)) {
ESP_LOGD("TODO", "You need to extend the bar1_left_draw script to draw something on the bar display \n script: \n - id: !extend bar1_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!");
id(show_todos) = false;
}
- id: bar1_right_draw
then:
- lambda: |-
if (id(show_todos)) {
ESP_LOGD("TODO", "You need to extend the bar1_right_draw script to draw something on the bar display \n script: \n - id: !extend bar1_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!");
id(show_todos) = false;
}
##############################
### other handling scripts ###
##############################
- id: update_main
then:
- component.update: main_display
- id: update_all
then:
- component.update: main_display
- script.execute: update_bar1_left
- script.execute: update_bar1_right
- id: next_page_main
then:
- display.page.show_next: main_display
- script.execute: update_main
- id: next_page_all
then:
- display.page.show_next: main_display
- script.execute: update_all
- id: prev_page_main
then:
- display.page.show_previous: main_display
- script.execute: update_main
- id: prev_page_all
then:
- display.page.show_previous: main_display
- script.execute: update_all