From fac784fa64d80de6219de3547dc619ea9ecf3db0 Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 11 Nov 2024 19:03:51 +0100 Subject: [PATCH 01/77] display update should now be done dynamic --- README.md | 2 +- package/1bar_1display.yaml | 6 +++--- package/2bar_1display.yaml | 10 +++++----- package/3bar_1display.yaml | 14 +++++++------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 16e9f3a..d532ba0 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ The ESPHome integration adds more flexebility and features, but also add some mo [Dutch support topic on Tweakers.net](https://gathering.tweakers.net/forum/list_messages/2270086) ## Usefull Links diff --git a/package/1bar_1display.yaml b/package/1bar_1display.yaml index c03757f..e43e91e 100644 --- a/package/1bar_1display.yaml +++ b/package/1bar_1display.yaml @@ -101,6 +101,7 @@ display: platform: ili9xxx model: ili9341 color_order: rgb + update_interval: 30s invert_colors: false dc_pin: number: GPIO37 @@ -111,7 +112,6 @@ display: mode: output: true inverted: false - update_interval: 500ms show_test_card: false dimensions: height: 240 @@ -124,6 +124,7 @@ display: platform: ili9xxx model: ST7735 color_order: bgr + update_interval: never dc_pin: number: GPIO37 allow_other_uses: true @@ -140,11 +141,11 @@ display: width: 80 offset_width: 24 rotation: 270 - update_interval: 1s - id: display_j3_Right platform: ili9xxx model: ST7735 color_order: bgr + update_interval: never dc_pin: number: GPIO37 allow_other_uses: true @@ -161,4 +162,3 @@ display: width: 80 offset_width: 24 rotation: 90 - update_interval: 1s diff --git a/package/2bar_1display.yaml b/package/2bar_1display.yaml index 56eb870..0781ed5 100644 --- a/package/2bar_1display.yaml +++ b/package/2bar_1display.yaml @@ -156,6 +156,7 @@ display: model: ili9341 color_order: rgb invert_colors: false + update_interval: 30s dc_pin: number: GPIO37 allow_other_uses: true @@ -165,7 +166,6 @@ display: mode: output: true inverted: false - update_interval: 200ms show_test_card: false dimensions: height: 240 @@ -178,6 +178,7 @@ display: platform: ili9xxx model: ST7735 color_order: bgr + update_interval: never dc_pin: number: GPIO37 allow_other_uses: true @@ -194,11 +195,11 @@ display: width: 80 offset_width: 24 rotation: 270 - update_interval: 1s - id: display_j2_Right platform: ili9xxx model: ST7735 color_order: bgr + update_interval: never dc_pin: number: GPIO37 allow_other_uses: true @@ -215,7 +216,6 @@ display: width: 80 offset_width: 24 rotation: 90 - update_interval: 1s #################### ### BAR module 2 ### #################### @@ -223,6 +223,7 @@ display: platform: ili9xxx model: ST7735 color_order: bgr + update_interval: never dc_pin: number: GPIO37 allow_other_uses: true @@ -239,11 +240,11 @@ display: width: 80 offset_width: 24 rotation: 270 - update_interval: 1s - id: display_j3_Right platform: ili9xxx model: ST7735 color_order: bgr + update_interval: never dc_pin: number: GPIO37 allow_other_uses: true @@ -260,4 +261,3 @@ display: width: 80 offset_width: 24 rotation: 90 - update_interval: 1s diff --git a/package/3bar_1display.yaml b/package/3bar_1display.yaml index 6627695..63dbed1 100644 --- a/package/3bar_1display.yaml +++ b/package/3bar_1display.yaml @@ -210,6 +210,7 @@ display: model: ili9341 invert_colors: false color_order: rgb + update_interval: 30s dc_pin: number: GPIO37 allow_other_uses: true @@ -219,7 +220,6 @@ display: mode: output: true inverted: false - update_interval: 200ms show_test_card: false dimensions: height: 240 @@ -232,6 +232,7 @@ display: platform: ili9xxx model: ST7735 color_order: bgr + update_interval: never dc_pin: number: GPIO37 allow_other_uses: true @@ -248,11 +249,11 @@ display: width: 80 offset_width: 24 rotation: 270 - update_interval: 1s - id: display_j1_Right platform: ili9xxx model: ST7735 color_order: bgr + update_interval: never dc_pin: number: GPIO37 allow_other_uses: true @@ -269,7 +270,6 @@ display: width: 80 offset_width: 24 rotation: 90 - update_interval: 1s #################### ### BAR module 2 ### #################### @@ -277,6 +277,7 @@ display: platform: ili9xxx model: ST7735 color_order: bgr + update_interval: never dc_pin: number: GPIO37 allow_other_uses: true @@ -293,11 +294,11 @@ display: width: 80 offset_width: 24 rotation: 270 - update_interval: 1s - id: display_j2_Right platform: ili9xxx model: ST7735 color_order: bgr + update_interval: never dc_pin: number: GPIO37 allow_other_uses: true @@ -314,7 +315,6 @@ display: width: 80 offset_width: 24 rotation: 90 - update_interval: 1s #################### ### BAR module 3 ### #################### @@ -322,6 +322,7 @@ display: platform: ili9xxx model: ST7735 color_order: bgr + update_interval: never dc_pin: number: GPIO37 allow_other_uses: true @@ -338,11 +339,11 @@ display: width: 80 offset_width: 24 rotation: 270 - update_interval: 1s - id: display_j3_Right platform: ili9xxx model: ST7735 color_order: bgr + update_interval: never dc_pin: number: GPIO37 allow_other_uses: true @@ -359,4 +360,3 @@ display: width: 80 offset_width: 24 rotation: 90 - update_interval: 1s From 3c54e1e64ac6e5dfb86412f53ff97ed0cadab9f6 Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 11 Nov 2024 19:14:58 +0100 Subject: [PATCH 02/77] changed naming --- package/1bar_1display.yaml | 38 +++++++++++++-------------- package/2bar_1display.yaml | 42 ++++++++++++++--------------- package/3bar_1display.yaml | 54 +++++++++++++++++++------------------- 3 files changed, 67 insertions(+), 67 deletions(-) diff --git a/package/1bar_1display.yaml b/package/1bar_1display.yaml index e43e91e..14c876d 100644 --- a/package/1bar_1display.yaml +++ b/package/1bar_1display.yaml @@ -22,16 +22,16 @@ binary_sensor: ### Buttons Main Display ### ############################ - platform: gpio - id: 'base_j2_btn_left' - name: "Display button Left" + id: 'main_display_btn_left' + name: "Main Display button Left" pin: mcp23xxx: base_J2 number: 6 mode: INPUT_PULLUP inverted: true - platform: gpio - id: 'base_j2_btn_right' - name: "Display button Right" + id: 'main_display_btn_right' + name: "Main Display button Right" pin: mcp23xxx: base_J2 number: 2 @@ -42,16 +42,16 @@ binary_sensor: ### Buttons BAR module 1 ### ############################ - platform: gpio - id: 'base_j3_btn_left' - name: "BAR button Left" + id: 'bar1_btn_left' + name: "BAR 1 button Left" pin: mcp23xxx: base_J3 number: 6 mode: INPUT_PULLUP inverted: true - platform: gpio - id: 'base_j3_btn_right' - name: "BAR button Right" + id: 'bar1_btn_right' + name: "BAR 1 button Right" pin: mcp23xxx: base_J3 number: 2 @@ -65,29 +65,29 @@ light: ### RGB LED's BAR module ### ############################ - platform: partition - name: "BAR J3 Left RGB Front" - id: bar_j3_left_rgb_front + name: "BAR 1 Left RGB Front" + id: bar1_left_rgb_front segments: - id: neopixels from: 0 to: 0 - platform: partition - name: "BAR J3 Left RGB Back" - id: bar_j3_left_rgb_back + name: "BAR 1 Left RGB Back" + id: bar1_left_rgb_back segments: - id: neopixels from: 1 to: 1 - platform: partition - name: "BAR J3 Right RGB Front" - id: bar_j3_right_rgb_front + name: "BAR 1 Right RGB Front" + id: bar1_right_rgb_front segments: - id: neopixels from: 2 to: 2 - platform: partition - name: "BAR J3 Right RGB Back" - id: bar_j3_right_rgb_back + name: "BAR 1 Right RGB Back" + id: bar1_right_rgb_back segments: - id: neopixels from: 3 @@ -97,7 +97,7 @@ display: #################### ### Main Display ### #################### - - id: display_j2_main + - id: main_display platform: ili9xxx model: ili9341 color_order: rgb @@ -120,7 +120,7 @@ display: ################## ### BAR module ### ################## - - id: display_j3_Left + - id: display_bar1_left platform: ili9xxx model: ST7735 color_order: bgr @@ -141,7 +141,7 @@ display: width: 80 offset_width: 24 rotation: 270 - - id: display_j3_Right + - id: display_bar1_left platform: ili9xxx model: ST7735 color_order: bgr diff --git a/package/2bar_1display.yaml b/package/2bar_1display.yaml index 0781ed5..4c808f1 100644 --- a/package/2bar_1display.yaml +++ b/package/2bar_1display.yaml @@ -25,16 +25,16 @@ binary_sensor: ### Buttons Main Display ### ############################ - platform: gpio - id: 'base_j1_btn_left' - name: "Display button Left" + id: 'main_display_btn_left' + name: "Main Display button Left" pin: mcp23xxx: base_J1 number: 6 mode: INPUT_PULLUP inverted: true - platform: gpio - id: 'base_j1_btn_right' - name: "Display button Right" + id: 'main_display_btn_right' + name: "Main Display button Right" pin: mcp23xxx: base_J1 number: 2 @@ -45,7 +45,7 @@ binary_sensor: ### Buttons BAR module 1 ### ############################ - platform: gpio - id: 'base_j2_btn_left' + id: 'bar1_btn_left' name: "BAR 1 button Left" pin: mcp23xxx: base_J2 @@ -53,7 +53,7 @@ binary_sensor: mode: INPUT_PULLUP inverted: true - platform: gpio - id: 'base_j2_btn_right' + id: 'bar1_btn_right' name: "BAR 1 button Right" pin: mcp23xxx: base_J2 @@ -65,7 +65,7 @@ binary_sensor: ### Buttons BAR module 2 ### ############################ - platform: gpio - id: 'base_j3_btn_left' + id: 'bar2_btn_left' name: "BAR 2 button Left" pin: mcp23xxx: base_J3 @@ -73,7 +73,7 @@ binary_sensor: mode: INPUT_PULLUP inverted: true - platform: gpio - id: 'base_j3_btn_right' + id: 'bar2_btn_right' name: "BAR 2 button Right" pin: mcp23xxx: base_J3 @@ -89,28 +89,28 @@ light: ############################## - platform: partition name: "BAR 1 Left RGB Front" - id: bar_1_left_rgb_front + id: bar1_left_rgb_front segments: - id: neopixels from: 0 to: 0 - platform: partition name: "BAR 1 Left RGB Back" - id: bar_1_left_rgb_back + id: bar1_left_rgb_back segments: - id: neopixels from: 1 to: 1 - platform: partition name: "BAR 1 Right RGB Front" - id: bar_1_right_rgb_front + id: bar1_right_rgb_front segments: - id: neopixels from: 2 to: 2 - platform: partition name: "BAR 1 Right RGB Back" - id: bar_1_right_rgb_back + id: bar1_right_rgb_back segments: - id: neopixels from: 3 @@ -120,28 +120,28 @@ light: ############################## - platform: partition name: "BAR 2 Left RGB Front" - id: bar_2_left_rgb_front + id: bar2_left_rgb_front segments: - id: neopixels from: 4 to: 4 - platform: partition name: "BAR 2 Left RGB Back" - id: bar_2_left_rgb_back + id: bar2_left_rgb_back segments: - id: neopixels from: 5 to: 5 - platform: partition name: "BAR 2 Right RGB Front" - id: bar_2_right_rgb_front + id: bar2_right_rgb_front segments: - id: neopixels from: 6 to: 6 - platform: partition name: "BAR 2 Right RGB Back" - id: bar_2_right_rgb_back + id: bar2_right_rgb_back segments: - id: neopixels from: 7 @@ -151,7 +151,7 @@ display: #################### ### Main Display ### #################### - - id: display_j1_main + - id: main_display platform: ili9xxx model: ili9341 color_order: rgb @@ -174,7 +174,7 @@ display: #################### ### BAR module 1 ### #################### - - id: display_j2_Left + - id: display_bar1_left platform: ili9xxx model: ST7735 color_order: bgr @@ -195,7 +195,7 @@ display: width: 80 offset_width: 24 rotation: 270 - - id: display_j2_Right + - id: display_bar1_right platform: ili9xxx model: ST7735 color_order: bgr @@ -219,7 +219,7 @@ display: #################### ### BAR module 2 ### #################### - - id: display_j3_Left + - id: display_bar2_left platform: ili9xxx model: ST7735 color_order: bgr @@ -240,7 +240,7 @@ display: width: 80 offset_width: 24 rotation: 270 - - id: display_j3_Right + - id: display_bar2_right platform: ili9xxx model: ST7735 color_order: bgr diff --git a/package/3bar_1display.yaml b/package/3bar_1display.yaml index 63dbed1..cbe1b80 100644 --- a/package/3bar_1display.yaml +++ b/package/3bar_1display.yaml @@ -28,7 +28,7 @@ binary_sensor: ### Buttons Main Display ### ############################ - platform: gpio - id: 'base_j0_btn_left' + id: 'main_display_btn_left' name: "Display button Left" pin: mcp23xxx: base_J0 @@ -36,7 +36,7 @@ binary_sensor: mode: INPUT_PULLUP inverted: true - platform: gpio - id: 'base_j0_btn_right' + id: 'main_display_btn_right' name: "Display button Right" pin: mcp23xxx: base_J0 @@ -48,7 +48,7 @@ binary_sensor: ### Buttons BAR module 1 ### ############################ - platform: gpio - id: 'base_j1_btn_left' + id: 'bar1_btn_left' name: "BAR 1 button Left" pin: mcp23xxx: base_J1 @@ -56,7 +56,7 @@ binary_sensor: mode: INPUT_PULLUP inverted: true - platform: gpio - id: 'base_j1_btn_right' + id: 'bar1_btn_right' name: "BAR 1 button Right" pin: mcp23xxx: base_J1 @@ -68,7 +68,7 @@ binary_sensor: ### Buttons BAR module 2 ### ############################ - platform: gpio - id: 'base_j2_btn_left' + id: 'bar2_btn_left' name: "BAR 2 button Left" pin: mcp23xxx: base_J2 @@ -76,7 +76,7 @@ binary_sensor: mode: INPUT_PULLUP inverted: true - platform: gpio - id: 'base_j2_btn_right' + id: 'bar2_btn_right' name: "BAR 2 button Right" pin: mcp23xxx: base_J2 @@ -88,7 +88,7 @@ binary_sensor: ### Buttons BAR module 3 ### ############################ - platform: gpio - id: 'base_j3_btn_left' + id: 'bar3_btn_left' name: "BAR 3 button Left" pin: mcp23xxx: base_J3 @@ -96,7 +96,7 @@ binary_sensor: mode: INPUT_PULLUP inverted: true - platform: gpio - id: 'base_j3_btn_right' + id: 'bar3_btn_right' name: "BAR 3 button Right" pin: mcp23xxx: base_J3 @@ -112,28 +112,28 @@ light: ############################## - platform: partition name: "BAR 1 Left RGB Front" - id: bar_1_left_rgb_front + id: bar1_left_rgb_front segments: - id: neopixels from: 0 to: 0 - platform: partition name: "BAR 1 Left RGB Back" - id: bar_1_left_rgb_back + id: bar1_left_rgb_back segments: - id: neopixels from: 1 to: 1 - platform: partition name: "BAR 1 Right RGB Front" - id: bar_1_right_rgb_front + id: bar1_right_rgb_front segments: - id: neopixels from: 2 to: 2 - platform: partition name: "BAR 1 Right RGB Back" - id: bar_1_right_rgb_back + id: bar1_right_rgb_back segments: - id: neopixels from: 3 @@ -143,28 +143,28 @@ light: ############################## - platform: partition name: "BAR 2 Left RGB Front" - id: bar_2_left_rgb_front + id: bar2_left_rgb_front segments: - id: neopixels from: 4 to: 4 - platform: partition name: "BAR 2 Left RGB Back" - id: bar_2_left_rgb_back + id: bar2_left_rgb_back segments: - id: neopixels from: 5 to: 5 - platform: partition name: "BAR 2 Right RGB Front" - id: bar_2_right_rgb_front + id: bar2_right_rgb_front segments: - id: neopixels from: 6 to: 6 - platform: partition name: "BAR 2 Right RGB Back" - id: bar_2_right_rgb_back + id: bar2_right_rgb_back segments: - id: neopixels from: 7 @@ -174,28 +174,28 @@ light: ############################## - platform: partition name: "BAR 3 Left RGB Front" - id: bar_3_left_rgb_front + id: bar3_left_rgb_front segments: - id: neopixels from: 8 to: 8 - platform: partition name: "BAR 3 Left RGB Back" - id: bar_3_left_rgb_back + id: bar3_left_rgb_back segments: - id: neopixels from: 9 to: 9 - platform: partition name: "BAR 3 Right RGB Front" - id: bar_3_right_rgb_front + id: bar3_right_rgb_front segments: - id: neopixels from: 10 to: 10 - platform: partition name: "BAR 3 Right RGB Back" - id: bar_3_right_rgb_back + id: bar3_right_rgb_back segments: - id: neopixels from: 11 @@ -205,7 +205,7 @@ display: #################### ### Main Display ### #################### - - id: display_j0_main + - id: main_display platform: ili9xxx model: ili9341 invert_colors: false @@ -228,7 +228,7 @@ display: #################### ### BAR module 1 ### #################### - - id: display_j1_Left + - id: display_bar1_left platform: ili9xxx model: ST7735 color_order: bgr @@ -249,7 +249,7 @@ display: width: 80 offset_width: 24 rotation: 270 - - id: display_j1_Right + - id: display_bar1_right platform: ili9xxx model: ST7735 color_order: bgr @@ -273,7 +273,7 @@ display: #################### ### BAR module 2 ### #################### - - id: display_j2_Left + - id: display_bar2_left platform: ili9xxx model: ST7735 color_order: bgr @@ -294,7 +294,7 @@ display: width: 80 offset_width: 24 rotation: 270 - - id: display_j2_Right + - id: display_bar2_right platform: ili9xxx model: ST7735 color_order: bgr @@ -318,7 +318,7 @@ display: #################### ### BAR module 3 ### #################### - - id: display_j3_Left + - id: display_bar3_left platform: ili9xxx model: ST7735 color_order: bgr @@ -339,7 +339,7 @@ display: width: 80 offset_width: 24 rotation: 270 - - id: display_j3_Right + - id: display_bar3_right platform: ili9xxx model: ST7735 color_order: bgr From 30f39857b04022e3f38f9a3dfaafe849781df87b Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 11 Nov 2024 19:23:17 +0100 Subject: [PATCH 03/77] display_barX to barX_display feels more convenient --- package/1bar_1display.yaml | 4 ++-- package/2bar_1display.yaml | 8 ++++---- package/3bar_1display.yaml | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package/1bar_1display.yaml b/package/1bar_1display.yaml index 14c876d..b445575 100644 --- a/package/1bar_1display.yaml +++ b/package/1bar_1display.yaml @@ -120,7 +120,7 @@ display: ################## ### BAR module ### ################## - - id: display_bar1_left + - id: bar1_display_left platform: ili9xxx model: ST7735 color_order: bgr @@ -141,7 +141,7 @@ display: width: 80 offset_width: 24 rotation: 270 - - id: display_bar1_left + - id: bar1_display_left platform: ili9xxx model: ST7735 color_order: bgr diff --git a/package/2bar_1display.yaml b/package/2bar_1display.yaml index 4c808f1..f7a3396 100644 --- a/package/2bar_1display.yaml +++ b/package/2bar_1display.yaml @@ -174,7 +174,7 @@ display: #################### ### BAR module 1 ### #################### - - id: display_bar1_left + - id: bar1_display_left platform: ili9xxx model: ST7735 color_order: bgr @@ -195,7 +195,7 @@ display: width: 80 offset_width: 24 rotation: 270 - - id: display_bar1_right + - id: bar1_display_right platform: ili9xxx model: ST7735 color_order: bgr @@ -219,7 +219,7 @@ display: #################### ### BAR module 2 ### #################### - - id: display_bar2_left + - id: bar2_display_left platform: ili9xxx model: ST7735 color_order: bgr @@ -240,7 +240,7 @@ display: width: 80 offset_width: 24 rotation: 270 - - id: display_bar2_right + - id: bar2_display_right platform: ili9xxx model: ST7735 color_order: bgr diff --git a/package/3bar_1display.yaml b/package/3bar_1display.yaml index cbe1b80..2fdf957 100644 --- a/package/3bar_1display.yaml +++ b/package/3bar_1display.yaml @@ -228,7 +228,7 @@ display: #################### ### BAR module 1 ### #################### - - id: display_bar1_left + - id: bar1_display_left platform: ili9xxx model: ST7735 color_order: bgr @@ -249,7 +249,7 @@ display: width: 80 offset_width: 24 rotation: 270 - - id: display_bar1_right + - id: bar1_display_right platform: ili9xxx model: ST7735 color_order: bgr @@ -273,7 +273,7 @@ display: #################### ### BAR module 2 ### #################### - - id: display_bar2_left + - id: bar2_display_left platform: ili9xxx model: ST7735 color_order: bgr @@ -294,7 +294,7 @@ display: width: 80 offset_width: 24 rotation: 270 - - id: display_bar2_right + - id: bar2_display_right platform: ili9xxx model: ST7735 color_order: bgr @@ -318,7 +318,7 @@ display: #################### ### BAR module 3 ### #################### - - id: display_bar3_left + - id: bar3_display_left platform: ili9xxx model: ST7735 color_order: bgr @@ -339,7 +339,7 @@ display: width: 80 offset_width: 24 rotation: 270 - - id: display_bar3_right + - id: bar3_display_right platform: ili9xxx model: ST7735 color_order: bgr From 62f045a71d7a9e0d06baf2e934d9b6f470fc0d43 Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 12 Nov 2024 19:03:13 +0100 Subject: [PATCH 04/77] made some basic scripts for every setup --- package/1bar_1display.yaml | 1 + package/1bar_1display_scripts.yaml | 37 ++++++++++++++++++++++ package/2bar_1display.yaml | 1 + package/2bar_1display_scripts.yaml | 43 ++++++++++++++++++++++++++ package/3bar_1display.yaml | 1 + package/3bar_1display_scripts.yaml | 49 ++++++++++++++++++++++++++++++ 6 files changed, 132 insertions(+) create mode 100644 package/1bar_1display_scripts.yaml create mode 100644 package/2bar_1display_scripts.yaml create mode 100644 package/3bar_1display_scripts.yaml diff --git a/package/1bar_1display.yaml b/package/1bar_1display.yaml index b445575..a73d658 100644 --- a/package/1bar_1display.yaml +++ b/package/1bar_1display.yaml @@ -8,6 +8,7 @@ packages: base: !include base.yaml + scripts: !include 1bar_1display_scripts.yaml mcp23008: - id: 'base_J2' diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml new file mode 100644 index 0000000..bfd3ef1 --- /dev/null +++ b/package/1bar_1display_scripts.yaml @@ -0,0 +1,37 @@ +############################################## +## ## +## filename: 1bar_1display_scripts.yaml ## +## description: Specific pre-defined ## +## scripts for 1 BAR 1 Display setup ## +## ## +############################################## + +script: + - id: update_main + then: + - component.update: main_display + - id: update_all + then: + - component.update: main_display + - component.update: bar1_display_left + - component.update: bar1_display_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 + - display.page.show_next: bar1_display_left + - display.page.show_next: bar1_display_right + - 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 + - display.page.show_previous: bar1_display_left + - display.page.show_previous: bar1_display_right + - script.execute: update_all diff --git a/package/2bar_1display.yaml b/package/2bar_1display.yaml index f7a3396..b33d72a 100644 --- a/package/2bar_1display.yaml +++ b/package/2bar_1display.yaml @@ -8,6 +8,7 @@ packages: base: !include base.yaml + scripts: !include 1bar_1display_scripts.yaml mcp23008: - id: 'base_J1' diff --git a/package/2bar_1display_scripts.yaml b/package/2bar_1display_scripts.yaml new file mode 100644 index 0000000..5e25269 --- /dev/null +++ b/package/2bar_1display_scripts.yaml @@ -0,0 +1,43 @@ +############################################## +## ## +## filename: 1bar_1display_scripts.yaml ## +## description: Specific pre-defined ## +## scripts for 2 BAR 1 Display setup ## +## ## +############################################## + +script: + - id: update_main + then: + - component.update: main_display + - id: update_all + then: + - component.update: main_display + - component.update: bar1_display_left + - component.update: bar1_display_right + - component.update: bar2_display_left + - component.update: bar2_display_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 + - display.page.show_next: bar1_display_left + - display.page.show_next: bar1_display_right + - display.page.show_next: bar2_display_left + - display.page.show_next: bar2_display_right + - 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 + - display.page.show_previous: bar1_display_left + - display.page.show_previous: bar1_display_right + - display.page.show_previous: bar2_display_left + - display.page.show_previous: bar2_display_right + - script.execute: update_all diff --git a/package/3bar_1display.yaml b/package/3bar_1display.yaml index 2fdf957..651dd9b 100644 --- a/package/3bar_1display.yaml +++ b/package/3bar_1display.yaml @@ -8,6 +8,7 @@ packages: base: !include base.yaml + scripts: !include 1bar_1display_scripts.yaml mcp23008: - id: 'base_J0' diff --git a/package/3bar_1display_scripts.yaml b/package/3bar_1display_scripts.yaml new file mode 100644 index 0000000..581fa41 --- /dev/null +++ b/package/3bar_1display_scripts.yaml @@ -0,0 +1,49 @@ +############################################## +## ## +## filename: 1bar_1display_scripts.yaml ## +## description: Specific pre-defined ## +## scripts for 3 BAR 1 Display setup ## +## ## +############################################## + +script: + - id: update_main + then: + - component.update: main_display + - id: update_all + then: + - component.update: main_display + - component.update: bar1_display_left + - component.update: bar1_display_right + - component.update: bar2_display_left + - component.update: bar2_display_right + - component.update: bar3_display_left + - component.update: bar3_display_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 + - display.page.show_next: bar1_display_left + - display.page.show_next: bar1_display_right + - display.page.show_next: bar2_display_left + - display.page.show_next: bar2_display_right + - display.page.show_next: bar3_display_left + - display.page.show_next: bar3_display_right + - 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 + - display.page.show_previous: bar1_display_left + - display.page.show_previous: bar1_display_right + - display.page.show_previous: bar2_display_left + - display.page.show_previous: bar2_display_right + - display.page.show_previous: bar3_display_left + - display.page.show_previous: bar3_display_right + - script.execute: update_all From 9171849f94b876b6bf315d5a2df5c6f337efbd7e Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 12 Nov 2024 19:03:31 +0100 Subject: [PATCH 05/77] added first music card --- package/cards/music.yaml | 91 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 package/cards/music.yaml diff --git a/package/cards/music.yaml b/package/cards/music.yaml new file mode 100644 index 0000000..182614c --- /dev/null +++ b/package/cards/music.yaml @@ -0,0 +1,91 @@ +##################################################### +## +## FILENAME: cards/music.yaml +## DESCRIPTION: card that shows info +## about the current played song and +## players current state +## USAGE: +## package: +## ... +## card_music: !include +## file: cards/music.yaml +## vars: +## entity_id: media_player.xxxx +## +## display: +## - id: !extend main_display +## pages: +## - id: player_page +## lambda: |- +## id(all_pages).execute(); +## // insert music card: +## // >> id(music_card).execute(x, y); +## id(music_card).execute(20, 125); +## +##################################################### + +image: + - file: mdi:music-box-outline + id: icon_music_album + resize: 20x20 + - file: mdi:account-music + id: icon_music_artist + resize: 20x20 + - file: mdi:music-note + id: icon_music_songtitle + resize: 20x20 + +text_sensor: + - platform: homeassistant + id: music_album + entity_id: ${entity_id} + attribute: media_album_name + on_value: + - script.execute: update_main + - platform: homeassistant + id: music_artist + entity_id: ${entity_id} + attribute: media_artist + - platform: homeassistant + id: music_title + entity_id: ${entity_id} + attribute: media_title + on_value: + - script.execute: update_main + - platform: homeassistant + id: music_playerstate + entity_id: ${entity_id} + on_value: + - script.execute: update_main + +script: + - id: music_card + parameters: + x: int + y: int + then: + - lambda: |- + id(display_j2_main).print(60+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_playerstate).state.c_str()); + // switch (id(music_playerstate)){ + // case 1: + // it.print(0, 1, "Page1"); + // break; + // case 2: + // it.print(0, 1, "Page2"); + // break; + // case 3: + // it.print(0, 1, "Page3"); + // break; + // } + // + // album + id(display_j2_main).image(3+x, 4+y, id(icon_music_album), ImageAlign::TOP_LEFT, id(orange)); + id(display_j2_main).print(25+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_album).state.c_str()); + // + // artist + id(display_j2_main).image(3+x, 30+y, id(icon_music_artist), ImageAlign::TOP_LEFT, id(orange)); + id(display_j2_main).print(25+x, 26+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_artist).state.c_str()); + // + // song title + id(display_j2_main).image(3+x, 56+y, id(icon_music_songtitle), ImageAlign::TOP_LEFT, id(orange)); + id(display_j2_main).print(25+x, 52+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_title).state.c_str()); \ No newline at end of file From 5b75c87ea43d4a4ab0d79980ae195f35ecacd2cf Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 12 Nov 2024 19:10:53 +0100 Subject: [PATCH 06/77] fix double id --- package/1bar_1display.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/1bar_1display.yaml b/package/1bar_1display.yaml index a73d658..5a1de78 100644 --- a/package/1bar_1display.yaml +++ b/package/1bar_1display.yaml @@ -142,7 +142,7 @@ display: width: 80 offset_width: 24 rotation: 270 - - id: bar1_display_left + - id: bar1_display_right platform: ili9xxx model: ST7735 color_order: bgr From 85afea7c11ccc515654fc2b0df296ac60c79e6dd Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 12 Nov 2024 19:33:46 +0100 Subject: [PATCH 07/77] change var name --- package/cards/music.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index 182614c..c899d8e 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -38,23 +38,23 @@ image: text_sensor: - platform: homeassistant id: music_album - entity_id: ${entity_id} + entity_id: ${music_card_enity_id} attribute: media_album_name on_value: - script.execute: update_main - platform: homeassistant id: music_artist - entity_id: ${entity_id} + entity_id: ${music_card_enity_id} attribute: media_artist - platform: homeassistant id: music_title - entity_id: ${entity_id} + entity_id: ${music_card_enity_id} attribute: media_title on_value: - script.execute: update_main - platform: homeassistant id: music_playerstate - entity_id: ${entity_id} + entity_id: ${music_card_enity_id} on_value: - script.execute: update_main From 2984b60d6713c5bd6c8d02a4732a70460f943d7a Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 12 Nov 2024 19:37:08 +0100 Subject: [PATCH 08/77] get var with lambda --- package/cards/music.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index c899d8e..ba568fc 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -38,23 +38,23 @@ image: text_sensor: - platform: homeassistant id: music_album - entity_id: ${music_card_enity_id} + entity_id: !lambda return id(music_card_enity_id); attribute: media_album_name on_value: - script.execute: update_main - platform: homeassistant id: music_artist - entity_id: ${music_card_enity_id} + entity_id: !lambda return id(music_card_enity_id); attribute: media_artist - platform: homeassistant id: music_title - entity_id: ${music_card_enity_id} + entity_id: !lambda return id(music_card_enity_id); attribute: media_title on_value: - script.execute: update_main - platform: homeassistant id: music_playerstate - entity_id: ${music_card_enity_id} + entity_id: !lambda return id(music_card_enity_id); on_value: - script.execute: update_main From 19f794fa4395e364f5a0c6460339f8874c6ce5c1 Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 12 Nov 2024 20:26:20 +0100 Subject: [PATCH 09/77] back to var --- package/cards/music.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index ba568fc..c899d8e 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -38,23 +38,23 @@ image: text_sensor: - platform: homeassistant id: music_album - entity_id: !lambda return id(music_card_enity_id); + entity_id: ${music_card_enity_id} attribute: media_album_name on_value: - script.execute: update_main - platform: homeassistant id: music_artist - entity_id: !lambda return id(music_card_enity_id); + entity_id: ${music_card_enity_id} attribute: media_artist - platform: homeassistant id: music_title - entity_id: !lambda return id(music_card_enity_id); + entity_id: ${music_card_enity_id} attribute: media_title on_value: - script.execute: update_main - platform: homeassistant id: music_playerstate - entity_id: !lambda return id(music_card_enity_id); + entity_id: ${music_card_enity_id} on_value: - script.execute: update_main From 502028d9a8328b5a6f4630820be68ab96fe6794a Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 12 Nov 2024 20:27:44 +0100 Subject: [PATCH 10/77] wrong main display id --- package/cards/music.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index c899d8e..982310d 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -65,7 +65,7 @@ script: y: int then: - lambda: |- - id(display_j2_main).print(60+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_playerstate).state.c_str()); + id(main_display).print(60+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_playerstate).state.c_str()); // switch (id(music_playerstate)){ // case 1: // it.print(0, 1, "Page1"); @@ -79,13 +79,13 @@ script: // } // // album - id(display_j2_main).image(3+x, 4+y, id(icon_music_album), ImageAlign::TOP_LEFT, id(orange)); - id(display_j2_main).print(25+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_album).state.c_str()); + id(main_display).image(3+x, 4+y, id(icon_music_album), ImageAlign::TOP_LEFT, id(orange)); + id(main_display).print(25+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_album).state.c_str()); // // artist - id(display_j2_main).image(3+x, 30+y, id(icon_music_artist), ImageAlign::TOP_LEFT, id(orange)); - id(display_j2_main).print(25+x, 26+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_artist).state.c_str()); + id(main_display).image(3+x, 30+y, id(icon_music_artist), ImageAlign::TOP_LEFT, id(orange)); + id(main_display).print(25+x, 26+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_artist).state.c_str()); // // song title - id(display_j2_main).image(3+x, 56+y, id(icon_music_songtitle), ImageAlign::TOP_LEFT, id(orange)); - id(display_j2_main).print(25+x, 52+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_title).state.c_str()); \ No newline at end of file + id(main_display).image(3+x, 56+y, id(icon_music_songtitle), ImageAlign::TOP_LEFT, id(orange)); + id(main_display).print(25+x, 52+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_title).state.c_str()); \ No newline at end of file From e7e14551825f1ed1baea2a913b37ea7d31dcf876 Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 12 Nov 2024 20:47:12 +0100 Subject: [PATCH 11/77] added 2 states of the player with icons --- package/cards/music.yaml | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index 982310d..e856d0a 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -34,6 +34,12 @@ image: - file: mdi:music-note id: icon_music_songtitle resize: 20x20 + - file: mdi:pause-box-outline + id: icon_music_pause + resize: 75x75 + - file: mdi:play-box-outline + id: icon_music_play + resize: 75x75 text_sensor: - platform: homeassistant @@ -65,27 +71,27 @@ script: y: int then: - lambda: |- - id(main_display).print(60+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_playerstate).state.c_str()); - // switch (id(music_playerstate)){ - // case 1: - // it.print(0, 1, "Page1"); + // id(main_display).print(60+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_playerstate).state.c_str()); + switch (id(music_playerstate).state.c_str()){ + case 'paused': + id(main_display).image(x, 1+y, id(icon_music_pause), ImageAlign::TOP_LEFT, id(orange)); + break; + case 'playing': + id(main_display).image(x, 1+y, id(icon_music_play), ImageAlign::TOP_LEFT, id(orange)); + break; + // case 'idle': + // //it.print(0, 1, "Page3"); // break; - // case 2: - // it.print(0, 1, "Page2"); - // break; - // case 3: - // it.print(0, 1, "Page3"); - // break; - // } + } // // album - id(main_display).image(3+x, 4+y, id(icon_music_album), ImageAlign::TOP_LEFT, id(orange)); - id(main_display).print(25+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_album).state.c_str()); + id(main_display).image(75+3+x, 4+y, id(icon_music_album), ImageAlign::TOP_LEFT, id(orange)); + id(main_display).print(75+25+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_album).state.c_str()); // // artist - id(main_display).image(3+x, 30+y, id(icon_music_artist), ImageAlign::TOP_LEFT, id(orange)); - id(main_display).print(25+x, 26+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_artist).state.c_str()); + id(main_display).image(75+3+x, 30+y, id(icon_music_artist), ImageAlign::TOP_LEFT, id(orange)); + id(main_display).print(75+25+x, 26+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_artist).state.c_str()); // // song title - id(main_display).image(3+x, 56+y, id(icon_music_songtitle), ImageAlign::TOP_LEFT, id(orange)); - id(main_display).print(25+x, 52+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_title).state.c_str()); \ No newline at end of file + id(main_display).image(75+3+x, 56+y, id(icon_music_songtitle), ImageAlign::TOP_LEFT, id(orange)); + id(main_display).print(75+25+x, 52+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_title).state.c_str()); \ No newline at end of file From 9471cf378f78c63898cfe316580a0508afeefdb6 Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 12 Nov 2024 20:54:07 +0100 Subject: [PATCH 12/77] not string --- package/cards/music.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index e856d0a..6bc8576 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -72,13 +72,13 @@ script: then: - lambda: |- // id(main_display).print(60+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_playerstate).state.c_str()); - switch (id(music_playerstate).state.c_str()){ - case 'paused': - id(main_display).image(x, 1+y, id(icon_music_pause), ImageAlign::TOP_LEFT, id(orange)); - break; - case 'playing': - id(main_display).image(x, 1+y, id(icon_music_play), ImageAlign::TOP_LEFT, id(orange)); - break; + switch (id(music_playerstate)){ + case 'paused': + id(main_display).image(x, 1+y, id(icon_music_pause), ImageAlign::TOP_LEFT, id(orange)); + break; + case 'playing': + id(main_display).image(x, 1+y, id(icon_music_play), ImageAlign::TOP_LEFT, id(orange)); + break; // case 'idle': // //it.print(0, 1, "Page3"); // break; From de065ee8c09369acb69f765d89d479d375560b67 Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 12 Nov 2024 20:58:20 +0100 Subject: [PATCH 13/77] switch can only handle int's so now we use if/else if --- package/cards/music.yaml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index 6bc8576..4b60081 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -72,16 +72,10 @@ script: then: - lambda: |- // id(main_display).print(60+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_playerstate).state.c_str()); - switch (id(music_playerstate)){ - case 'paused': + if (id(music_playerstate).).state.c_str() == 'paused'){ id(main_display).image(x, 1+y, id(icon_music_pause), ImageAlign::TOP_LEFT, id(orange)); - break; - case 'playing': + } else if (id(music_playerstate).).state.c_str() == 'playing') { id(main_display).image(x, 1+y, id(icon_music_play), ImageAlign::TOP_LEFT, id(orange)); - break; - // case 'idle': - // //it.print(0, 1, "Page3"); - // break; } // // album From c4138626dfcdbd93b32ef1a1b9c4bc40003a158e Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 12 Nov 2024 20:59:34 +0100 Subject: [PATCH 14/77] autocomplete correction... --- package/cards/music.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index 4b60081..8c601d5 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -72,9 +72,9 @@ script: then: - lambda: |- // id(main_display).print(60+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_playerstate).state.c_str()); - if (id(music_playerstate).).state.c_str() == 'paused'){ + if (id(music_playerstate).state.c_str() == 'paused'){ id(main_display).image(x, 1+y, id(icon_music_pause), ImageAlign::TOP_LEFT, id(orange)); - } else if (id(music_playerstate).).state.c_str() == 'playing') { + } else if (id(music_playerstate).state.c_str() == 'playing') { id(main_display).image(x, 1+y, id(icon_music_play), ImageAlign::TOP_LEFT, id(orange)); } // From 35445fd9c868c626e23e22595972995df60d4a97 Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 12 Nov 2024 21:03:40 +0100 Subject: [PATCH 15/77] without .c_str() --- package/cards/music.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index 8c601d5..25fc6e2 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -72,9 +72,9 @@ script: then: - lambda: |- // id(main_display).print(60+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_playerstate).state.c_str()); - if (id(music_playerstate).state.c_str() == 'paused'){ + if (id(music_playerstate).state == 'paused'){ id(main_display).image(x, 1+y, id(icon_music_pause), ImageAlign::TOP_LEFT, id(orange)); - } else if (id(music_playerstate).state.c_str() == 'playing') { + } else if (id(music_playerstate).state == 'playing') { id(main_display).image(x, 1+y, id(icon_music_play), ImageAlign::TOP_LEFT, id(orange)); } // From 1939ab793107a1a613e70ef5ce8944a589f85fbe Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 12 Nov 2024 21:10:24 +0100 Subject: [PATCH 16/77] with strcmp() --- package/cards/music.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index 25fc6e2..b1b3a80 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -72,9 +72,9 @@ script: then: - lambda: |- // id(main_display).print(60+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_playerstate).state.c_str()); - if (id(music_playerstate).state == 'paused'){ + if (strcmp(id(music_playerstate).state.c_str(), "paused") == 0) { id(main_display).image(x, 1+y, id(icon_music_pause), ImageAlign::TOP_LEFT, id(orange)); - } else if (id(music_playerstate).state == 'playing') { + } else if (strcmp(id(music_playerstate).state.c_str(), "playing") == 0) { id(main_display).image(x, 1+y, id(icon_music_play), ImageAlign::TOP_LEFT, id(orange)); } // From 41f58c8613fc6506aebf338a029dde9ada2f5ae0 Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 12 Nov 2024 21:28:04 +0100 Subject: [PATCH 17/77] finisched player states --- package/cards/music.yaml | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index b1b3a80..03a56ec 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -34,12 +34,27 @@ image: - file: mdi:music-note id: icon_music_songtitle resize: 20x20 - - file: mdi:pause-box-outline - id: icon_music_pause + - file: mdi:power-off + id: icon_music_off + resize: 75x75 + - file: mdi:power-on + id: icon_music_on + resize: 75x75 + - file: mdi:timer-sand-empty + id: icon_music_idle resize: 75x75 - file: mdi:play-box-outline id: icon_music_play resize: 75x75 + - file: mdi:pause-box-outline + id: icon_music_pause + resize: 75x75 + - file: mdi:power + id: icon_music_standby + resize: 75x75 + - file: mdi:download-box-outline + id: icon_music_buffering + resize: 75x75 text_sensor: - platform: homeassistant @@ -71,11 +86,21 @@ script: y: int then: - lambda: |- - // id(main_display).print(60+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_playerstate).state.c_str()); - if (strcmp(id(music_playerstate).state.c_str(), "paused") == 0) { - id(main_display).image(x, 1+y, id(icon_music_pause), ImageAlign::TOP_LEFT, id(orange)); + // player state + if (strcmp(id(music_playerstate).state.c_str(), "off") == 0) { + id(main_display).image(x, 1+y, id(icon_music_off), ImageAlign::TOP_LEFT, id(orange)); + } else if (strcmp(id(music_playerstate).state.c_str(), "on") == 0) { + id(main_display).image(x, 1+y, id(icon_music_on), ImageAlign::TOP_LEFT, id(orange)); + } else if (strcmp(id(music_playerstate).state.c_str(), "idle") == 0) { + id(main_display).image(x, 1+y, id(icon_music_idle), ImageAlign::TOP_LEFT, id(orange)); } else if (strcmp(id(music_playerstate).state.c_str(), "playing") == 0) { id(main_display).image(x, 1+y, id(icon_music_play), ImageAlign::TOP_LEFT, id(orange)); + } else if (strcmp(id(music_playerstate).state.c_str(), "paused") == 0) { + id(main_display).image(x, 1+y, id(icon_music_pause), ImageAlign::TOP_LEFT, id(orange)); + } else if (strcmp(id(music_playerstate).state.c_str(), "standby") == 0) { + id(main_display).image(x, 1+y, id(icon_music_standby), ImageAlign::TOP_LEFT, id(orange)); + } else if (strcmp(id(music_playerstate).state.c_str(), "buffering") == 0) { + id(main_display).image(x, 1+y, id(icon_music_buffering), ImageAlign::TOP_LEFT, id(orange)); } // // album From 2606575c4b528b1bdf7fb0804bd7ae4eeaba86d6 Mon Sep 17 00:00:00 2001 From: Martijn Date: Wed, 13 Nov 2024 17:27:18 +0100 Subject: [PATCH 18/77] now have the correct script file --- package/2bar_1display.yaml | 2 +- package/3bar_1display.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/2bar_1display.yaml b/package/2bar_1display.yaml index b33d72a..55dab5b 100644 --- a/package/2bar_1display.yaml +++ b/package/2bar_1display.yaml @@ -8,7 +8,7 @@ packages: base: !include base.yaml - scripts: !include 1bar_1display_scripts.yaml + scripts: !include 2bar_1display_scripts.yaml mcp23008: - id: 'base_J1' diff --git a/package/3bar_1display.yaml b/package/3bar_1display.yaml index 651dd9b..82b1469 100644 --- a/package/3bar_1display.yaml +++ b/package/3bar_1display.yaml @@ -8,7 +8,7 @@ packages: base: !include base.yaml - scripts: !include 1bar_1display_scripts.yaml + scripts: !include 3bar_1display_scripts.yaml mcp23008: - id: 'base_J0' From 24d681a6fe6f4869f5ca416f57c464d15ffd01c7 Mon Sep 17 00:00:00 2001 From: Martijn Date: Wed, 13 Nov 2024 19:36:10 +0100 Subject: [PATCH 19/77] added bar card and colors --- package/cards/music.yaml | 86 +++++++++++++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 18 deletions(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index 03a56ec..072ad27 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -5,12 +5,12 @@ ## about the current played song and ## players current state ## USAGE: +## substitutions: +## music_card_enity_id: 'media_player.media_keuken_2' ## package: -## ... -## card_music: !include -## file: cards/music.yaml -## vars: -## entity_id: media_player.xxxx +## remote_package_files: +## url: https://github.com/dixi83/ESPHome_ButtonPlus +## files: [,'package/cards/music.yaml'] ## ## display: ## - id: !extend main_display @@ -21,6 +21,7 @@ ## // insert music card: ## // >> id(music_card).execute(x, y); ## id(music_card).execute(20, 125); +## - id: !extend bar1_left ## ##################################################### @@ -55,6 +56,26 @@ image: - file: mdi:download-box-outline id: icon_music_buffering resize: 75x75 + - file: mdi:volume-plus + id: icon_music_vol_up + resize: 75x75 + - file: mdi:volume-minus + id: icon_music_vol_down + resize: 75x75 + - file: mdi:skip-forward + id: icon_music_next + resize: 75x75 + - file: mdi:skip-backward + id: icon_music_prev + resize: 75x75 + +color: + - id: music_card_text_color + hex: ${music_card_text_color} + - id: music_card_icon_main_color + hex: ${music_card_icon_main_color} + - id: music_card_icon_bar_color + hex: ${music_card_icon_bar_color} text_sensor: - platform: homeassistant @@ -62,6 +83,7 @@ text_sensor: entity_id: ${music_card_enity_id} attribute: media_album_name on_value: + - delay: 500ms - script.execute: update_main - platform: homeassistant id: music_artist @@ -72,6 +94,7 @@ text_sensor: entity_id: ${music_card_enity_id} attribute: media_title on_value: + - delay: 500ms - script.execute: update_main - platform: homeassistant id: music_playerstate @@ -88,29 +111,56 @@ script: - lambda: |- // player state if (strcmp(id(music_playerstate).state.c_str(), "off") == 0) { - id(main_display).image(x, 1+y, id(icon_music_off), ImageAlign::TOP_LEFT, id(orange)); + id(main_display).image(x, 1+y, id(icon_music_off), ImageAlign::TOP_LEFT, id(music_card_icon_main_color)); } else if (strcmp(id(music_playerstate).state.c_str(), "on") == 0) { - id(main_display).image(x, 1+y, id(icon_music_on), ImageAlign::TOP_LEFT, id(orange)); + id(main_display).image(x, 1+y, id(icon_music_on), ImageAlign::TOP_LEFT, id(music_card_icon_main_color)); } else if (strcmp(id(music_playerstate).state.c_str(), "idle") == 0) { - id(main_display).image(x, 1+y, id(icon_music_idle), ImageAlign::TOP_LEFT, id(orange)); + id(main_display).image(x, 1+y, id(icon_music_idle), ImageAlign::TOP_LEFT, id(music_card_icon_main_color)); } else if (strcmp(id(music_playerstate).state.c_str(), "playing") == 0) { - id(main_display).image(x, 1+y, id(icon_music_play), ImageAlign::TOP_LEFT, id(orange)); + id(main_display).image(x, 1+y, id(icon_music_play), ImageAlign::TOP_LEFT, id(music_card_icon_main_color)); } else if (strcmp(id(music_playerstate).state.c_str(), "paused") == 0) { - id(main_display).image(x, 1+y, id(icon_music_pause), ImageAlign::TOP_LEFT, id(orange)); + id(main_display).image(x, 1+y, id(icon_music_pause), ImageAlign::TOP_LEFT, id(music_card_icon_main_color)); } else if (strcmp(id(music_playerstate).state.c_str(), "standby") == 0) { - id(main_display).image(x, 1+y, id(icon_music_standby), ImageAlign::TOP_LEFT, id(orange)); + id(main_display).image(x, 1+y, id(icon_music_standby), ImageAlign::TOP_LEFT, id(music_card_icon_main_color)); } else if (strcmp(id(music_playerstate).state.c_str(), "buffering") == 0) { - id(main_display).image(x, 1+y, id(icon_music_buffering), ImageAlign::TOP_LEFT, id(orange)); + id(main_display).image(x, 1+y, id(icon_music_buffering), ImageAlign::TOP_LEFT, id(music_card_icon_main_color)); } // // album - id(main_display).image(75+3+x, 4+y, id(icon_music_album), ImageAlign::TOP_LEFT, id(orange)); - id(main_display).print(75+25+x, 0+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_album).state.c_str()); + id(main_display).image(75+3+x, 4+y, id(icon_music_album), ImageAlign::TOP_LEFT, id(music_card_icon_main_color)); + id(main_display).print(75+25+x, 0+y, id(font_arial20), id(music_card_text_color), TextAlign::TOP_LEFT , id(music_album).state.c_str()); // // artist - id(main_display).image(75+3+x, 30+y, id(icon_music_artist), ImageAlign::TOP_LEFT, id(orange)); - id(main_display).print(75+25+x, 26+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_artist).state.c_str()); + id(main_display).image(75+3+x, 30+y, id(icon_music_artist), ImageAlign::TOP_LEFT, id(music_card_icon_main_color)); + id(main_display).print(75+25+x, 26+y, id(font_arial20), id(music_card_text_color), TextAlign::TOP_LEFT , id(music_artist).state.c_str()); // // song title - id(main_display).image(75+3+x, 56+y, id(icon_music_songtitle), ImageAlign::TOP_LEFT, id(orange)); - id(main_display).print(75+25+x, 52+y, id(font_arial20), id(white), TextAlign::TOP_LEFT , id(music_title).state.c_str()); \ No newline at end of file + id(main_display).image(75+3+x, 56+y, id(icon_music_songtitle), ImageAlign::TOP_LEFT, id(music_card_icon_main_color)); + id(main_display).print(75+25+x, 52+y, id(font_arial20), id(music_card_text_color), TextAlign::TOP_LEFT , id(music_title).state.c_str()); + - id: music_card_bar + parameters: + type: str + then: + - lambda: |- + if (strcmp(type, "volume_up") == 0) { // button "volume_up" + id(main_display).image(80, 2, id(icon_music_vol_up), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); + } else if (strcmp(type, "volume_down") == 0) { // button "volume_down" + id(main_display).image(80, 2, id(icon_music_vol_down), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); + } else if (strcmp(type, "next") == 0) { // button "next" + id(main_display).image(80, 2, id(icon_music_next), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); + } else if (strcmp(type, "prev") == 0) { // button "prev" + id(main_display).image(80, 2, id(icon_music_prev), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); + } else if (strcmp(type, "playpause") == 0) { // button "playpause" + if (strcmp(id(music_playerstate).state.c_str(), "playing") == 0) { + id(main_display).image(80, 2, id(icon_music_pause), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); + } else { + id(main_display).image(80, 2, id(icon_music_play), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); + } + } else if (strcmp(type, "power") == 0) { // button "power" + if (strcmp(id(music_playerstate).state.c_str(), "off") == 0) { + id(main_display).image(80, 2, id(icon_music_off), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); + } else { + id(main_display).image(80, 2, id(icon_music_on), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); + } + } + \ No newline at end of file From 868b218228b85fccdeef1248ca0910a0f2f4377b Mon Sep 17 00:00:00 2001 From: Martijn Date: Wed, 13 Nov 2024 19:39:23 +0100 Subject: [PATCH 20/77] str to string --- package/cards/music.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index 072ad27..d4a9fa9 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -139,7 +139,7 @@ script: id(main_display).print(75+25+x, 52+y, id(font_arial20), id(music_card_text_color), TextAlign::TOP_LEFT , id(music_title).state.c_str()); - id: music_card_bar parameters: - type: str + type: string then: - lambda: |- if (strcmp(type, "volume_up") == 0) { // button "volume_up" From 810ca77dd59b95fbdcfd4b4f255dcdf35907c980 Mon Sep 17 00:00:00 2001 From: Martijn Date: Wed, 13 Nov 2024 19:41:39 +0100 Subject: [PATCH 21/77] type to c_str() --- package/cards/music.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index d4a9fa9..d1a89b8 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -142,21 +142,21 @@ script: type: string then: - lambda: |- - if (strcmp(type, "volume_up") == 0) { // button "volume_up" + if (strcmp(type.c_str(), "volume_up") == 0) { // button "volume_up" id(main_display).image(80, 2, id(icon_music_vol_up), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); - } else if (strcmp(type, "volume_down") == 0) { // button "volume_down" + } else if (strcmp(type.c_str(), "volume_down") == 0) { // button "volume_down" id(main_display).image(80, 2, id(icon_music_vol_down), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); - } else if (strcmp(type, "next") == 0) { // button "next" + } else if (strcmp(type.c_str(), "next") == 0) { // button "next" id(main_display).image(80, 2, id(icon_music_next), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); - } else if (strcmp(type, "prev") == 0) { // button "prev" + } else if (strcmp(type.c_str(), "prev") == 0) { // button "prev" id(main_display).image(80, 2, id(icon_music_prev), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); - } else if (strcmp(type, "playpause") == 0) { // button "playpause" + } else if (strcmp(type.c_str(), "playpause") == 0) { // button "playpause" if (strcmp(id(music_playerstate).state.c_str(), "playing") == 0) { id(main_display).image(80, 2, id(icon_music_pause), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); } else { id(main_display).image(80, 2, id(icon_music_play), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); } - } else if (strcmp(type, "power") == 0) { // button "power" + } else if (strcmp(type.c_str(), "power") == 0) { // button "power" if (strcmp(id(music_playerstate).state.c_str(), "off") == 0) { id(main_display).image(80, 2, id(icon_music_off), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); } else { From cd98c83da8a74cf38c1938adb71e2c75d0ebc8ff Mon Sep 17 00:00:00 2001 From: Martijn Date: Fri, 15 Nov 2024 18:24:31 +0100 Subject: [PATCH 22/77] test with 1 display difinition for 2 displays --- Components/Base_Module.md | 104 ++++++++++++++--------------- Components/Display_Module.md | 36 +++++----- package/1bar_1display.yaml | 50 ++++++-------- package/1bar_1display_scripts.yaml | 24 +++++++ package/base.yaml | 2 +- 5 files changed, 116 insertions(+), 100 deletions(-) diff --git a/Components/Base_Module.md b/Components/Base_Module.md index 7e4693b..6b127cb 100644 --- a/Components/Base_Module.md +++ b/Components/Base_Module.md @@ -13,7 +13,7 @@ Driver IC: ST7735S (ESPHome compatible) 1 GND 2 3.3V 3 EN -4 IO4 Neopixel LED's +4 IO4 Neopixel LED's 5 IO5 6 IO6 7 IO7 @@ -24,7 +24,7 @@ Driver IC: ST7735S (ESPHome compatible) 12 IO8 13 IO19 14 IO20 -15 IO3 Backlight main display +15 IO3 Backlight main display 16 IO46 Backlight mini displays 17 IO9 18 IO10 @@ -47,8 +47,8 @@ Driver IC: ST7735S (ESPHome compatible) 35 IO42 36 TXD0 37 RXD0 -38 IO1 I2C SDA > Temperature Sensor -39 IO2 I2S SCL > Temperature Sensor +38 IO1 I2C SDA > Temperature Sensor +39 IO2 I2S SCL > Temperature Sensor 40 GND ``` @@ -59,24 +59,24 @@ Driver IC: ST7735S (ESPHome compatible) ``` MCP I2C address: 0x20 -PIN Description Destination +PIN Description Destination 1 GND 2 +3.3V -3 Reset ESP32 #3 EN - 4 I2C SDA ESP32 #24 IO47 -5 SPI MOSI ESP32 #28 IO35 - 6 I2C SCK ESP32 #25 IO48 -7 SPI SCK ESP32 #29 IO36 - 8 I2C Address MSP A0 GND -9 SPI Register select ESP32 #30 IO37 - 10 I2C Address MSP A1 GND +3 Reset ESP32 #3 EN + 4 I2C SDA ESP32 #24 IO47 +5 SPI MOSI ESP32 #28 IO35 + 6 I2C SCK ESP32 #25 IO48 +7 SPI SCK ESP32 #29 IO36 + 8 I2C Address MSP A0 GND +9 SPI Register select ESP32 #30 IO37 + 10 I2C Address MSP A1 GND 11 Mini Display Backlight anode ESP32 #16 IO46 (via transistor) - 12 I2C Address MSP A2 GND + 12 I2C Address MSP A2 GND 13 Extensionplate... 14 Connected with J1,2,3 15 Main Display Backlight anode ESP32 #15 IO3 (via transistor) - 16 Neopixel Data OUT J1 #17 -17 Neopixel Data IN ESP32 #4 IO4 + 16 Neopixel Data OUT J1 #17 +17 Neopixel Data IN ESP32 #4 IO4 ``` ### Connector J1 @@ -84,24 +84,24 @@ PIN Description Destination ``` MCP I2C address: 0x21 -PIN Description Destination +PIN Description Destination 1 GND 2 +3.3V -3 Reset ESP32 #3 EN - 4 I2C SDA ESP32 #24 IO47 -5 SPI MOSI ESP32 #28 IO35 - 6 I2C SCK ESP32 #25 IO48 -7 SPI SCK ESP32 #29 IO36 - 8 I2C Address MSP A0 3.3V -9 SPI Register select ESP32 #30 IO37 - 10 I2C Address MSP A1 GND +3 Reset ESP32 #3 EN + 4 I2C SDA ESP32 #24 IO47 +5 SPI MOSI ESP32 #28 IO35 + 6 I2C SCK ESP32 #25 IO48 +7 SPI SCK ESP32 #29 IO36 + 8 I2C Address MSP A0 3.3V +9 SPI Register select ESP32 #30 IO37 + 10 I2C Address MSP A1 GND 11 Mini Display Backlight anode ESP32 #16 IO46 (via transistor) - 12 I2C Address MSP A2 GND + 12 I2C Address MSP A2 GND 13 Extensionplate... 14 Connected with J0,2,3 15 Main Display Backlight anode ESP32 #15 IO3 (via transistor) - 16 Neopixel Data OUT J2 #17 -17 Neopixel Data IN J0 #16 + 16 Neopixel Data OUT J2 #17 +17 Neopixel Data IN J0 #16 ``` ### Connector J2 @@ -109,24 +109,24 @@ PIN Description Destination ``` MCP I2C address: 0x22 -PIN Description Destination +PIN Description Destination 1 GND 2 +3.3V -3 Reset ESP32 #3 EN - 4 I2C SDA ESP32 #24 IO47 -5 SPI MOSI ESP32 #28 IO35 - 6 I2C SCK ESP32 #25 IO48 -7 SPI SCK ESP32 #29 IO36 - 8 I2C Address MSP A0 GND -9 SPI Register select ESP32 #30 IO37 - 10 I2C Address MSP A1 3.3V +3 Reset ESP32 #3 EN + 4 I2C SDA ESP32 #24 IO47 +5 SPI MOSI ESP32 #28 IO35 + 6 I2C SCK ESP32 #25 IO48 +7 SPI SCK ESP32 #29 IO36 + 8 I2C Address MSP A0 GND +9 SPI Register select ESP32 #30 IO37 + 10 I2C Address MSP A1 3.3V 11 Mini Display Backlight anode ESP32 #16 IO46 (via transistor) - 12 I2C Address MSP A2 GND + 12 I2C Address MSP A2 GND 13 Extensionplate... 14 Connected with J0,1,3 15 Main Display Backlight anode ESP32 #15 IO3 (via transistor) - 16 Neopixel Data OUT J3 #17 -17 Neopixel Data IN J1 #16 + 16 Neopixel Data OUT J3 #17 +17 Neopixel Data IN J1 #16 ``` ### Connector J3 @@ -134,22 +134,22 @@ PIN Description Destination ``` MCP I2C address: 0x23 -PIN Description Destination +PIN Description Destination 1 GND 2 +3.3V -3 Reset ESP32 #3 EN - 4 I2C SDA ESP32 #24 IO47 -5 SPI MOSI ESP32 #28 IO35 - 6 I2C SCK ESP32 #25 IO48 -7 SPI SCL ESP32 #29 IO36 - 8 I2C Address MSP A0 3.3V -9 SPI Register select ESP32 #30 IO37 - 10 I2C Address MSP A1 3.3V +3 Reset ESP32 #3 EN + 4 I2C SDA ESP32 #24 IO47 +5 SPI MOSI ESP32 #28 IO35 + 6 I2C SCK ESP32 #25 IO48 +7 SPI SCL ESP32 #29 IO36 + 8 I2C Address MSP A0 3.3V +9 SPI Register select ESP32 #30 IO37 + 10 I2C Address MSP A1 3.3V 11 Mini Display Backlight anode ESP32 #16 IO46 (via transistor) - 12 I2C Address MSP A2 GND + 12 I2C Address MSP A2 GND 13 Extensionplate... 14 Connected with J0,1,2 15 Main Display Backlight anode ESP32 #15 IO3 (via transistor) - 16 Neopixel Data OUT Extensionplate #5 -17 Neopixel Data IN J2 #16 + 16 Neopixel Data OUT Extensionplate #5 +17 Neopixel Data IN J2 #16 ``` diff --git a/Components/Display_Module.md b/Components/Display_Module.md index 57bd02f..cc04fc5 100644 --- a/Components/Display_Module.md +++ b/Components/Display_Module.md @@ -26,7 +26,7 @@ GP1 Display Backlight Cathode Display #11,12,13,14 GP2 Button Right GP3 N.C. GP4 N.C. -GP5 Display Chip Select Display #5 +GP5 Display Chip Select Display #5 GP6 Button Left GP7 Display Backlight Cathode Display #11,12,13,14 ``` @@ -81,22 +81,22 @@ PIN Description ### CN2 ``` -PIN Description Destination -1 GND GND - 2 +3.3V +3.3V -3 Reset IC 1 #4, Display #2 - 4 I2C SI IC 1 #20 -5 SPI MOSI Display #6 - 6 I2C SCL IC 1 #19 -7 SPI SCK Display #3 - 8 I2C Address MSP A0 IC 1 #3 -9 SPI Register select Display #4 - 10 I2C Address MSP A1 IC 1 #2 -11 Backlight anode Display #1 - 12 I2C Address MSP A2 IC 1 #1 -13 Extensionplate... - - 14 Connected with J0,2,3 - +PIN Description Destination +1 GND GND + 2 +3.3V +3.3V +3 Reset IC 1 #4, Display #2 + 4 I2C SI IC 1 #20 +5 SPI MOSI Display #6 + 6 I2C SCL IC 1 #19 +7 SPI SCK Display #3 + 8 I2C Address MSP A0 IC 1 #3 +9 SPI Register select Display #4 + 10 I2C Address MSP A1 IC 1 #2 +11 Backlight anode Display #1 + 12 I2C Address MSP A2 IC 1 #1 +13 Extensionplate... - + 14 Connected with J0,2,3 - 15 Main Display Backlight anode - - 16 Neopixel Data OUT - -17 Neopixel Data IN - + 16 Neopixel Data OUT - +17 Neopixel Data IN - ``` \ No newline at end of file diff --git a/package/1bar_1display.yaml b/package/1bar_1display.yaml index 5a1de78..e23e8eb 100644 --- a/package/1bar_1display.yaml +++ b/package/1bar_1display.yaml @@ -94,6 +94,26 @@ light: from: 3 to: 3 +output: + - id: display_bar1_left + platform: gpio + internal: true + pin: + mcp23xxx: base_J3 + number: 5 + mode: + output: true + inverted: false + - id: display_bar1_right + platform: gpio + internal: true + pin: + mcp23xxx: base_J3 + number: 1 + mode: + output: true + inverted: false + display: #################### ### Main Display ### @@ -121,7 +141,7 @@ display: ################## ### BAR module ### ################## - - id: bar1_display_left + - id: bar_display platform: ili9xxx model: ST7735 color_order: bgr @@ -129,37 +149,9 @@ display: dc_pin: number: GPIO37 allow_other_uses: true - cs_pin: - mcp23xxx: base_J3 - number: 5 - mode: - output: true - inverted: false invert_colors: false show_test_card: false dimensions: height: 160 width: 80 offset_width: 24 - rotation: 270 - - id: bar1_display_right - platform: ili9xxx - model: ST7735 - color_order: bgr - update_interval: never - dc_pin: - number: GPIO37 - allow_other_uses: true - cs_pin: - mcp23xxx: base_J3 - number: 1 - mode: - output: true - inverted: false - invert_colors: false - show_test_card: false - dimensions: - height: 160 - width: 80 - offset_width: 24 - rotation: 90 diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index bfd3ef1..09801e9 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -7,6 +7,30 @@ ############################################## script: +script: + - id: update_bars + then: + - lambda: |- + // update display left: + id(display_bar1_left).turn_on(); + id(bar_display).set_rotation(270); + id(bar1_left_page1).execute(); + id(bar_display).update(); + id(display_bar1_left).turn_off(); + // update display right: + id(bar_display).set_rotation(90); + id(bar1_right_page1).execute(); + id(display_bar1_right).turn_on(); + id(bar_display).update(); + id(display_bar1_right).turn_off(); + - id: bar1_left_page1 + then: + - lambda: |- + id(bar_display).image(80, 0, id(icon_temp_inside), ImageAlign::TOP_CENTER, id(orange)); + - id: bar1_right_page1 + then: + - lambda: |- + id(bar_display).image(80, 0, id(icon_temp_outside), ImageAlign::TOP_CENTER, id(orange)); - id: update_main then: - component.update: main_display diff --git a/package/base.yaml b/package/base.yaml index 0e1823c..c348239 100644 --- a/package/base.yaml +++ b/package/base.yaml @@ -34,7 +34,7 @@ output: pin: GPIO46 id: displays_mini_backlight_pwm inverted: True - max_power: 0.4 + max_power: 0.6 frequency: 500Hz sensor: From 636025ae05ee039d7764d9303a7259a0a8a05da8 Mon Sep 17 00:00:00 2001 From: Martijn Date: Fri, 15 Nov 2024 18:29:04 +0100 Subject: [PATCH 23/77] fix duble key --- package/1bar_1display_scripts.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 09801e9..021a555 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -6,7 +6,6 @@ ## ## ############################################## -script: script: - id: update_bars then: From a29a9120eadfde0d190200a7aa6d8f26acee5b93 Mon Sep 17 00:00:00 2001 From: Martijn Date: Fri, 15 Nov 2024 18:31:06 +0100 Subject: [PATCH 24/77] removed 'internal' --- package/1bar_1display.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/package/1bar_1display.yaml b/package/1bar_1display.yaml index e23e8eb..6cfc384 100644 --- a/package/1bar_1display.yaml +++ b/package/1bar_1display.yaml @@ -97,7 +97,6 @@ light: output: - id: display_bar1_left platform: gpio - internal: true pin: mcp23xxx: base_J3 number: 5 @@ -106,7 +105,6 @@ output: inverted: false - id: display_bar1_right platform: gpio - internal: true pin: mcp23xxx: base_J3 number: 1 From d045d4f7a3c8de8181670877e79bc54194747641 Mon Sep 17 00:00:00 2001 From: Martijn Date: Fri, 15 Nov 2024 18:35:16 +0100 Subject: [PATCH 25/77] wrong id's --- package/1bar_1display_scripts.yaml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 021a555..cf88e1d 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -36,8 +36,7 @@ script: - id: update_all then: - component.update: main_display - - component.update: bar1_display_left - - component.update: bar1_display_right + - component.update: bar_display - id: next_page_main then: - display.page.show_next: main_display @@ -45,8 +44,7 @@ script: - id: next_page_all then: - display.page.show_next: main_display - - display.page.show_next: bar1_display_left - - display.page.show_next: bar1_display_right + - display.page.show_next: bar_display - script.execute: update_all - id: prev_page_main then: @@ -55,6 +53,5 @@ script: - id: prev_page_all then: - display.page.show_previous: main_display - - display.page.show_previous: bar1_display_left - - display.page.show_previous: bar1_display_right + - display.page.show_previous: bar_display - script.execute: update_all From 35e678bde3898e091f261c56a3b36708a6af2738 Mon Sep 17 00:00:00 2001 From: Martijn Date: Fri, 15 Nov 2024 18:39:01 +0100 Subject: [PATCH 26/77] used correct enum --- package/1bar_1display_scripts.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index cf88e1d..7fc3379 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -12,12 +12,12 @@ script: - lambda: |- // update display left: id(display_bar1_left).turn_on(); - id(bar_display).set_rotation(270); + id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_270_DEGREES); id(bar1_left_page1).execute(); id(bar_display).update(); id(display_bar1_left).turn_off(); // update display right: - id(bar_display).set_rotation(90); + id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_90_DEGREES); id(bar1_right_page1).execute(); id(display_bar1_right).turn_on(); id(bar_display).update(); From 33937404a60b48c73d4193044850f80a31a96c80 Mon Sep 17 00:00:00 2001 From: Martijn Date: Fri, 15 Nov 2024 18:46:44 +0100 Subject: [PATCH 27/77] inverted output --- package/1bar_1display.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/1bar_1display.yaml b/package/1bar_1display.yaml index 6cfc384..ec7d1a2 100644 --- a/package/1bar_1display.yaml +++ b/package/1bar_1display.yaml @@ -102,7 +102,7 @@ output: number: 5 mode: output: true - inverted: false + inverted: true - id: display_bar1_right platform: gpio pin: @@ -110,7 +110,7 @@ output: number: 1 mode: output: true - inverted: false + inverted: true display: #################### From 7da933823c80d8f6215e3a31e74c2c3f6154e61c Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 05:29:20 +0100 Subject: [PATCH 28/77] added update for digital out --- package/1bar_1display.yaml | 4 ++-- package/1bar_1display_scripts.yaml | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/package/1bar_1display.yaml b/package/1bar_1display.yaml index ec7d1a2..6cfc384 100644 --- a/package/1bar_1display.yaml +++ b/package/1bar_1display.yaml @@ -102,7 +102,7 @@ output: number: 5 mode: output: true - inverted: true + inverted: false - id: display_bar1_right platform: gpio pin: @@ -110,7 +110,7 @@ output: number: 1 mode: output: true - inverted: true + inverted: false display: #################### diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 7fc3379..0f9b17c 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -12,16 +12,20 @@ script: - lambda: |- // update display left: id(display_bar1_left).turn_on(); + id(display_bar1_left).update(); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_270_DEGREES); id(bar1_left_page1).execute(); id(bar_display).update(); id(display_bar1_left).turn_off(); + id(display_bar1_left).update(); // update display right: - id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_90_DEGREES); id(bar1_right_page1).execute(); + id(bar1_right_page1).update(); + id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_90_DEGREES); id(display_bar1_right).turn_on(); id(bar_display).update(); id(display_bar1_right).turn_off(); + id(display_bar1_right).update(); - id: bar1_left_page1 then: - lambda: |- From 9314bf1ea26a2e011dbe62765a94a93e0ec86d66 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 05:37:22 +0100 Subject: [PATCH 29/77] use write_state --- package/1bar_1display_scripts.yaml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 0f9b17c..62641e1 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -11,21 +11,17 @@ script: then: - lambda: |- // update display left: - id(display_bar1_left).turn_on(); - id(display_bar1_left).update(); + id(display_bar1_left).write_state(true); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_270_DEGREES); id(bar1_left_page1).execute(); id(bar_display).update(); - id(display_bar1_left).turn_off(); - id(display_bar1_left).update(); + id(display_bar1_left).write_state(false); // update display right: - id(bar1_right_page1).execute(); - id(bar1_right_page1).update(); + id(display_bar1_right).write_state(true); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - id(display_bar1_right).turn_on(); + id(bar1_right_page1).execute(); id(bar_display).update(); - id(display_bar1_right).turn_off(); - id(display_bar1_right).update(); + id(display_bar1_right).write_state(false); - id: bar1_left_page1 then: - lambda: |- From 8c8da2092cedee1b49435278e9e985a8112ee9b2 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 17:10:04 +0100 Subject: [PATCH 30/77] write state is protected function... --- package/1bar_1display_scripts.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 62641e1..770a0ce 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -11,17 +11,17 @@ script: then: - lambda: |- // update display left: - id(display_bar1_left).write_state(true); + id(display_bar1_left).turn_on(); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_270_DEGREES); id(bar1_left_page1).execute(); id(bar_display).update(); - id(display_bar1_left).write_state(false); + id(display_bar1_left).turn_off(); // update display right: - id(display_bar1_right).write_state(true); + id(display_bar1_right).turn_on(); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_90_DEGREES); id(bar1_right_page1).execute(); id(bar_display).update(); - id(display_bar1_right).write_state(false); + id(display_bar1_right).turn_off(); - id: bar1_left_page1 then: - lambda: |- From 13d479e47da944e7d9bdeac14e0b741bf385c291 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 17:19:52 +0100 Subject: [PATCH 31/77] test with delay --- package/1bar_1display_scripts.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 770a0ce..0072060 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -12,16 +12,20 @@ script: - lambda: |- // update display left: id(display_bar1_left).turn_on(); + delay(1); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_270_DEGREES); id(bar1_left_page1).execute(); id(bar_display).update(); id(display_bar1_left).turn_off(); + delay(1); // update display right: id(display_bar1_right).turn_on(); + delay(1); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_90_DEGREES); id(bar1_right_page1).execute(); id(bar_display).update(); id(display_bar1_right).turn_off(); + delay(1); - id: bar1_left_page1 then: - lambda: |- From 1b165151d8bc5898694a74686d5ac7790a1de42e Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 17:23:51 +0100 Subject: [PATCH 32/77] set_cs_pin --- package/1bar_1display_scripts.yaml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 0072060..07053da 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -11,21 +11,15 @@ script: then: - lambda: |- // update display left: - id(display_bar1_left).turn_on(); - delay(1); + id(bar_display).set_cs_pin(id((display_bar1_left)); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_270_DEGREES); id(bar1_left_page1).execute(); id(bar_display).update(); - id(display_bar1_left).turn_off(); - delay(1); // update display right: - id(display_bar1_right).turn_on(); - delay(1); + id(bar_display).set_cs_pin(id((display_bar1_left)); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_90_DEGREES); id(bar1_right_page1).execute(); id(bar_display).update(); - id(display_bar1_right).turn_off(); - delay(1); - id: bar1_left_page1 then: - lambda: |- From b429cf6410f366b6e707b1c99a6cf4fae9a5a235 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 17:25:01 +0100 Subject: [PATCH 33/77] forgoten )... --- package/1bar_1display_scripts.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 07053da..324d67b 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -11,12 +11,12 @@ script: then: - lambda: |- // update display left: - id(bar_display).set_cs_pin(id((display_bar1_left)); + id(bar_display).set_cs_pin(id((display_bar1_left))); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_270_DEGREES); id(bar1_left_page1).execute(); id(bar_display).update(); // update display right: - id(bar_display).set_cs_pin(id((display_bar1_left)); + id(bar_display).set_cs_pin(id((display_bar1_left))); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_90_DEGREES); id(bar1_right_page1).execute(); id(bar_display).update(); From b442a660a49263491365acfb742ad852910a93e4 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 18:15:23 +0100 Subject: [PATCH 34/77] cs_pin is now GPIOPin --- package/1bar_1display_scripts.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 324d67b..06e4a69 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -6,17 +6,23 @@ ## ## ############################################## +globals: + - id: cs_pin + type: gpio::GPIOPin* + script: - id: update_bars then: - lambda: |- // update display left: - id(bar_display).set_cs_pin(id((display_bar1_left))); + id(cs_pin) = new gpio::GPIOPin(id(display_bar1_left)); + id(bar_display).set_cs_pin(id(((cs_pin))); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_270_DEGREES); id(bar1_left_page1).execute(); id(bar_display).update(); // update display right: - id(bar_display).set_cs_pin(id((display_bar1_left))); + id(cs_pin) = new gpio::GPIOPin(id(display_bar1_right)); + id(bar_display).set_cs_pin(id((cs_pin))); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_90_DEGREES); id(bar1_right_page1).execute(); id(bar_display).update(); From ed7f841db0f28cd31d90385ed7854bcfe2f3bd4f Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 18:23:22 +0100 Subject: [PATCH 35/77] now without global --- package/1bar_1display_scripts.yaml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 06e4a69..3e07d47 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -6,22 +6,19 @@ ## ## ############################################## -globals: - - id: cs_pin - type: gpio::GPIOPin* - script: - id: update_bars then: - lambda: |- // update display left: - id(cs_pin) = new gpio::GPIOPin(id(display_bar1_left)); + auto cs_pin = id(display_bar1_left).get_pin(); id(bar_display).set_cs_pin(id(((cs_pin))); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_270_DEGREES); id(bar1_left_page1).execute(); id(bar_display).update(); // update display right: - id(cs_pin) = new gpio::GPIOPin(id(display_bar1_right)); + auto cs_pin = id(display_bar1_right).get_pin(); + id(cs_pin) = new GPIOPin(id(display_bar1_right)); id(bar_display).set_cs_pin(id((cs_pin))); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_90_DEGREES); id(bar1_right_page1).execute(); From f055ad44e03b70e734f4a36637da8ce0f30cc107 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 18:23:58 +0100 Subject: [PATCH 36/77] update --- package/1bar_1display_scripts.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 3e07d47..4b9ff7a 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -18,7 +18,6 @@ script: id(bar_display).update(); // update display right: auto cs_pin = id(display_bar1_right).get_pin(); - id(cs_pin) = new GPIOPin(id(display_bar1_right)); id(bar_display).set_cs_pin(id((cs_pin))); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_90_DEGREES); id(bar1_right_page1).execute(); From 89a4c0c026699c0a01ffe29bf1998d8199bd02f2 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 18:27:53 +0100 Subject: [PATCH 37/77] update --- package/1bar_1display_scripts.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 4b9ff7a..7f9cd16 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -6,18 +6,22 @@ ## ## ############################################## +globals: + - id: cs_pin + type: GPIOPin* + script: - id: update_bars then: - lambda: |- // update display left: - auto cs_pin = id(display_bar1_left).get_pin(); + id(cs_pin) = new GPIOPin(id(display_bar1_left)); id(bar_display).set_cs_pin(id(((cs_pin))); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_270_DEGREES); id(bar1_left_page1).execute(); id(bar_display).update(); // update display right: - auto cs_pin = id(display_bar1_right).get_pin(); + id(cs_pin) = new GPIOPin(id(display_bar1_right)); id(bar_display).set_cs_pin(id((cs_pin))); id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_90_DEGREES); id(bar1_right_page1).execute(); From 16799c944bebad3e16c555b2bff5a700bc1954f6 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 18:57:09 +0100 Subject: [PATCH 38/77] update --- package/1bar_1display.yaml | 39 +++++++++++++++++++++-- package/1bar_1display_scripts.yaml | 50 ++++++++++++++++++------------ 2 files changed, 67 insertions(+), 22 deletions(-) diff --git a/package/1bar_1display.yaml b/package/1bar_1display.yaml index 6cfc384..d62e61b 100644 --- a/package/1bar_1display.yaml +++ b/package/1bar_1display.yaml @@ -18,6 +18,27 @@ mcp23008: i2c_id: buttons address: 0x23 +output: + # - platform: mcp23xxx + # mcp23xxx_id: base_J2 + # pin: 1 + # id: cs_pin_1 + + # - platform: mcp23xxx + # mcp23xxx_id: base_J2 + # pin: 5 + # id: cs_pin_2 + + - platform: mcp23xxx + mcp23xxx_id: base_J3 + pin: 1 + id: cs_pin_3 + + - platform: mcp23xxx + mcp23xxx_id: base_J3 + pin: 5 + id: cs_pin_4 + binary_sensor: ############################ ### Buttons Main Display ### @@ -139,14 +160,26 @@ display: ################## ### BAR module ### ################## + # - id: bar_display + # platform: ili9xxx + # model: ST7735 + # color_order: bgr + # update_interval: never + # dc_pin: + # number: GPIO37 + # allow_other_uses: true + # invert_colors: false + # show_test_card: false + # dimensions: + # height: 160 + # width: 80 + # offset_width: 24 - id: bar_display platform: ili9xxx model: ST7735 color_order: bgr update_interval: never - dc_pin: - number: GPIO37 - allow_other_uses: true + dc_pin: GPIO37 invert_colors: false show_test_card: false dimensions: diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 7f9cd16..9bd30bb 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -6,26 +6,35 @@ ## ## ############################################## -globals: - - id: cs_pin - type: GPIOPin* +# globals: +# - id: cs_pin +# type: GPIOPin* script: - - id: update_bars + - id: update_display_1 then: - lambda: |- - // update display left: - id(cs_pin) = new GPIOPin(id(display_bar1_left)); - id(bar_display).set_cs_pin(id(((cs_pin))); - id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_270_DEGREES); - id(bar1_left_page1).execute(); - id(bar_display).update(); - // update display right: - id(cs_pin) = new GPIOPin(id(display_bar1_right)); - id(bar_display).set_cs_pin(id((cs_pin))); - id(bar_display).set_rotation(DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - id(bar1_right_page1).execute(); - id(bar_display).update(); + id(cs_pin_3).write(false); // CS actief voor Display 1 + id(cs_pin_4).write(true); + // id(cs_pin_3).write(true); + // id(cs_pin_4).write(true); + + id(bar1_left_page1).execute() + id(bar_display).update(); + delay(10); // Optioneel voor stabiliteit + id(cs_pin_1).write(true); // CS inactief na update + - id: update_display_2 + then: + - lambda: |- + id(cs_pin_3).write(true); + id(cs_pin_4).write(false); // CS actief voor Display 2 + // id(cs_pin_3).write(true); + // id(cs_pin_4).write(true); + + id(bar1_right_page1).execute() + id(bar_display).update(); + delay(10); // Optioneel voor stabiliteit + id(cs_pin_2).write(true); // CS inactief na update - id: bar1_left_page1 then: - lambda: |- @@ -40,7 +49,10 @@ script: - id: update_all then: - component.update: main_display - - component.update: bar_display + - script.execute: update_display_1 + - script.execute: update_display_2 + # - script.execute: update_display_3 + # - script.execute: update_display_4 - id: next_page_main then: - display.page.show_next: main_display @@ -48,7 +60,7 @@ script: - id: next_page_all then: - display.page.show_next: main_display - - display.page.show_next: bar_display + # - display.page.show_next: bar_display - script.execute: update_all - id: prev_page_main then: @@ -57,5 +69,5 @@ script: - id: prev_page_all then: - display.page.show_previous: main_display - - display.page.show_previous: bar_display + # - display.page.show_previous: bar_display - script.execute: update_all From 212bb7faa5ee407cba89c4b5e5a6955984601ba2 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 19:12:49 +0100 Subject: [PATCH 39/77] removed double output --- package/1bar_1display.yaml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/package/1bar_1display.yaml b/package/1bar_1display.yaml index d62e61b..2056364 100644 --- a/package/1bar_1display.yaml +++ b/package/1bar_1display.yaml @@ -115,24 +115,6 @@ light: from: 3 to: 3 -output: - - id: display_bar1_left - platform: gpio - pin: - mcp23xxx: base_J3 - number: 5 - mode: - output: true - inverted: false - - id: display_bar1_right - platform: gpio - pin: - mcp23xxx: base_J3 - number: 1 - mode: - output: true - inverted: false - display: #################### ### Main Display ### From 8b15767b0e1fcfa859d08b974f706553aa70c9d0 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 19:14:29 +0100 Subject: [PATCH 40/77] --- package/1bar_1display.yaml | 52 +++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/package/1bar_1display.yaml b/package/1bar_1display.yaml index 2056364..1fb8cfd 100644 --- a/package/1bar_1display.yaml +++ b/package/1bar_1display.yaml @@ -18,26 +18,26 @@ mcp23008: i2c_id: buttons address: 0x23 -output: - # - platform: mcp23xxx - # mcp23xxx_id: base_J2 - # pin: 1 - # id: cs_pin_1 +# output: +# # - platform: mcp23xxx +# # mcp23xxx_id: base_J2 +# # pin: 1 +# # id: cs_pin_1 - # - platform: mcp23xxx - # mcp23xxx_id: base_J2 - # pin: 5 - # id: cs_pin_2 +# # - platform: mcp23xxx +# # mcp23xxx_id: base_J2 +# # pin: 5 +# # id: cs_pin_2 - - platform: mcp23xxx - mcp23xxx_id: base_J3 - pin: 1 - id: cs_pin_3 +# - platform: mcp23xxx +# mcp23xxx_id: base_J3 +# pin: 1 +# id: cs_pin_3 - - platform: mcp23xxx - mcp23xxx_id: base_J3 - pin: 5 - id: cs_pin_4 +# - platform: mcp23xxx +# mcp23xxx_id: base_J3 +# pin: 5 +# id: cs_pin_4 binary_sensor: ############################ @@ -115,6 +115,24 @@ light: from: 3 to: 3 +output: + - id: cs_pin_3 + platform: gpio + pin: + mcp23xxx: base_J3 + number: 5 + mode: + output: true + inverted: false + - id: cs_pin_4 + platform: gpio + pin: + mcp23xxx: base_J3 + number: 1 + mode: + output: true + inverted: false + display: #################### ### Main Display ### From b40d99e96bf70274578f2fecb6156123da45658e Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 19:15:25 +0100 Subject: [PATCH 41/77] --- package/1bar_1display_scripts.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 9bd30bb..a0c2ed5 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -22,7 +22,7 @@ script: id(bar1_left_page1).execute() id(bar_display).update(); delay(10); // Optioneel voor stabiliteit - id(cs_pin_1).write(true); // CS inactief na update + id(cs_pin_3).write(true); // CS inactief na update - id: update_display_2 then: - lambda: |- @@ -34,7 +34,7 @@ script: id(bar1_right_page1).execute() id(bar_display).update(); delay(10); // Optioneel voor stabiliteit - id(cs_pin_2).write(true); // CS inactief na update + id(cs_pin_4).write(true); // CS inactief na update - id: bar1_left_page1 then: - lambda: |- From c3f3f4c3247a69eee718fcb6eabccd115c06a264 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 19:16:38 +0100 Subject: [PATCH 42/77] --- package/1bar_1display.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/1bar_1display.yaml b/package/1bar_1display.yaml index 1fb8cfd..9bea8ca 100644 --- a/package/1bar_1display.yaml +++ b/package/1bar_1display.yaml @@ -179,7 +179,9 @@ display: model: ST7735 color_order: bgr update_interval: never - dc_pin: GPIO37 + dc_pin: + number: GPIO37 + allow_other_uses: true invert_colors: false show_test_card: false dimensions: From 210855b3894c6799cdbe0cd12c590776f825e817 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 19:18:39 +0100 Subject: [PATCH 43/77] --- package/1bar_1display_scripts.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index a0c2ed5..a2e7064 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -14,27 +14,27 @@ script: - id: update_display_1 then: - lambda: |- - id(cs_pin_3).write(false); // CS actief voor Display 1 - id(cs_pin_4).write(true); + id(cs_pin_3).trun_off(); // CS actief voor Display 1 + id(cs_pin_4).turn_on(); // id(cs_pin_3).write(true); // id(cs_pin_4).write(true); id(bar1_left_page1).execute() id(bar_display).update(); delay(10); // Optioneel voor stabiliteit - id(cs_pin_3).write(true); // CS inactief na update + id(cs_pin_3).turn_on(); // CS inactief na update - id: update_display_2 then: - lambda: |- - id(cs_pin_3).write(true); - id(cs_pin_4).write(false); // CS actief voor Display 2 + id(cs_pin_3).turn_on(); + id(cs_pin_4).trun_off(); // CS actief voor Display 2 // id(cs_pin_3).write(true); // id(cs_pin_4).write(true); id(bar1_right_page1).execute() id(bar_display).update(); delay(10); // Optioneel voor stabiliteit - id(cs_pin_4).write(true); // CS inactief na update + id(cs_pin_4).turn_on(); // CS inactief na update - id: bar1_left_page1 then: - lambda: |- From 3415ffb462a98ad747d5b394b913962707f74211 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 19:19:42 +0100 Subject: [PATCH 44/77] typo --- package/1bar_1display_scripts.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index a2e7064..05e3576 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -14,7 +14,7 @@ script: - id: update_display_1 then: - lambda: |- - id(cs_pin_3).trun_off(); // CS actief voor Display 1 + id(cs_pin_3).turn_off(); // CS actief voor Display 1 id(cs_pin_4).turn_on(); // id(cs_pin_3).write(true); // id(cs_pin_4).write(true); @@ -27,7 +27,7 @@ script: then: - lambda: |- id(cs_pin_3).turn_on(); - id(cs_pin_4).trun_off(); // CS actief voor Display 2 + id(cs_pin_4).turn_off(); // CS actief voor Display 2 // id(cs_pin_3).write(true); // id(cs_pin_4).write(true); From b0cee2dc40fe5c2aeaeb026ea08e7d845ecf5542 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 19:20:33 +0100 Subject: [PATCH 45/77] semicolumn --- package/1bar_1display_scripts.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 05e3576..699b5ca 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -19,7 +19,7 @@ script: // id(cs_pin_3).write(true); // id(cs_pin_4).write(true); - id(bar1_left_page1).execute() + id(bar1_left_page1).execute(); id(bar_display).update(); delay(10); // Optioneel voor stabiliteit id(cs_pin_3).turn_on(); // CS inactief na update @@ -31,7 +31,7 @@ script: // id(cs_pin_3).write(true); // id(cs_pin_4).write(true); - id(bar1_right_page1).execute() + id(bar1_right_page1).execute(); id(bar_display).update(); delay(10); // Optioneel voor stabiliteit id(cs_pin_4).turn_on(); // CS inactief na update From 364a370b16ef0ffeeacdbcc13d0277dd949c4f5e Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 20:08:03 +0100 Subject: [PATCH 46/77] --- package/1bar_1display_scripts.yaml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 699b5ca..01dc174 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -6,9 +6,17 @@ ## ## ############################################## -# globals: -# - id: cs_pin -# type: GPIOPin* +image: + - file: mdi:lightbulb + id: lightbulb_script + resize: 80x80 + - file: mdi:alert + id: alert_script + resize: 80x80 + +color: + - id: orange_script + hex: FF7F00 script: - id: update_display_1 @@ -38,11 +46,11 @@ script: - id: bar1_left_page1 then: - lambda: |- - id(bar_display).image(80, 0, id(icon_temp_inside), ImageAlign::TOP_CENTER, id(orange)); + id(bar_display).image(80, 0, id(lightbulb_script), ImageAlign::TOP_CENTER, id(orange_script)); - id: bar1_right_page1 then: - lambda: |- - id(bar_display).image(80, 0, id(icon_temp_outside), ImageAlign::TOP_CENTER, id(orange)); + id(bar_display).image(80, 0, id(alert_script), ImageAlign::TOP_CENTER, id(orange_script)); - id: update_main then: - component.update: main_display From 420634cd4e04d582ac3b5d79d678e4d485e01a2a Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 16 Nov 2024 20:09:59 +0100 Subject: [PATCH 47/77] --- package/1bar_1display_scripts.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 01dc174..0facaa8 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -22,27 +22,27 @@ script: - id: update_display_1 then: - lambda: |- - id(cs_pin_3).turn_off(); // CS actief voor Display 1 - id(cs_pin_4).turn_on(); + id(cs_pin_3).turn_on(); // CS actief voor Display 1 + id(cs_pin_4).turn_off(); // id(cs_pin_3).write(true); // id(cs_pin_4).write(true); id(bar1_left_page1).execute(); id(bar_display).update(); delay(10); // Optioneel voor stabiliteit - id(cs_pin_3).turn_on(); // CS inactief na update + id(cs_pin_3).turn_off(); // CS inactief na update - id: update_display_2 then: - lambda: |- - id(cs_pin_3).turn_on(); - id(cs_pin_4).turn_off(); // CS actief voor Display 2 + id(cs_pin_3).turn_off(); + id(cs_pin_4).turn_on(); // CS actief voor Display 2 // id(cs_pin_3).write(true); // id(cs_pin_4).write(true); id(bar1_right_page1).execute(); id(bar_display).update(); delay(10); // Optioneel voor stabiliteit - id(cs_pin_4).turn_on(); // CS inactief na update + id(cs_pin_4).turn_off(); // CS inactief na update - id: bar1_left_page1 then: - lambda: |- From 0a946467eb9f7217d7c285775e4d98814af11ea6 Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 25 Nov 2024 18:57:25 +0100 Subject: [PATCH 48/77] updated scripting ready for test --- package/1bar_1display.yaml | 50 +++----- package/1bar_1display_scripts.yaml | 79 +++++++------ package/2bar_1display.yaml | 118 +++++++------------ package/2bar_1display_scripts.yaml | 93 +++++++++++++-- package/3bar_1display.yaml | 182 ++++++++++------------------- package/3bar_1display_scripts.yaml | 135 +++++++++++++++++++-- 6 files changed, 360 insertions(+), 297 deletions(-) diff --git a/package/1bar_1display.yaml b/package/1bar_1display.yaml index 9bea8ca..1e4422a 100644 --- a/package/1bar_1display.yaml +++ b/package/1bar_1display.yaml @@ -10,6 +10,14 @@ packages: base: !include base.yaml scripts: !include 1bar_1display_scripts.yaml +esphome: + on_boot: + priority: -100 + then: + - script.execute: setup_bar_displays + - script.execute: update_bar1_left + - script.execute: update_bar1_right + mcp23008: - id: 'base_J2' i2c_id: buttons @@ -18,27 +26,6 @@ mcp23008: i2c_id: buttons address: 0x23 -# output: -# # - platform: mcp23xxx -# # mcp23xxx_id: base_J2 -# # pin: 1 -# # id: cs_pin_1 - -# # - platform: mcp23xxx -# # mcp23xxx_id: base_J2 -# # pin: 5 -# # id: cs_pin_2 - -# - platform: mcp23xxx -# mcp23xxx_id: base_J3 -# pin: 1 -# id: cs_pin_3 - -# - platform: mcp23xxx -# mcp23xxx_id: base_J3 -# pin: 5 -# id: cs_pin_4 - binary_sensor: ############################ ### Buttons Main Display ### @@ -116,7 +103,10 @@ light: to: 3 output: - - id: cs_pin_3 + ####################################### + ### CS pins to control BAR Displays ### + ####################################### + - id: cs_pin_bar1_left platform: gpio pin: mcp23xxx: base_J3 @@ -124,7 +114,7 @@ output: mode: output: true inverted: false - - id: cs_pin_4 + - id: cs_pin_bar1_right platform: gpio pin: mcp23xxx: base_J3 @@ -160,20 +150,6 @@ display: ################## ### BAR module ### ################## - # - id: bar_display - # platform: ili9xxx - # model: ST7735 - # color_order: bgr - # update_interval: never - # dc_pin: - # number: GPIO37 - # allow_other_uses: true - # invert_colors: false - # show_test_card: false - # dimensions: - # height: 160 - # width: 80 - # offset_width: 24 - id: bar_display platform: ili9xxx model: ST7735 diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 0facaa8..c50e6df 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -6,61 +6,62 @@ ## ## ############################################## -image: - - file: mdi:lightbulb - id: lightbulb_script - resize: 80x80 - - file: mdi:alert - id: alert_script - resize: 80x80 - -color: - - id: orange_script - hex: FF7F00 - script: - - id: update_display_1 +###################### +### update scripts ### +###################### + - id: update_bar1_left then: - lambda: |- - id(cs_pin_3).turn_on(); // CS actief voor Display 1 - id(cs_pin_4).turn_off(); - // id(cs_pin_3).write(true); - // id(cs_pin_4).write(true); - - id(bar1_left_page1).execute(); + id(cs_pin_bar1_left).turn_on(); // << + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_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(10); // Optioneel voor stabiliteit - id(cs_pin_3).turn_off(); // CS inactief na update - - id: update_display_2 + delay(1); + id(cs_pin_bar1_left).turn_off(); + - id: update_bar1_right then: - lambda: |- - id(cs_pin_3).turn_off(); - id(cs_pin_4).turn_on(); // CS actief voor Display 2 - // id(cs_pin_3).write(true); - // id(cs_pin_4).write(true); - - id(bar1_right_page1).execute(); + id(cs_pin_bar1_left).turn_off(); + id(cs_pin_bar1_right).turn_on(); // << + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_off(); + id(bar_display).clear(); + id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); + id(bar1_left_draw).execute(); id(bar_display).update(); - delay(10); // Optioneel voor stabiliteit - id(cs_pin_4).turn_off(); // CS inactief na update - - id: bar1_left_page1 + delay(1); + id(cs_pin_bar1_right).turn_off(); +#################### +### draw scripts ### +#################### + - id: bar1_left_draw then: - lambda: |- - id(bar_display).image(80, 0, id(lightbulb_script), ImageAlign::TOP_CENTER, id(orange_script)); - - id: bar1_right_page1 + 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: bar1_right_draw then: - lambda: |- - id(bar_display).image(80, 0, id(alert_script), ImageAlign::TOP_CENTER, id(orange_script)); + 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!"); +############################## +### other handling scripts ### +############################## - id: update_main then: - component.update: main_display - id: update_all then: - component.update: main_display - - script.execute: update_display_1 - - script.execute: update_display_2 - # - script.execute: update_display_3 - # - script.execute: update_display_4 + - component.update: bar1_display_left + - component.update: bar1_display_right - id: next_page_main then: - display.page.show_next: main_display @@ -68,7 +69,6 @@ script: - id: next_page_all then: - display.page.show_next: main_display - # - display.page.show_next: bar_display - script.execute: update_all - id: prev_page_main then: @@ -77,5 +77,4 @@ script: - id: prev_page_all then: - display.page.show_previous: main_display - # - display.page.show_previous: bar_display - script.execute: update_all diff --git a/package/2bar_1display.yaml b/package/2bar_1display.yaml index 55dab5b..b7f8302 100644 --- a/package/2bar_1display.yaml +++ b/package/2bar_1display.yaml @@ -148,6 +148,43 @@ light: from: 7 to: 7 +output: + ####################################### + ### CS pins to control BAR Displays ### + ####################################### + - id: cs_pin_bar1_left + platform: gpio + pin: + mcp23xxx: base_J1 + number: 5 + mode: + output: true + inverted: true + - id: cs_pin_bar1_right + platform: gpio + pin: + mcp23xxx: base_J1 + number: 1 + mode: + output: true + inverted: true + - id: cs_pin_bar2_left + platform: gpio + pin: + mcp23xxx: base_J2 + number: 5 + mode: + output: true + inverted: true + - id: cs_pin_bar2_right + platform: gpio + pin: + mcp23xxx: base_J2 + number: 1 + mode: + output: true + inverted: true + display: #################### ### Main Display ### @@ -172,10 +209,10 @@ display: height: 240 width: 320 rotation: 180 - #################### - ### BAR module 1 ### - #################### - - id: bar1_display_left + ################### + ### BAR modules ### + ################### + - id: bar_display platform: ili9xxx model: ST7735 color_order: bgr @@ -183,82 +220,9 @@ display: dc_pin: number: GPIO37 allow_other_uses: true - cs_pin: - mcp23xxx: base_J2 - number: 5 - mode: - output: true - inverted: false invert_colors: false show_test_card: false dimensions: height: 160 width: 80 offset_width: 24 - rotation: 270 - - id: bar1_display_right - platform: ili9xxx - model: ST7735 - color_order: bgr - update_interval: never - dc_pin: - number: GPIO37 - allow_other_uses: true - cs_pin: - mcp23xxx: base_J2 - number: 1 - mode: - output: true - inverted: false - invert_colors: false - show_test_card: false - dimensions: - height: 160 - width: 80 - offset_width: 24 - rotation: 90 - #################### - ### BAR module 2 ### - #################### - - id: bar2_display_left - platform: ili9xxx - model: ST7735 - color_order: bgr - update_interval: never - dc_pin: - number: GPIO37 - allow_other_uses: true - cs_pin: - mcp23xxx: base_J3 - number: 5 - mode: - output: true - inverted: false - invert_colors: false - show_test_card: false - dimensions: - height: 160 - width: 80 - offset_width: 24 - rotation: 270 - - id: bar2_display_right - platform: ili9xxx - model: ST7735 - color_order: bgr - update_interval: never - dc_pin: - number: GPIO37 - allow_other_uses: true - cs_pin: - mcp23xxx: base_J3 - number: 1 - mode: - output: true - inverted: false - invert_colors: false - show_test_card: false - dimensions: - height: 160 - width: 80 - offset_width: 24 - rotation: 90 diff --git a/package/2bar_1display_scripts.yaml b/package/2bar_1display_scripts.yaml index 5e25269..5bc8152 100644 --- a/package/2bar_1display_scripts.yaml +++ b/package/2bar_1display_scripts.yaml @@ -7,6 +7,91 @@ ############################################## script: +###################### +### update scripts ### +###################### + - id: update_bar1_left + then: + - lambda: |- + id(cs_pin_bar1_left).turn_on(); // << + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_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(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_off(); + id(bar_display).clear(); + id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); + id(bar1_left_draw).execute(); + id(bar_display).update(); + delay(1); + id(cs_pin_bar1_right).turn_off(); + - id: update_bar2_left + then: + - lambda: |- + id(cs_pin_bar1_left).turn_off(); + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_on(); // << + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_off(); + id(bar_display).clear(); + id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); + id(bar2_left_draw).execute(); + id(bar_display).update(); + delay(1); + id(cs_pin_bar2_left).turn_off(); + - id: update_bar2_right + then: + - lambda: |- + id(cs_pin_bar1_left).turn_off(); + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_on(); // << + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_off(); + id(bar_display).clear(); + id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); + id(bar2_right_draw).execute(); + id(bar_display).update(); + delay(1); + id(cs_pin_bar2_right).turn_off(); +#################### +### draw scripts ### +#################### + - id: bar1_left_draw + then: + - lambda: |- + 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: bar1_right_draw + then: + - lambda: |- + 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: bar2_left_draw + then: + - lambda: |- + ESP_LOGD("TODO", "You need to extend the bar2_left_draw script to draw something on the bar display \n script: \n - id: !extend bar2_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + - id: bar2_right_draw + then: + - lambda: |- + ESP_LOGD("TODO", "You need to extend the bar2_right_draw script to draw something on the bar display \n script: \n - id: !extend bar2_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); +############################## +### other handling scripts ### +############################## - id: update_main then: - component.update: main_display @@ -24,10 +109,6 @@ script: - id: next_page_all then: - display.page.show_next: main_display - - display.page.show_next: bar1_display_left - - display.page.show_next: bar1_display_right - - display.page.show_next: bar2_display_left - - display.page.show_next: bar2_display_right - script.execute: update_all - id: prev_page_main then: @@ -36,8 +117,4 @@ script: - id: prev_page_all then: - display.page.show_previous: main_display - - display.page.show_previous: bar1_display_left - - display.page.show_previous: bar1_display_right - - display.page.show_previous: bar2_display_left - - display.page.show_previous: bar2_display_right - script.execute: update_all diff --git a/package/3bar_1display.yaml b/package/3bar_1display.yaml index 82b1469..aad5c7f 100644 --- a/package/3bar_1display.yaml +++ b/package/3bar_1display.yaml @@ -202,6 +202,59 @@ light: from: 11 to: 11 +output: + ####################################### + ### CS pins to control BAR Displays ### + ####################################### + - id: cs_pin_bar1_left + platform: gpio + pin: + mcp23xxx: base_J1 + number: 5 + mode: + output: true + inverted: true + - id: cs_pin_bar1_right + platform: gpio + pin: + mcp23xxx: base_J1 + number: 1 + mode: + output: true + inverted: true + - id: cs_pin_bar2_left + platform: gpio + pin: + mcp23xxx: base_J2 + number: 5 + mode: + output: true + inverted: true + - id: cs_pin_bar2_right + platform: gpio + pin: + mcp23xxx: base_J2 + number: 1 + mode: + output: true + inverted: true + - id: cs_pin_bar3_left + platform: gpio + pin: + mcp23xxx: base_J3 + number: 5 + mode: + output: true + inverted: true + - id: cs_pin_bar3_right + platform: gpio + pin: + mcp23xxx: base_J3 + number: 1 + mode: + output: true + inverted: true + display: #################### ### Main Display ### @@ -226,10 +279,10 @@ display: height: 240 width: 320 rotation: 180 - #################### - ### BAR module 1 ### - #################### - - id: bar1_display_left + ################### + ### BAR modules ### + ################### + - id: bar_display platform: ili9xxx model: ST7735 color_order: bgr @@ -237,127 +290,10 @@ display: dc_pin: number: GPIO37 allow_other_uses: true - cs_pin: - mcp23xxx: base_J1 - number: 5 - mode: - output: true - inverted: false invert_colors: false show_test_card: false + auto_clear_enabled: false dimensions: height: 160 width: 80 - offset_width: 24 - rotation: 270 - - id: bar1_display_right - platform: ili9xxx - model: ST7735 - color_order: bgr - update_interval: never - dc_pin: - number: GPIO37 - allow_other_uses: true - cs_pin: - mcp23xxx: base_J1 - number: 1 - mode: - output: true - inverted: false - invert_colors: false - show_test_card: false - dimensions: - height: 160 - width: 80 - offset_width: 24 - rotation: 90 - #################### - ### BAR module 2 ### - #################### - - id: bar2_display_left - platform: ili9xxx - model: ST7735 - color_order: bgr - update_interval: never - dc_pin: - number: GPIO37 - allow_other_uses: true - cs_pin: - mcp23xxx: base_J2 - number: 5 - mode: - output: true - inverted: false - invert_colors: false - show_test_card: false - dimensions: - height: 160 - width: 80 - offset_width: 24 - rotation: 270 - - id: bar2_display_right - platform: ili9xxx - model: ST7735 - color_order: bgr - update_interval: never - dc_pin: - number: GPIO37 - allow_other_uses: true - cs_pin: - mcp23xxx: base_J2 - number: 1 - mode: - output: true - inverted: false - invert_colors: false - show_test_card: false - dimensions: - height: 160 - width: 80 - offset_width: 24 - rotation: 90 - #################### - ### BAR module 3 ### - #################### - - id: bar3_display_left - platform: ili9xxx - model: ST7735 - color_order: bgr - update_interval: never - dc_pin: - number: GPIO37 - allow_other_uses: true - cs_pin: - mcp23xxx: base_J3 - number: 5 - mode: - output: true - inverted: false - invert_colors: false - show_test_card: false - dimensions: - height: 160 - width: 80 - offset_width: 24 - rotation: 270 - - id: bar3_display_right - platform: ili9xxx - model: ST7735 - color_order: bgr - update_interval: never - dc_pin: - number: GPIO37 - allow_other_uses: true - cs_pin: - mcp23xxx: base_J3 - number: 1 - mode: - output: true - inverted: false - invert_colors: false - show_test_card: false - dimensions: - height: 160 - width: 80 - offset_width: 24 - rotation: 90 + offset_width: 24 \ No newline at end of file diff --git a/package/3bar_1display_scripts.yaml b/package/3bar_1display_scripts.yaml index 581fa41..144d038 100644 --- a/package/3bar_1display_scripts.yaml +++ b/package/3bar_1display_scripts.yaml @@ -7,6 +7,129 @@ ############################################## script: +###################### +### update scripts ### +###################### + - id: update_bar1_left + then: + - lambda: |- + id(cs_pin_bar1_left).turn_on(); // << + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_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(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_off(); + id(bar_display).clear(); + id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); + id(bar1_left_draw).execute(); + id(bar_display).update(); + delay(1); + id(cs_pin_bar1_right).turn_off(); + - id: update_bar2_left + then: + - lambda: |- + id(cs_pin_bar1_left).turn_off(); + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_on(); // << + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_off(); + id(bar_display).clear(); + id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); + id(bar2_left_draw).execute(); + id(bar_display).update(); + delay(1); + id(cs_pin_bar2_left).turn_off(); + - id: update_bar2_right + then: + - lambda: |- + id(cs_pin_bar1_left).turn_off(); + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_on(); // << + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_off(); + id(bar_display).clear(); + id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); + id(bar2_right_draw).execute(); + id(bar_display).update(); + delay(1); + id(cs_pin_bar2_right).turn_off(); + - id: update_bar3_left + then: + - lambda: |- + id(cs_pin_bar1_left).turn_off(); + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_on(); // << + id(cs_pin_bar3_right).turn_off(); + id(bar_display).clear(); + id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); + id(bar3_left_draw).execute(); + id(bar_display).update(); + delay(1); + id(cs_pin_bar3_left).turn_off(); + - id: update_bar3_right + then: + - lambda: |- + id(cs_pin_bar1_left).turn_off(); + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_on(); // << + id(bar_display).clear(); + id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); + id(bar3_right_draw).execute(); + id(bar_display).update(); + delay(1); + id(cs_pin_bar3_right).turn_off(); +#################### +### draw scripts ### +#################### + - id: bar1_left_draw + then: + - lambda: |- + 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: bar1_right_draw + then: + - lambda: |- + 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: bar2_left_draw + then: + - lambda: |- + ESP_LOGD("TODO", "You need to extend the bar2_left_draw script to draw something on the bar display \n script: \n - id: !extend bar2_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + - id: bar2_right_draw + then: + - lambda: |- + ESP_LOGD("TODO", "You need to extend the bar2_right_draw script to draw something on the bar display \n script: \n - id: !extend bar2_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + - id: bar3_left_draw + then: + - lambda: |- + ESP_LOGD("TODO", "You need to extend the bar3_left_draw script to draw something on the bar display \n script: \n - id: !extend bar3_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + - id: bar3_right_draw + then: + - lambda: |- + ESP_LOGD("TODO", "You need to extend the bar3_right_draw script to draw something on the bar display \n script: \n - id: !extend bar3_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); +############################## +### other handling scripts ### +############################## - id: update_main then: - component.update: main_display @@ -26,12 +149,6 @@ script: - id: next_page_all then: - display.page.show_next: main_display - - display.page.show_next: bar1_display_left - - display.page.show_next: bar1_display_right - - display.page.show_next: bar2_display_left - - display.page.show_next: bar2_display_right - - display.page.show_next: bar3_display_left - - display.page.show_next: bar3_display_right - script.execute: update_all - id: prev_page_main then: @@ -40,10 +157,4 @@ script: - id: prev_page_all then: - display.page.show_previous: main_display - - display.page.show_previous: bar1_display_left - - display.page.show_previous: bar1_display_right - - display.page.show_previous: bar2_display_left - - display.page.show_previous: bar2_display_right - - display.page.show_previous: bar3_display_left - - display.page.show_previous: bar3_display_right - script.execute: update_all From d79d065851dcac418a66e8a350a87bcf29e0dbfc Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 25 Nov 2024 19:04:55 +0100 Subject: [PATCH 49/77] added onboot scripts --- package/2bar_1display.yaml | 10 ++++++++++ package/3bar_1display.yaml | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/package/2bar_1display.yaml b/package/2bar_1display.yaml index b7f8302..582b896 100644 --- a/package/2bar_1display.yaml +++ b/package/2bar_1display.yaml @@ -10,6 +10,16 @@ packages: base: !include base.yaml scripts: !include 2bar_1display_scripts.yaml +esphome: + on_boot: + priority: -100 + then: + - script.execute: setup_bar_displays + - script.execute: update_bar1_left + - script.execute: update_bar1_right + - script.execute: update_bar2_left + - script.execute: update_bar2_right + mcp23008: - id: 'base_J1' i2c_id: buttons diff --git a/package/3bar_1display.yaml b/package/3bar_1display.yaml index aad5c7f..7c6c8ea 100644 --- a/package/3bar_1display.yaml +++ b/package/3bar_1display.yaml @@ -10,6 +10,18 @@ packages: base: !include base.yaml scripts: !include 3bar_1display_scripts.yaml +esphome: + on_boot: + priority: -100 + then: + - script.execute: setup_bar_displays + - script.execute: update_bar1_left + - script.execute: update_bar1_right + - script.execute: update_bar2_left + - script.execute: update_bar2_right + - script.execute: update_bar3_left + - script.execute: update_bar3_right + mcp23008: - id: 'base_J0' i2c_id: buttons From e998fb6c96d932b885bc232a3e55f1f30d11d0d2 Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 25 Nov 2024 19:05:25 +0100 Subject: [PATCH 50/77] added succesfull test from today --- Tests/24-11-25_new_script.yaml | 529 +++++++++++++++++++++++++++++++++ 1 file changed, 529 insertions(+) create mode 100644 Tests/24-11-25_new_script.yaml diff --git a/Tests/24-11-25_new_script.yaml b/Tests/24-11-25_new_script.yaml new file mode 100644 index 0000000..fbb7f06 --- /dev/null +++ b/Tests/24-11-25_new_script.yaml @@ -0,0 +1,529 @@ +esphome: + name: buttonplus-test + friendly_name: ButtonPlus_test + on_boot: + priority: -100 + then: + - script.execute: setup_bar_displays + - script.execute: update_bar1_left + - script.execute: update_bar1_right + - script.execute: update_bar2_left + - script.execute: update_bar2_right + - script.execute: update_bar3_left + - script.execute: update_bar3_right + +esp32: + board: esp32-s3-devkitc-1 + flash_size: 16MB + framework: + type: arduino + +debug: + update_interval: 5s + +text_sensor: + - platform: debug + device: + name: "Device Info" + reset_reason: + name: "Reset Reason" + +# Logger must be at least debug (default) +logger: + level: debug + +# Enable Home Assistant API +api: + encryption: + key: "" + +ota: + - platform: esphome + password: "" + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + output_power: 15.5dB + +i2c: + - id: temperature_sensor + sda: GPIO1 + scl: GPIO2 + - id: buttons + sda: GPIO47 + scl: GPIO48 + frequency: 400khz + +spi: + clk_pin: GPIO36 + mosi_pin: GPIO35 + +mcp23008: + - id: base_J0 + i2c_id: buttons + address: 0x20 + - id: base_J1 + i2c_id: buttons + address: 0x21 + - id: base_J2 + i2c_id: buttons + address: 0x22 + - id: base_J3 + i2c_id: buttons + address: 0x23 + +output: + - platform: ledc + pin: GPIO3 + id: display_main_backlight_pwm + inverted: True + max_power: 1.0 + frequency: 500Hz + - platform: ledc + pin: GPIO46 + id: displays_mini_backlight_pwm + inverted: True + max_power: 0.6 + frequency: 500Hz + - id: cs_pin_bar1_left + platform: gpio + pin: + mcp23xxx: base_J1 + number: 5 + mode: + output: true + inverted: true + - id: cs_pin_bar1_right + platform: gpio + pin: + mcp23xxx: base_J1 + number: 1 + mode: + output: true + inverted: true + - id: cs_pin_bar2_left + platform: gpio + pin: + mcp23xxx: base_J2 + number: 5 + mode: + output: true + inverted: true + - id: cs_pin_bar2_right + platform: gpio + pin: + mcp23xxx: base_J2 + number: 1 + mode: + output: true + inverted: true + - id: cs_pin_bar3_left + platform: gpio + pin: + mcp23xxx: base_J3 + number: 5 + mode: + output: true + inverted: true + - id: cs_pin_bar3_right + platform: gpio + pin: + mcp23xxx: base_J3 + number: 1 + mode: + output: true + inverted: true + +sensor: + - platform: sts3x + id: inside_temperature + i2c_id: temperature_sensor + name: "Temperature" + address: 0x4A + update_interval: 10s + - platform: homeassistant + entity_id: sensor.gw1100a_outdoor_temperature + id: outside_temperature + - platform: debug + free: + name: "Heap Free" + block: + name: "Heap Max Block" + loop_time: + name: "Loop Time" + psram: + name: "Free PSRAM" + +time: + - platform: homeassistant + id: datetime + +font: + - file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf" + id: font_arial20 + size: 20 + bpp: 4 + - file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf" + id: font_arial15 + size: 15 + bpp: 4 + - file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf" + id: font_arial40 + size: 40 + bpp: 4 + - file: "https://torinak.com/font/7segment.ttf" + id: font_clock + size: 80 + bpp: 4 + - file: "https://torinak.com/font/7segment.ttf" + id: font_date + size: 30 + bpp: 4 + +image: + - file: mdi:lightbulb + id: lightbulb + resize: 80x80 + - file: mdi:alert + id: alert + resize: 80x80 + - file: mdi:chevron-right + id: icon_next_page + resize: 30x30 + - file: mdi:chevron-left + id: icon_prev_page + resize: 30x30 + - file: mdi:sun-thermometer-outline + id: icon_temp_outside + resize: 40x40 + - file: mdi:home-thermometer-outline + id: icon_temp_inside + resize: 40x40 + +color: + - id: red + hex: FF0000 + - id: blue + hex: 0000FF + - id: yellow + hex: FFFF00 + - id: green + hex: 00FF00 + - id: orange + hex: FF7F00 + - id: white + hex: FFFFFF + +binary_sensor: + - platform: gpio + id: 'main_display_btn_left' + name: "Main Display button Left" + pin: + mcp23xxx: base_J2 + number: 6 + mode: INPUT_PULLUP + inverted: true + on_click: + - script.execute: prev_page_all + - platform: gpio + id: 'main_display_btn_right' + name: "Main Display button Right" + pin: + mcp23xxx: base_J2 + number: 2 + mode: INPUT_PULLUP + inverted: true + on_click: + - script.execute: next_page_all + - platform: gpio + id: 'bar1_btn_left' + name: "BAR 1 button Left" + pin: + mcp23xxx: base_J3 + number: 6 + mode: INPUT_PULLUP + inverted: true + - platform: gpio + id: 'bar1_btn_right' + name: "BAR 1 button Right" + pin: + mcp23xxx: base_J3 + number: 2 + mode: INPUT_PULLUP + inverted: true + +light: + - platform: neopixelbus + id: neopixels + type: RGB + variant: WS2812 + pin: GPIO4 + num_leds: 5 + - platform: monochromatic + output: display_main_backlight_pwm + gamma_correct : 2.2 + name: "Main Display Backlight" + id: display_main_backlight + restore_mode: ALWAYS_ON + - platform: monochromatic + output: displays_mini_backlight_pwm + gamma_correct : 2.2 + name: "Mini Display Backlight" + id: displays_mini_backlight + restore_mode: ALWAYS_ON + - platform: partition + name: "BAR 1 Left RGB Front" + id: bar1_left_rgb_front + segments: + - id: neopixels + from: 0 + to: 0 + - platform: partition + name: "BAR 1 Left RGB Back" + id: bar1_left_rgb_back + segments: + - id: neopixels + from: 1 + to: 1 + - platform: partition + name: "BAR 1 Right RGB Front" + id: bar1_right_rgb_front + segments: + - id: neopixels + from: 2 + to: 2 + - platform: partition + name: "BAR 1 Right RGB Back" + id: bar1_right_rgb_back + segments: + - id: neopixels + from: 3 + to: 3 + +display: + - id: main_display + platform: ili9xxx + model: ili9341 + color_order: rgb + update_interval: 30s + invert_colors: false + dc_pin: + number: GPIO37 + allow_other_uses: true + cs_pin: + mcp23xxx: base_J0 + number: 5 + mode: + output: true + inverted: false + show_test_card: false + dimensions: + height: 240 + width: 320 + rotation: 180 + pages: + - id: page1 + lambda: |- + id(all_pages).execute(); + it.print(100, 160, id(font_arial20), "This is page 1!"); + - id: bar_display + platform: ili9xxx + model: ST7735 + color_order: bgr + update_interval: never + dc_pin: + number: GPIO37 + allow_other_uses: true + invert_colors: false + show_test_card: false + auto_clear_enabled: false + dimensions: + height: 160 + width: 80 + offset_width: 24 + +script: + - id: update_bar1_left + then: + - lambda: |- + id(cs_pin_bar1_left).turn_on(); // << + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_off(); + id(bar_display).clear(); + id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); + id(bar1_left_page1).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(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_off(); + id(bar_display).clear(); + id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); + id(bar1_right_page1).execute(); + id(bar_display).update(); + delay(1); + id(cs_pin_bar1_right).turn_off(); + - id: update_bar2_left + then: + - lambda: |- + id(cs_pin_bar1_left).turn_off(); + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_on(); // << + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_off(); + // + id(bar_display).fill(id(orange)); + id(bar_display).update(); + delay(1); + id(cs_pin_bar2_left).turn_off(); + - id: update_bar2_right + then: + - lambda: |- + id(cs_pin_bar1_left).turn_off(); + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_on(); // << + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_off(); + // + id(bar_display).fill(id(orange)); + id(bar_display).update(); + delay(1); + id(cs_pin_bar2_right).turn_off(); + - id: update_bar3_left + then: + - lambda: |- + id(cs_pin_bar1_left).turn_off(); + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_on(); // << + id(cs_pin_bar3_right).turn_off(); + // + id(bar_display).fill(id(orange)); + id(bar_display).update(); + delay(1); + id(cs_pin_bar3_left).turn_off(); + - id: update_bar3_right + then: + - lambda: |- + id(cs_pin_bar1_left).turn_off(); + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_on(); + // + id(bar_display).fill(id(orange)); + id(bar_display).update(); + delay(1); + id(cs_pin_bar3_right).turn_off(); + - id: bar1_left_page1 + then: + - lambda: |- + id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(orange)); + - id: bar1_right_page1 + then: + - lambda: |- + id(bar_display).image(80, 0, id(alert), ImageAlign::TOP_CENTER, id(red)); + - 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(); + delay(5); + id(cs_pin_bar2_left).turn_on(); + id(bar_display).setup(); + id(cs_pin_bar2_left).turn_off(); + delay(5); + id(cs_pin_bar2_right).turn_on(); + id(bar_display).setup(); + id(cs_pin_bar2_right).turn_off(); + delay(5); + id(cs_pin_bar3_left).turn_on(); + id(bar_display).setup(); + id(cs_pin_bar3_left).turn_off(); + delay(5); + id(cs_pin_bar3_right).turn_on(); + id(bar_display).setup(); + id(cs_pin_bar3_right).turn_off(); + - 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 + - script.execute: update_bar2_left + - script.execute: update_bar2_right + - script.execute: update_bar3_left + - script.execute: update_bar3_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 + - id: all_pages + then: + - lambda: |- + //>>> make a border arround the display + id(main_display).filled_rectangle( 0, 0, 320, 3, id(red)); + id(main_display).filled_rectangle( 0, 0, 3, 240, id(red)); + id(main_display).filled_rectangle( 0, 237, 320, 3, id(red)); + //id(main_display).filled_rectangle( 0, 206, 320, 3, id(red)); + id(main_display).filled_rectangle(317, 0, 3, 240, id(red)); + // + //>>> prev/next icons next to butotns + id(main_display).image(0, 208, id(icon_prev_page), ImageAlign::TOP_LEFT, id(orange)); + id(main_display).image(320, 208, id(icon_next_page), ImageAlign::TOP_RIGHT, id(orange)); + // + //>>> temperature inside: + id(main_display).image(36, 15, id(icon_temp_inside), ImageAlign::TOP_CENTER, id(orange)); + id(main_display).printf(36, 85, id(font_arial20), id(white), TextAlign::BASELINE_CENTER , "%.1f°", id(inside_temperature).state); + // + //>>> vertical line: + id(main_display).filled_rectangle(70, 0, 3, 115, id(red)); + // + //>>> print time and date + id(main_display).strftime(160, 5, id(font_clock), TextAlign::TOP_CENTER, "%H:%M", id(datetime).now()); + id(main_display).strftime(160, 80, id(font_date), TextAlign::TOP_CENTER, "%d-%m-%Y", id(datetime).now()); + // + //>>> vertical line: + id(main_display).filled_rectangle(250, 0, 3, 115, id(red)); + // + //>>> outside temperature + id(main_display).image(285, 15, id(icon_temp_outside), ImageAlign::TOP_CENTER, id(orange)); + id(main_display).printf(285, 85, id(font_arial20), id(white), TextAlign::BASELINE_CENTER , "%.1f°", id(outside_temperature).state); + // + //>>> horizontal line: + id(main_display).filled_rectangle(0, 115, 320, 3, id(red)); + From 4bae23978ac82a08900c586597aa3adb389da660 Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 25 Nov 2024 19:55:12 +0100 Subject: [PATCH 51/77] test after bootloop --- package/3bar_1display_scripts.yaml | 60 +++++++++++++++--------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/package/3bar_1display_scripts.yaml b/package/3bar_1display_scripts.yaml index 144d038..7939d2e 100644 --- a/package/3bar_1display_scripts.yaml +++ b/package/3bar_1display_scripts.yaml @@ -21,7 +21,7 @@ script: id(cs_pin_bar3_right).turn_off(); id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); - id(bar1_left_draw).execute(); + //id(bar1_left_draw).execute(); id(bar_display).update(); delay(1); id(cs_pin_bar1_left).turn_off(); @@ -36,7 +36,7 @@ script: id(cs_pin_bar3_right).turn_off(); id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - id(bar1_left_draw).execute(); + //id(bar1_left_draw).execute(); id(bar_display).update(); delay(1); id(cs_pin_bar1_right).turn_off(); @@ -51,7 +51,7 @@ script: id(cs_pin_bar3_right).turn_off(); id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); - id(bar2_left_draw).execute(); + //id(bar2_left_draw).execute(); id(bar_display).update(); delay(1); id(cs_pin_bar2_left).turn_off(); @@ -66,7 +66,7 @@ script: id(cs_pin_bar3_right).turn_off(); id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - id(bar2_right_draw).execute(); + //id(bar2_right_draw).execute(); id(bar_display).update(); delay(1); id(cs_pin_bar2_right).turn_off(); @@ -81,7 +81,7 @@ script: id(cs_pin_bar3_right).turn_off(); id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); - id(bar3_left_draw).execute(); + //id(bar3_left_draw).execute(); id(bar_display).update(); delay(1); id(cs_pin_bar3_left).turn_off(); @@ -96,37 +96,37 @@ script: id(cs_pin_bar3_right).turn_on(); // << id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - id(bar3_right_draw).execute(); + //id(bar3_right_draw).execute(); id(bar_display).update(); delay(1); id(cs_pin_bar3_right).turn_off(); #################### ### draw scripts ### #################### - - id: bar1_left_draw - then: - - lambda: |- - 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: bar1_right_draw - then: - - lambda: |- - 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: bar2_left_draw - then: - - lambda: |- - ESP_LOGD("TODO", "You need to extend the bar2_left_draw script to draw something on the bar display \n script: \n - id: !extend bar2_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); - - id: bar2_right_draw - then: - - lambda: |- - ESP_LOGD("TODO", "You need to extend the bar2_right_draw script to draw something on the bar display \n script: \n - id: !extend bar2_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); - - id: bar3_left_draw - then: - - lambda: |- - ESP_LOGD("TODO", "You need to extend the bar3_left_draw script to draw something on the bar display \n script: \n - id: !extend bar3_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); - - id: bar3_right_draw - then: - - lambda: |- - ESP_LOGD("TODO", "You need to extend the bar3_right_draw script to draw something on the bar display \n script: \n - id: !extend bar3_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + # - id: bar1_left_draw + # then: + # - lambda: |- + # 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: bar1_right_draw + # then: + # - lambda: |- + # 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: bar2_left_draw + # then: + # - lambda: |- + # ESP_LOGD("TODO", "You need to extend the bar2_left_draw script to draw something on the bar display \n script: \n - id: !extend bar2_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + # - id: bar2_right_draw + # then: + # - lambda: |- + # ESP_LOGD("TODO", "You need to extend the bar2_right_draw script to draw something on the bar display \n script: \n - id: !extend bar2_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + # - id: bar3_left_draw + # then: + # - lambda: |- + # ESP_LOGD("TODO", "You need to extend the bar3_left_draw script to draw something on the bar display \n script: \n - id: !extend bar3_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + # - id: bar3_right_draw + # then: + # - lambda: |- + # ESP_LOGD("TODO", "You need to extend the bar3_right_draw script to draw something on the bar display \n script: \n - id: !extend bar3_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); ############################## ### other handling scripts ### ############################## From 7d7c653c67425c3bf9e86a88a602707af37f3b40 Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 25 Nov 2024 20:08:12 +0100 Subject: [PATCH 52/77] component update wich does not exists.. strange compiler should not mis this --- package/1bar_1display_scripts.yaml | 4 +- package/2bar_1display_scripts.yaml | 8 +- package/3bar_1display_scripts.yaml | 168 ++++++++++++++--------------- 3 files changed, 90 insertions(+), 90 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index c50e6df..5e435a9 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -60,8 +60,8 @@ script: - id: update_all then: - component.update: main_display - - component.update: bar1_display_left - - component.update: bar1_display_right + - script.execute: update_bar1_left + - script.execute: update_bar1_right - id: next_page_main then: - display.page.show_next: main_display diff --git a/package/2bar_1display_scripts.yaml b/package/2bar_1display_scripts.yaml index 5bc8152..578410a 100644 --- a/package/2bar_1display_scripts.yaml +++ b/package/2bar_1display_scripts.yaml @@ -98,10 +98,10 @@ script: - id: update_all then: - component.update: main_display - - component.update: bar1_display_left - - component.update: bar1_display_right - - component.update: bar2_display_left - - component.update: bar2_display_right + - script.execute: update_bar1_left + - script.execute: update_bar1_right + - script.execute: update_bar2_left + - script.execute: update_bar2_right - id: next_page_main then: - display.page.show_next: main_display diff --git a/package/3bar_1display_scripts.yaml b/package/3bar_1display_scripts.yaml index 7939d2e..f4ad5e4 100644 --- a/package/3bar_1display_scripts.yaml +++ b/package/3bar_1display_scripts.yaml @@ -12,94 +12,94 @@ script: ###################### - id: update_bar1_left then: - - lambda: |- - id(cs_pin_bar1_left).turn_on(); // << - id(cs_pin_bar1_right).turn_off(); - id(cs_pin_bar2_left).turn_off(); - id(cs_pin_bar2_right).turn_off(); - id(cs_pin_bar3_left).turn_off(); - id(cs_pin_bar3_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(); + # - lambda: |- + # id(cs_pin_bar1_left).turn_on(); // << + # id(cs_pin_bar1_right).turn_off(); + # id(cs_pin_bar2_left).turn_off(); + # id(cs_pin_bar2_right).turn_off(); + # id(cs_pin_bar3_left).turn_off(); + # id(cs_pin_bar3_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(cs_pin_bar2_left).turn_off(); - id(cs_pin_bar2_right).turn_off(); - id(cs_pin_bar3_left).turn_off(); - id(cs_pin_bar3_right).turn_off(); - id(bar_display).clear(); - id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - //id(bar1_left_draw).execute(); - id(bar_display).update(); - delay(1); - id(cs_pin_bar1_right).turn_off(); + # - lambda: |- + # id(cs_pin_bar1_left).turn_off(); + # id(cs_pin_bar1_right).turn_on(); // << + # id(cs_pin_bar2_left).turn_off(); + # id(cs_pin_bar2_right).turn_off(); + # id(cs_pin_bar3_left).turn_off(); + # id(cs_pin_bar3_right).turn_off(); + # id(bar_display).clear(); + # id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); + # //id(bar1_left_draw).execute(); + # id(bar_display).update(); + # delay(1); + # id(cs_pin_bar1_right).turn_off(); - id: update_bar2_left then: - - lambda: |- - id(cs_pin_bar1_left).turn_off(); - id(cs_pin_bar1_right).turn_off(); - id(cs_pin_bar2_left).turn_on(); // << - id(cs_pin_bar2_right).turn_off(); - id(cs_pin_bar3_left).turn_off(); - id(cs_pin_bar3_right).turn_off(); - id(bar_display).clear(); - id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); - //id(bar2_left_draw).execute(); - id(bar_display).update(); - delay(1); - id(cs_pin_bar2_left).turn_off(); + # - lambda: |- + # id(cs_pin_bar1_left).turn_off(); + # id(cs_pin_bar1_right).turn_off(); + # id(cs_pin_bar2_left).turn_on(); // << + # id(cs_pin_bar2_right).turn_off(); + # id(cs_pin_bar3_left).turn_off(); + # id(cs_pin_bar3_right).turn_off(); + # id(bar_display).clear(); + # id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); + # //id(bar2_left_draw).execute(); + # id(bar_display).update(); + # delay(1); + # id(cs_pin_bar2_left).turn_off(); - id: update_bar2_right then: - - lambda: |- - id(cs_pin_bar1_left).turn_off(); - id(cs_pin_bar1_right).turn_off(); - id(cs_pin_bar2_left).turn_off(); - id(cs_pin_bar2_right).turn_on(); // << - id(cs_pin_bar3_left).turn_off(); - id(cs_pin_bar3_right).turn_off(); - id(bar_display).clear(); - id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - //id(bar2_right_draw).execute(); - id(bar_display).update(); - delay(1); - id(cs_pin_bar2_right).turn_off(); + # - lambda: |- + # id(cs_pin_bar1_left).turn_off(); + # id(cs_pin_bar1_right).turn_off(); + # id(cs_pin_bar2_left).turn_off(); + # id(cs_pin_bar2_right).turn_on(); // << + # id(cs_pin_bar3_left).turn_off(); + # id(cs_pin_bar3_right).turn_off(); + # id(bar_display).clear(); + # id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); + # //id(bar2_right_draw).execute(); + # id(bar_display).update(); + # delay(1); + # id(cs_pin_bar2_right).turn_off(); - id: update_bar3_left then: - - lambda: |- - id(cs_pin_bar1_left).turn_off(); - id(cs_pin_bar1_right).turn_off(); - id(cs_pin_bar2_left).turn_off(); - id(cs_pin_bar2_right).turn_off(); - id(cs_pin_bar3_left).turn_on(); // << - id(cs_pin_bar3_right).turn_off(); - id(bar_display).clear(); - id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); - //id(bar3_left_draw).execute(); - id(bar_display).update(); - delay(1); - id(cs_pin_bar3_left).turn_off(); + # - lambda: |- + # id(cs_pin_bar1_left).turn_off(); + # id(cs_pin_bar1_right).turn_off(); + # id(cs_pin_bar2_left).turn_off(); + # id(cs_pin_bar2_right).turn_off(); + # id(cs_pin_bar3_left).turn_on(); // << + # id(cs_pin_bar3_right).turn_off(); + # id(bar_display).clear(); + # id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); + # //id(bar3_left_draw).execute(); + # id(bar_display).update(); + # delay(1); + # id(cs_pin_bar3_left).turn_off(); - id: update_bar3_right then: - - lambda: |- - id(cs_pin_bar1_left).turn_off(); - id(cs_pin_bar1_right).turn_off(); - id(cs_pin_bar2_left).turn_off(); - id(cs_pin_bar2_right).turn_off(); - id(cs_pin_bar3_left).turn_off(); - id(cs_pin_bar3_right).turn_on(); // << - id(bar_display).clear(); - id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - //id(bar3_right_draw).execute(); - id(bar_display).update(); - delay(1); - id(cs_pin_bar3_right).turn_off(); + # - lambda: |- + # id(cs_pin_bar1_left).turn_off(); + # id(cs_pin_bar1_right).turn_off(); + # id(cs_pin_bar2_left).turn_off(); + # id(cs_pin_bar2_right).turn_off(); + # id(cs_pin_bar3_left).turn_off(); + # id(cs_pin_bar3_right).turn_on(); // << + # id(bar_display).clear(); + # id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); + # //id(bar3_right_draw).execute(); + # id(bar_display).update(); + # delay(1); + # id(cs_pin_bar3_right).turn_off(); #################### ### draw scripts ### #################### @@ -136,12 +136,12 @@ script: - id: update_all then: - component.update: main_display - - component.update: bar1_display_left - - component.update: bar1_display_right - - component.update: bar2_display_left - - component.update: bar2_display_right - - component.update: bar3_display_left - - component.update: bar3_display_right + - script.execute: update_bar1_left + - script.execute: update_bar1_right + - script.execute: update_bar2_left + - script.execute: update_bar2_right + - script.execute: update_bar3_left + - script.execute: update_bar3_right - id: next_page_main then: - display.page.show_next: main_display From fd89e312a19946d364266f38d6dd963797aa485d Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 25 Nov 2024 20:14:04 +0100 Subject: [PATCH 53/77] removed test comments --- package/3bar_1display_scripts.yaml | 204 ++++++++++++++--------------- 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/package/3bar_1display_scripts.yaml b/package/3bar_1display_scripts.yaml index f4ad5e4..c597d95 100644 --- a/package/3bar_1display_scripts.yaml +++ b/package/3bar_1display_scripts.yaml @@ -12,121 +12,121 @@ script: ###################### - id: update_bar1_left then: - # - lambda: |- - # id(cs_pin_bar1_left).turn_on(); // << - # id(cs_pin_bar1_right).turn_off(); - # id(cs_pin_bar2_left).turn_off(); - # id(cs_pin_bar2_right).turn_off(); - # id(cs_pin_bar3_left).turn_off(); - # id(cs_pin_bar3_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(); + - lambda: |- + id(cs_pin_bar1_left).turn_on(); // << + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_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(cs_pin_bar2_left).turn_off(); - # id(cs_pin_bar2_right).turn_off(); - # id(cs_pin_bar3_left).turn_off(); - # id(cs_pin_bar3_right).turn_off(); - # id(bar_display).clear(); - # id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - # //id(bar1_left_draw).execute(); - # id(bar_display).update(); - # delay(1); - # id(cs_pin_bar1_right).turn_off(); + - lambda: |- + id(cs_pin_bar1_left).turn_off(); + id(cs_pin_bar1_right).turn_on(); // << + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_off(); + id(bar_display).clear(); + id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); + //id(bar1_left_draw).execute(); + id(bar_display).update(); + delay(1); + id(cs_pin_bar1_right).turn_off(); - id: update_bar2_left then: - # - lambda: |- - # id(cs_pin_bar1_left).turn_off(); - # id(cs_pin_bar1_right).turn_off(); - # id(cs_pin_bar2_left).turn_on(); // << - # id(cs_pin_bar2_right).turn_off(); - # id(cs_pin_bar3_left).turn_off(); - # id(cs_pin_bar3_right).turn_off(); - # id(bar_display).clear(); - # id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); - # //id(bar2_left_draw).execute(); - # id(bar_display).update(); - # delay(1); - # id(cs_pin_bar2_left).turn_off(); + - lambda: |- + id(cs_pin_bar1_left).turn_off(); + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_on(); // << + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_off(); + id(bar_display).clear(); + id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); + //id(bar2_left_draw).execute(); + id(bar_display).update(); + delay(1); + id(cs_pin_bar2_left).turn_off(); - id: update_bar2_right then: - # - lambda: |- - # id(cs_pin_bar1_left).turn_off(); - # id(cs_pin_bar1_right).turn_off(); - # id(cs_pin_bar2_left).turn_off(); - # id(cs_pin_bar2_right).turn_on(); // << - # id(cs_pin_bar3_left).turn_off(); - # id(cs_pin_bar3_right).turn_off(); - # id(bar_display).clear(); - # id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - # //id(bar2_right_draw).execute(); - # id(bar_display).update(); - # delay(1); - # id(cs_pin_bar2_right).turn_off(); + - lambda: |- + id(cs_pin_bar1_left).turn_off(); + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_on(); // << + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_off(); + id(bar_display).clear(); + id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); + //id(bar2_right_draw).execute(); + id(bar_display).update(); + delay(1); + id(cs_pin_bar2_right).turn_off(); - id: update_bar3_left then: - # - lambda: |- - # id(cs_pin_bar1_left).turn_off(); - # id(cs_pin_bar1_right).turn_off(); - # id(cs_pin_bar2_left).turn_off(); - # id(cs_pin_bar2_right).turn_off(); - # id(cs_pin_bar3_left).turn_on(); // << - # id(cs_pin_bar3_right).turn_off(); - # id(bar_display).clear(); - # id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); - # //id(bar3_left_draw).execute(); - # id(bar_display).update(); - # delay(1); - # id(cs_pin_bar3_left).turn_off(); + - lambda: |- + id(cs_pin_bar1_left).turn_off(); + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_on(); // << + id(cs_pin_bar3_right).turn_off(); + id(bar_display).clear(); + id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); + //id(bar3_left_draw).execute(); + id(bar_display).update(); + delay(1); + id(cs_pin_bar3_left).turn_off(); - id: update_bar3_right then: - # - lambda: |- - # id(cs_pin_bar1_left).turn_off(); - # id(cs_pin_bar1_right).turn_off(); - # id(cs_pin_bar2_left).turn_off(); - # id(cs_pin_bar2_right).turn_off(); - # id(cs_pin_bar3_left).turn_off(); - # id(cs_pin_bar3_right).turn_on(); // << - # id(bar_display).clear(); - # id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - # //id(bar3_right_draw).execute(); - # id(bar_display).update(); - # delay(1); - # id(cs_pin_bar3_right).turn_off(); + - lambda: |- + id(cs_pin_bar1_left).turn_off(); + id(cs_pin_bar1_right).turn_off(); + id(cs_pin_bar2_left).turn_off(); + id(cs_pin_bar2_right).turn_off(); + id(cs_pin_bar3_left).turn_off(); + id(cs_pin_bar3_right).turn_on(); // << + id(bar_display).clear(); + id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); + //id(bar3_right_draw).execute(); + id(bar_display).update(); + delay(1); + id(cs_pin_bar3_right).turn_off(); #################### ### draw scripts ### #################### - # - id: bar1_left_draw - # then: - # - lambda: |- - # 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: bar1_right_draw - # then: - # - lambda: |- - # 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: bar2_left_draw - # then: - # - lambda: |- - # ESP_LOGD("TODO", "You need to extend the bar2_left_draw script to draw something on the bar display \n script: \n - id: !extend bar2_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); - # - id: bar2_right_draw - # then: - # - lambda: |- - # ESP_LOGD("TODO", "You need to extend the bar2_right_draw script to draw something on the bar display \n script: \n - id: !extend bar2_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); - # - id: bar3_left_draw - # then: - # - lambda: |- - # ESP_LOGD("TODO", "You need to extend the bar3_left_draw script to draw something on the bar display \n script: \n - id: !extend bar3_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); - # - id: bar3_right_draw - # then: - # - lambda: |- - # ESP_LOGD("TODO", "You need to extend the bar3_right_draw script to draw something on the bar display \n script: \n - id: !extend bar3_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + - id: bar1_left_draw + then: + - lambda: |- + 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: bar1_right_draw + then: + - lambda: |- + 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: bar2_left_draw + then: + - lambda: |- + ESP_LOGD("TODO", "You need to extend the bar2_left_draw script to draw something on the bar display \n script: \n - id: !extend bar2_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + - id: bar2_right_draw + then: + - lambda: |- + ESP_LOGD("TODO", "You need to extend the bar2_right_draw script to draw something on the bar display \n script: \n - id: !extend bar2_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + - id: bar3_left_draw + then: + - lambda: |- + ESP_LOGD("TODO", "You need to extend the bar3_left_draw script to draw something on the bar display \n script: \n - id: !extend bar3_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + - id: bar3_right_draw + then: + - lambda: |- + ESP_LOGD("TODO", "You need to extend the bar3_right_draw script to draw something on the bar display \n script: \n - id: !extend bar3_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); ############################## ### other handling scripts ### ############################## From 96f1c836be70366e8c8e123c6c65fed551a97ba8 Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 25 Nov 2024 20:35:46 +0100 Subject: [PATCH 54/77] added display setup script --- package/1bar_1display_scripts.yaml | 13 ++++++++++ package/2bar_1display_scripts.yaml | 21 +++++++++++++++ package/3bar_1display_scripts.yaml | 41 +++++++++++++++++++++++++----- 3 files changed, 69 insertions(+), 6 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 5e435a9..47e7987 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -40,6 +40,19 @@ script: 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 ### #################### diff --git a/package/2bar_1display_scripts.yaml b/package/2bar_1display_scripts.yaml index 578410a..17d0ab3 100644 --- a/package/2bar_1display_scripts.yaml +++ b/package/2bar_1display_scripts.yaml @@ -70,6 +70,27 @@ script: id(bar_display).update(); delay(1); id(cs_pin_bar2_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(); + delay(5); + id(cs_pin_bar2_left).turn_on(); + id(bar_display).setup(); + id(cs_pin_bar2_left).turn_off(); + delay(5); + id(cs_pin_bar2_right).turn_on(); + id(bar_display).setup(); + id(cs_pin_bar2_right).turn_off(); #################### ### draw scripts ### #################### diff --git a/package/3bar_1display_scripts.yaml b/package/3bar_1display_scripts.yaml index c597d95..b075372 100644 --- a/package/3bar_1display_scripts.yaml +++ b/package/3bar_1display_scripts.yaml @@ -21,7 +21,7 @@ script: id(cs_pin_bar3_right).turn_off(); id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); - //id(bar1_left_draw).execute(); + id(bar1_left_draw).execute(); id(bar_display).update(); delay(1); id(cs_pin_bar1_left).turn_off(); @@ -36,7 +36,7 @@ script: id(cs_pin_bar3_right).turn_off(); id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - //id(bar1_left_draw).execute(); + id(bar1_left_draw).execute(); id(bar_display).update(); delay(1); id(cs_pin_bar1_right).turn_off(); @@ -51,7 +51,7 @@ script: id(cs_pin_bar3_right).turn_off(); id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); - //id(bar2_left_draw).execute(); + id(bar2_left_draw).execute(); id(bar_display).update(); delay(1); id(cs_pin_bar2_left).turn_off(); @@ -66,7 +66,7 @@ script: id(cs_pin_bar3_right).turn_off(); id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - //id(bar2_right_draw).execute(); + id(bar2_right_draw).execute(); id(bar_display).update(); delay(1); id(cs_pin_bar2_right).turn_off(); @@ -81,7 +81,7 @@ script: id(cs_pin_bar3_right).turn_off(); id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); - //id(bar3_left_draw).execute(); + id(bar3_left_draw).execute(); id(bar_display).update(); delay(1); id(cs_pin_bar3_left).turn_off(); @@ -96,10 +96,39 @@ script: id(cs_pin_bar3_right).turn_on(); // << id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - //id(bar3_right_draw).execute(); + id(bar3_right_draw).execute(); id(bar_display).update(); delay(1); id(cs_pin_bar3_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(); + delay(5); + id(cs_pin_bar2_left).turn_on(); + id(bar_display).setup(); + id(cs_pin_bar2_left).turn_off(); + delay(5); + id(cs_pin_bar2_right).turn_on(); + id(bar_display).setup(); + id(cs_pin_bar2_right).turn_off(); + delay(5); + id(cs_pin_bar3_left).turn_on(); + id(bar_display).setup(); + id(cs_pin_bar3_left).turn_off(); + delay(5); + id(cs_pin_bar3_right).turn_on(); + id(bar_display).setup(); + id(cs_pin_bar3_right).turn_off(); #################### ### draw scripts ### #################### From a7953e79d852aa3b3d212d47bfee22419f7dd589 Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 26 Nov 2024 05:18:49 +0100 Subject: [PATCH 55/77] change setup order --- package/3bar_1display_scripts.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/package/3bar_1display_scripts.yaml b/package/3bar_1display_scripts.yaml index b075372..e42972d 100644 --- a/package/3bar_1display_scripts.yaml +++ b/package/3bar_1display_scripts.yaml @@ -108,26 +108,27 @@ script: - 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_left).turn_off(); id(cs_pin_bar1_right).turn_on(); id(bar_display).setup(); - id(cs_pin_bar1_right).turn_off(); delay(5); + id(cs_pin_bar1_right).turn_off(); id(cs_pin_bar2_left).turn_on(); id(bar_display).setup(); - id(cs_pin_bar2_left).turn_off(); delay(5); + id(cs_pin_bar2_left).turn_off(); id(cs_pin_bar2_right).turn_on(); id(bar_display).setup(); - id(cs_pin_bar2_right).turn_off(); delay(5); + id(cs_pin_bar2_right).turn_off(); id(cs_pin_bar3_left).turn_on(); id(bar_display).setup(); - id(cs_pin_bar3_left).turn_off(); delay(5); + id(cs_pin_bar3_left).turn_off(); id(cs_pin_bar3_right).turn_on(); id(bar_display).setup(); + delay(5); id(cs_pin_bar3_right).turn_off(); #################### ### draw scripts ### From 620fea3163a293748818a486cb0fa416bef2f4b2 Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 26 Nov 2024 05:22:20 +0100 Subject: [PATCH 56/77] added version notation --- package/3bar_1display.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package/3bar_1display.yaml b/package/3bar_1display.yaml index 7c6c8ea..6b716df 100644 --- a/package/3bar_1display.yaml +++ b/package/3bar_1display.yaml @@ -14,6 +14,8 @@ esphome: on_boot: priority: -100 then: + - logger.log: + format: "ESPHome for Button+ v0.1.0_dev" - script.execute: setup_bar_displays - script.execute: update_bar1_left - script.execute: update_bar1_right From 6a87901537a354da8da82948850d2aa879c64d81 Mon Sep 17 00:00:00 2001 From: Martijn Date: Tue, 26 Nov 2024 05:26:38 +0100 Subject: [PATCH 57/77] repeat version every minute --- package/3bar_1display.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/package/3bar_1display.yaml b/package/3bar_1display.yaml index 6b716df..612c8a8 100644 --- a/package/3bar_1display.yaml +++ b/package/3bar_1display.yaml @@ -24,6 +24,12 @@ esphome: - script.execute: update_bar3_left - script.execute: update_bar3_right +interval: + - interval: 1min + then: + - logger.log: + format: "ESPHome for Button+ v0.1.0_dev" + mcp23008: - id: 'base_J0' i2c_id: buttons From f50719b30c2a174ff291088ca07659274aedbba7 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 30 Nov 2024 10:50:17 +0100 Subject: [PATCH 58/77] change log --- package/3bar_1display.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package/3bar_1display.yaml b/package/3bar_1display.yaml index 612c8a8..df214ee 100644 --- a/package/3bar_1display.yaml +++ b/package/3bar_1display.yaml @@ -27,8 +27,7 @@ esphome: interval: - interval: 1min then: - - logger.log: - format: "ESPHome for Button+ v0.1.0_dev" + - logger.log: "ESPHome for Button+ v0.1.0_dev" mcp23008: - id: 'base_J0' From 38d4abb364a898ae9b824d9c63242dfbf52598e8 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 30 Nov 2024 10:52:42 +0100 Subject: [PATCH 59/77] removed lines --- package/1bar_1display_scripts.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 47e7987..8a4be63 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -15,10 +15,6 @@ script: - lambda: |- id(cs_pin_bar1_left).turn_on(); // << id(cs_pin_bar1_right).turn_off(); - id(cs_pin_bar2_left).turn_off(); - id(cs_pin_bar2_right).turn_off(); - id(cs_pin_bar3_left).turn_off(); - id(cs_pin_bar3_right).turn_off(); id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_270_DEGREES); id(bar1_left_draw).execute(); @@ -30,10 +26,6 @@ script: - lambda: |- id(cs_pin_bar1_left).turn_off(); id(cs_pin_bar1_right).turn_on(); // << - id(cs_pin_bar2_left).turn_off(); - id(cs_pin_bar2_right).turn_off(); - id(cs_pin_bar3_left).turn_off(); - id(cs_pin_bar3_right).turn_off(); id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); id(bar1_left_draw).execute(); From 2f99a19994f86636787c008c33c042f844e4614d Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 30 Nov 2024 11:03:55 +0100 Subject: [PATCH 60/77] change log --- package/3bar_1display.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package/3bar_1display.yaml b/package/3bar_1display.yaml index df214ee..73f68d0 100644 --- a/package/3bar_1display.yaml +++ b/package/3bar_1display.yaml @@ -14,8 +14,7 @@ esphome: on_boot: priority: -100 then: - - logger.log: - format: "ESPHome for Button+ v0.1.0_dev" + - logger.log: "ESPHome for Button+ v0.1.0_dev" - script.execute: setup_bar_displays - script.execute: update_bar1_left - script.execute: update_bar1_right From 2fd11dff55bfc5b9a866497a63005e361a4f09e7 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 30 Nov 2024 12:41:13 +0100 Subject: [PATCH 61/77] corrected bar1 right draw script --- package/1bar_1display_scripts.yaml | 2 +- package/2bar_1display_scripts.yaml | 2 +- package/3bar_1display_scripts.yaml | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 8a4be63..7c214be 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -28,7 +28,7 @@ script: id(cs_pin_bar1_right).turn_on(); // << id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - id(bar1_left_draw).execute(); + id(bar1_right_draw).execute(); id(bar_display).update(); delay(1); id(cs_pin_bar1_right).turn_off(); diff --git a/package/2bar_1display_scripts.yaml b/package/2bar_1display_scripts.yaml index 17d0ab3..4f9cdbd 100644 --- a/package/2bar_1display_scripts.yaml +++ b/package/2bar_1display_scripts.yaml @@ -36,7 +36,7 @@ script: id(cs_pin_bar3_right).turn_off(); id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - id(bar1_left_draw).execute(); + id(bar1_right_draw).execute(); id(bar_display).update(); delay(1); id(cs_pin_bar1_right).turn_off(); diff --git a/package/3bar_1display_scripts.yaml b/package/3bar_1display_scripts.yaml index e42972d..92454eb 100644 --- a/package/3bar_1display_scripts.yaml +++ b/package/3bar_1display_scripts.yaml @@ -36,7 +36,7 @@ script: id(cs_pin_bar3_right).turn_off(); id(bar_display).clear(); id(bar_display).set_rotation(display::DisplayRotation::DISPLAY_ROTATION_90_DEGREES); - id(bar1_left_draw).execute(); + id(bar1_right_draw).execute(); id(bar_display).update(); delay(1); id(cs_pin_bar1_right).turn_off(); @@ -136,27 +136,27 @@ script: - id: bar1_left_draw then: - lambda: |- - 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!"); + 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: bar1_right_draw then: - lambda: |- - 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!"); + 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: bar2_left_draw then: - lambda: |- - ESP_LOGD("TODO", "You need to extend the bar2_left_draw script to draw something on the bar display \n script: \n - id: !extend bar2_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + ESP_LOGD("TODO", "You need to extend the bar2_left_draw script to draw something on the bar display \n script: \n - id: !extend bar2_left_draw\n then:\n - lambda: |-\n \/\/ your draw scripts here!"); - id: bar2_right_draw then: - lambda: |- - ESP_LOGD("TODO", "You need to extend the bar2_right_draw script to draw something on the bar display \n script: \n - id: !extend bar2_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + ESP_LOGD("TODO", "You need to extend the bar2_right_draw script to draw something on the bar display \n script: \n - id: !extend bar2_right_draw\n then:\n - lambda: |-\n \/\/ your draw scripts here!"); - id: bar3_left_draw then: - lambda: |- - ESP_LOGD("TODO", "You need to extend the bar3_left_draw script to draw something on the bar display \n script: \n - id: !extend bar3_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + ESP_LOGD("TODO", "You need to extend the bar3_left_draw script to draw something on the bar display \n script: \n - id: !extend bar3_left_draw\n then:\n - lambda: |-\n \/\/ your draw scripts here!"); - id: bar3_right_draw then: - lambda: |- - ESP_LOGD("TODO", "You need to extend the bar3_right_draw script to draw something on the bar display \n script: \n - id: !extend bar3_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + ESP_LOGD("TODO", "You need to extend the bar3_right_draw script to draw something on the bar display \n script: \n - id: !extend bar3_right_draw\n then:\n - lambda: |-\n \/\/ your draw scripts here!"); ############################## ### other handling scripts ### ############################## From bc8fd52728586d4a7dfee269700d14b086be30cf Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 30 Nov 2024 18:00:41 +0100 Subject: [PATCH 62/77] removed log message --- package/1bar_1display_scripts.yaml | 10 +++++++-- package/2bar_1display_scripts.yaml | 20 ++++++++++++++---- package/3bar_1display_scripts.yaml | 34 +++++++++++------------------- 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 7c214be..7820cee 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -51,11 +51,17 @@ script: - id: bar1_left_draw then: - lambda: |- - 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!"); + 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: |- - 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!"); + 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 ### ############################## diff --git a/package/2bar_1display_scripts.yaml b/package/2bar_1display_scripts.yaml index 4f9cdbd..5751743 100644 --- a/package/2bar_1display_scripts.yaml +++ b/package/2bar_1display_scripts.yaml @@ -97,19 +97,31 @@ script: - id: bar1_left_draw then: - lambda: |- - 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!"); + 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: |- - 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!"); + 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; + } - id: bar2_left_draw then: - lambda: |- - ESP_LOGD("TODO", "You need to extend the bar2_left_draw script to draw something on the bar display \n script: \n - id: !extend bar2_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + if (id(show_todos)) { + ESP_LOGD("TODO", "You need to extend the bar2_left_draw script to draw something on the bar display \n script: \n - id: !extend bar2_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + id(show_todos) = false; + } - id: bar2_right_draw then: - lambda: |- - ESP_LOGD("TODO", "You need to extend the bar2_right_draw script to draw something on the bar display \n script: \n - id: !extend bar2_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + if (id(show_todos)) { + ESP_LOGD("TODO", "You need to extend the bar2_right_draw script to draw something on the bar display \n script: \n - id: !extend bar2_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); + id(show_todos) = false; + } ############################## ### other handling scripts ### ############################## diff --git a/package/3bar_1display_scripts.yaml b/package/3bar_1display_scripts.yaml index 92454eb..326ee04 100644 --- a/package/3bar_1display_scripts.yaml +++ b/package/3bar_1display_scripts.yaml @@ -100,9 +100,9 @@ script: id(bar_display).update(); delay(1); id(cs_pin_bar3_right).turn_off(); -################################## -### setup mini display scripts ### -################################## +#################################### +### setup mini display's scripts ### +#################################### - id: setup_bar_displays then: - lambda: |- @@ -130,36 +130,23 @@ script: id(bar_display).setup(); delay(5); id(cs_pin_bar3_right).turn_off(); -#################### -### draw scripts ### -#################### +############################### +### pre-define draw scripts ### +############################### - id: bar1_left_draw - then: - - lambda: |- - 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: bar1_right_draw then: - - lambda: |- - 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: bar2_left_draw then: - - lambda: |- - ESP_LOGD("TODO", "You need to extend the bar2_left_draw script to draw something on the bar display \n script: \n - id: !extend bar2_left_draw\n then:\n - lambda: |-\n \/\/ your draw scripts here!"); - id: bar2_right_draw then: - - lambda: |- - ESP_LOGD("TODO", "You need to extend the bar2_right_draw script to draw something on the bar display \n script: \n - id: !extend bar2_right_draw\n then:\n - lambda: |-\n \/\/ your draw scripts here!"); - id: bar3_left_draw then: - - lambda: |- - ESP_LOGD("TODO", "You need to extend the bar3_left_draw script to draw something on the bar display \n script: \n - id: !extend bar3_left_draw\n then:\n - lambda: |-\n \/\/ your draw scripts here!"); - id: bar3_right_draw then: - - lambda: |- - ESP_LOGD("TODO", "You need to extend the bar3_right_draw script to draw something on the bar display \n script: \n - id: !extend bar3_right_draw\n then:\n - lambda: |-\n \/\/ your draw scripts here!"); -############################## -### other handling scripts ### -############################## +###################### +### update scripts ### +###################### - id: update_main then: - component.update: main_display @@ -172,6 +159,9 @@ script: - script.execute: update_bar2_right - script.execute: update_bar3_left - script.execute: update_bar3_right +###################### +### paging scripts ### +###################### - id: next_page_main then: - display.page.show_next: main_display From f647fa2e129813d4bd6bf2e45e2c9ced4fc7b111 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 30 Nov 2024 18:26:02 +0100 Subject: [PATCH 63/77] removed log message --- package/1bar_1display_scripts.yaml | 10 ---------- package/2bar_1display_scripts.yaml | 20 -------------------- 2 files changed, 30 deletions(-) diff --git a/package/1bar_1display_scripts.yaml b/package/1bar_1display_scripts.yaml index 7820cee..1d08129 100644 --- a/package/1bar_1display_scripts.yaml +++ b/package/1bar_1display_scripts.yaml @@ -50,18 +50,8 @@ script: #################### - 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 ### ############################## diff --git a/package/2bar_1display_scripts.yaml b/package/2bar_1display_scripts.yaml index 5751743..aa7914e 100644 --- a/package/2bar_1display_scripts.yaml +++ b/package/2bar_1display_scripts.yaml @@ -96,32 +96,12 @@ script: #################### - 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; - } - id: bar2_left_draw then: - - lambda: |- - if (id(show_todos)) { - ESP_LOGD("TODO", "You need to extend the bar2_left_draw script to draw something on the bar display \n script: \n - id: !extend bar2_left_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); - id(show_todos) = false; - } - id: bar2_right_draw then: - - lambda: |- - if (id(show_todos)) { - ESP_LOGD("TODO", "You need to extend the bar2_right_draw script to draw something on the bar display \n script: \n - id: !extend bar2_right_draw\n then:\n - lambda: |-\n \\ your draw scripts here!"); - id(show_todos) = false; - } ############################## ### other handling scripts ### ############################## From a715bc2784e0f562a0dc33eb00f027fcf5c08635 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 30 Nov 2024 18:26:33 +0100 Subject: [PATCH 64/77] moved some default scripts to base --- package/3bar_1display_scripts.yaml | 20 +----------------- package/base.yaml | 33 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/package/3bar_1display_scripts.yaml b/package/3bar_1display_scripts.yaml index 326ee04..3aac20d 100644 --- a/package/3bar_1display_scripts.yaml +++ b/package/3bar_1display_scripts.yaml @@ -134,6 +134,7 @@ script: ### pre-define draw scripts ### ############################### - id: bar1_left_draw + then: - id: bar1_right_draw then: - id: bar2_left_draw @@ -159,22 +160,3 @@ script: - script.execute: update_bar2_right - script.execute: update_bar3_left - script.execute: update_bar3_right -###################### -### paging scripts ### -###################### - - 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 diff --git a/package/base.yaml b/package/base.yaml index c348239..9ea7c2a 100644 --- a/package/base.yaml +++ b/package/base.yaml @@ -23,6 +23,16 @@ spi: clk_pin: GPIO36 mosi_pin: GPIO35 +global: + - id: nr_of_pages + type: int + restore_value: no + initial_value: '1' + - id: actual_page + type: int + restore_value: no + initial_value: '0' + output: - platform: ledc pin: GPIO3 @@ -68,3 +78,26 @@ light: time: - platform: homeassistant id: datetime + +script: +###################### +### paging scripts ### +###################### + - id: next_page + then: + - lambda: |- + id(actual_page) = id(actual_page) + 1; + if(id(actual_page) >= id(nr_of_pages)) { + id(actual_page) = 0; + } + - display.page.show_next: main_display + - script.execute: update_all + - id: prev_page + then: + - lambda: |- + id(actual_page) = id(actual_page) - 1; + if(id(actual_page) <= 0 { + id(actual_page) = id(nr_of_pages); + } + - display.page.show_previous: main_display + - script.execute: update_all From 5352ea4511dda9764fdb48f9aabf8babd03cc360 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 30 Nov 2024 18:26:46 +0100 Subject: [PATCH 65/77] added music card documentation --- package/cards/music.md | 44 ++++++++++++++++++++++++++++++++++++++++ package/cards/music.yaml | 37 ++++++++++++++++++++++++++++++++- 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 package/cards/music.md diff --git a/package/cards/music.md b/package/cards/music.md new file mode 100644 index 0000000..0571317 --- /dev/null +++ b/package/cards/music.md @@ -0,0 +1,44 @@ +# ESPHome Button+ - Music card + +## Usage + +* Add the music card file to youre files and supply the `entity_id` + ``` + substitutions: + music_card_enity_id: 'media_player.media_keuken_2' + package: + remote_package_files: + url: https://github.com/dixi83/ESPHome_ButtonPlus + files: [,'package/cards/music.yaml'] + ``` +* Add the music card to the main display `lambda` and give it the position you want + ``` + id(music_card).execute(20, 125); + ``` + +* Add the icons buttons to the BAR's + + Select one of the folowing types: + * `volume_up` + * `volume_down` + * `next` + * `prev` + * `playpause` + * `power` + + ``` + id(music_card_bar).execute('volume_up') + ``` + +* add actions to the buttons + Select the a matching action for the button: + * `music_card_vol_up` + * `music_card_vol_down` + * `music_card_next` + * `music_card_prev` + * `music_card_playpause` + * `music_card_power` + + ``` + id(music_card_vol_up).execute() + ``` diff --git a/package/cards/music.yaml b/package/cards/music.yaml index d1a89b8..0f624c8 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -163,4 +163,39 @@ script: id(main_display).image(80, 2, id(icon_music_on), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); } } - \ No newline at end of file + - id: music_card_vol_up + then: + - homeassistant.action: + action: media_player.volume_up + data: + entity_id: ${music_card_enity_id} + - id: music_card_vol_dowen + then: + - homeassistant.action: + action: media_player.volume_down + data: + entity_id: ${music_card_enity_id} + - id: music_card_next + then: + - homeassistant.action: + action: media_player.media_next_track + data: + entity_id: ${music_card_enity_id} + - id: music_card_prev + then: + - homeassistant.action: + action: media_player.media_previous_track + data: + entity_id: ${music_card_enity_id} + - id: music_card_playpause + then: + - homeassistant.action: + action: media_player.media_play_pause + data: + entity_id: ${music_card_enity_id} + - id: music_card_power + then: + - homeassistant.action: + action: media_player.toggle + data: + entity_id: ${music_card_enity_id} From f261f9a22ad7f8be88e42b06a308cb434c35d636 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 30 Nov 2024 18:30:52 +0100 Subject: [PATCH 66/77] globals should be globals --- package/base.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base.yaml b/package/base.yaml index 9ea7c2a..8340f94 100644 --- a/package/base.yaml +++ b/package/base.yaml @@ -23,7 +23,7 @@ spi: clk_pin: GPIO36 mosi_pin: GPIO35 -global: +globals: - id: nr_of_pages type: int restore_value: no From ca12bc8bb512256bec143f5019792694649b3140 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 30 Nov 2024 18:33:23 +0100 Subject: [PATCH 67/77] removed variable that has been set to a default value --- package/base.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/package/base.yaml b/package/base.yaml index 8340f94..d4fa569 100644 --- a/package/base.yaml +++ b/package/base.yaml @@ -26,11 +26,9 @@ spi: globals: - id: nr_of_pages type: int - restore_value: no initial_value: '1' - id: actual_page type: int - restore_value: no initial_value: '0' output: From f9428d7c57761291d74f0e918646a99188870d9c Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 30 Nov 2024 18:35:07 +0100 Subject: [PATCH 68/77] forgotten bracket --- package/base.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base.yaml b/package/base.yaml index d4fa569..bf914d1 100644 --- a/package/base.yaml +++ b/package/base.yaml @@ -94,7 +94,7 @@ script: then: - lambda: |- id(actual_page) = id(actual_page) - 1; - if(id(actual_page) <= 0 { + if(id(actual_page) <= 0) { id(actual_page) = id(nr_of_pages); } - display.page.show_previous: main_display From c636518d15503281e29bb5fb92c50f8e6014a227 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 30 Nov 2024 18:42:39 +0100 Subject: [PATCH 69/77] main dispay has no paging anymore --- package/base.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/base.yaml b/package/base.yaml index bf914d1..1890af3 100644 --- a/package/base.yaml +++ b/package/base.yaml @@ -88,7 +88,7 @@ script: if(id(actual_page) >= id(nr_of_pages)) { id(actual_page) = 0; } - - display.page.show_next: main_display + # - display.page.show_next: main_display - script.execute: update_all - id: prev_page then: @@ -97,5 +97,5 @@ script: if(id(actual_page) <= 0) { id(actual_page) = id(nr_of_pages); } - - display.page.show_previous: main_display + # - display.page.show_previous: main_display - script.execute: update_all From ca8ab78b12d2c4384c376aec05f749bc5b9b8f8f Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 2 Dec 2024 16:24:41 +0100 Subject: [PATCH 70/77] added semicolumn --- package/cards/music.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/cards/music.md b/package/cards/music.md index 0571317..69078b4 100644 --- a/package/cards/music.md +++ b/package/cards/music.md @@ -27,7 +27,7 @@ * `power` ``` - id(music_card_bar).execute('volume_up') + id(music_card_bar).execute('volume_up'); ``` * add actions to the buttons @@ -40,5 +40,5 @@ * `music_card_power` ``` - id(music_card_vol_up).execute() + id(music_card_vol_up).execute(); ``` From f230b4300f926c65a8a381d3fdf321d6b2751c40 Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 2 Dec 2024 16:24:49 +0100 Subject: [PATCH 71/77] typo... --- package/cards/music.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index 0f624c8..8e5bf21 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -169,7 +169,7 @@ script: action: media_player.volume_up data: entity_id: ${music_card_enity_id} - - id: music_card_vol_dowen + - id: music_card_vol_down then: - homeassistant.action: action: media_player.volume_down From 1b8e3bde55d886c98ec0759c4dca9e692e500b54 Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 2 Dec 2024 16:40:43 +0100 Subject: [PATCH 72/77] c_str between double quotes --- package/cards/music.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/cards/music.md b/package/cards/music.md index 69078b4..a3a6989 100644 --- a/package/cards/music.md +++ b/package/cards/music.md @@ -27,7 +27,7 @@ * `power` ``` - id(music_card_bar).execute('volume_up'); + id(music_card_bar).execute("volume_up"); ``` * add actions to the buttons From d20582b585c22735a91ea8adb9a884f5dc255b5c Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 2 Dec 2024 16:40:58 +0100 Subject: [PATCH 73/77] main display should be bar display --- package/cards/music.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index 8e5bf21..f9ab76e 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -143,24 +143,24 @@ script: then: - lambda: |- if (strcmp(type.c_str(), "volume_up") == 0) { // button "volume_up" - id(main_display).image(80, 2, id(icon_music_vol_up), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); + id(bar_display).image(80, 2, id(icon_music_vol_up), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); } else if (strcmp(type.c_str(), "volume_down") == 0) { // button "volume_down" - id(main_display).image(80, 2, id(icon_music_vol_down), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); + id(bar_display).image(80, 2, id(icon_music_vol_down), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); } else if (strcmp(type.c_str(), "next") == 0) { // button "next" - id(main_display).image(80, 2, id(icon_music_next), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); + id(bar_display).image(80, 2, id(icon_music_next), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); } else if (strcmp(type.c_str(), "prev") == 0) { // button "prev" - id(main_display).image(80, 2, id(icon_music_prev), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); + id(bar_display).image(80, 2, id(icon_music_prev), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); } else if (strcmp(type.c_str(), "playpause") == 0) { // button "playpause" if (strcmp(id(music_playerstate).state.c_str(), "playing") == 0) { - id(main_display).image(80, 2, id(icon_music_pause), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); + id(bar_display).image(80, 2, id(icon_music_pause), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); } else { - id(main_display).image(80, 2, id(icon_music_play), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); + id(bar_display).image(80, 2, id(icon_music_play), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); } } else if (strcmp(type.c_str(), "power") == 0) { // button "power" if (strcmp(id(music_playerstate).state.c_str(), "off") == 0) { - id(main_display).image(80, 2, id(icon_music_off), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); + id(bar_display).image(80, 2, id(icon_music_off), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); } else { - id(main_display).image(80, 2, id(icon_music_on), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); + id(bar_display).image(80, 2, id(icon_music_on), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); } } - id: music_card_vol_up From f80caa345f4320b15519684073604b2ba7783f76 Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 2 Dec 2024 16:53:49 +0100 Subject: [PATCH 74/77] new icons for playpause and power bar button --- package/cards/music.yaml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/package/cards/music.yaml b/package/cards/music.yaml index f9ab76e..ac54855 100644 --- a/package/cards/music.yaml +++ b/package/cards/music.yaml @@ -41,9 +41,15 @@ image: - file: mdi:power-on id: icon_music_on resize: 75x75 + - file: mdi:power + id: icon_music_power + resize: 75x75 - file: mdi:timer-sand-empty id: icon_music_idle resize: 75x75 + - file: mdi:play-pause + id: icon_music_playpause + resize: 75x75 - file: mdi:play-box-outline id: icon_music_play resize: 75x75 @@ -151,17 +157,9 @@ script: } else if (strcmp(type.c_str(), "prev") == 0) { // button "prev" id(bar_display).image(80, 2, id(icon_music_prev), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); } else if (strcmp(type.c_str(), "playpause") == 0) { // button "playpause" - if (strcmp(id(music_playerstate).state.c_str(), "playing") == 0) { - id(bar_display).image(80, 2, id(icon_music_pause), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); - } else { - id(bar_display).image(80, 2, id(icon_music_play), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); - } + id(bar_display).image(80, 2, id(icon_music_playpause), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); } else if (strcmp(type.c_str(), "power") == 0) { // button "power" - if (strcmp(id(music_playerstate).state.c_str(), "off") == 0) { - id(bar_display).image(80, 2, id(icon_music_off), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); - } else { - id(bar_display).image(80, 2, id(icon_music_on), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); - } + id(bar_display).image(80, 2, id(icon_music_power), ImageAlign::TOP_CENTER, id(music_card_icon_bar_color)); } - id: music_card_vol_up then: From d5b0559037cb8a360399b371922e5037c0f1e6b4 Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 2 Dec 2024 17:35:41 +0100 Subject: [PATCH 75/77] fix paging scripts --- package/base.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package/base.yaml b/package/base.yaml index 1890af3..39d6de6 100644 --- a/package/base.yaml +++ b/package/base.yaml @@ -88,14 +88,12 @@ script: if(id(actual_page) >= id(nr_of_pages)) { id(actual_page) = 0; } - # - display.page.show_next: main_display - script.execute: update_all - id: prev_page then: - lambda: |- id(actual_page) = id(actual_page) - 1; - if(id(actual_page) <= 0) { + if(id(actual_page) < 0) { id(actual_page) = id(nr_of_pages); } - # - display.page.show_previous: main_display - script.execute: update_all From a415f5680954f9e77ded0f3d7d7cb6bbb5905a29 Mon Sep 17 00:00:00 2001 From: Martijn Date: Mon, 2 Dec 2024 17:46:10 +0100 Subject: [PATCH 76/77] paging is zero based so minus 1 --- package/base.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base.yaml b/package/base.yaml index 39d6de6..c1b39c6 100644 --- a/package/base.yaml +++ b/package/base.yaml @@ -94,6 +94,6 @@ script: - lambda: |- id(actual_page) = id(actual_page) - 1; if(id(actual_page) < 0) { - id(actual_page) = id(nr_of_pages); + id(actual_page) = id(nr_of_pages) - 1; } - script.execute: update_all From 7c35f18de0cb643e2d43681331781266c4ff08a1 Mon Sep 17 00:00:00 2001 From: Martijn Date: Sat, 7 Dec 2024 19:21:52 +0100 Subject: [PATCH 77/77] added example --- Examples/3pages_TotalExample.yml | 632 +++++++++++++++++++++++++++++++ 1 file changed, 632 insertions(+) create mode 100644 Examples/3pages_TotalExample.yml diff --git a/Examples/3pages_TotalExample.yml b/Examples/3pages_TotalExample.yml new file mode 100644 index 0000000..73595c5 --- /dev/null +++ b/Examples/3pages_TotalExample.yml @@ -0,0 +1,632 @@ +esphome: + name: button-keuken + friendly_name: Button+ Keuken + +esp32: + board: esp32-s3-devkitc-1 + flash_size: 16MB + framework: + type: arduino + +# Enable logging +logger: + level: DEBUG + +debug: + update_interval: 5s + +# Enable Home Assistant API +api: + encryption: + key: "*" + +ota: + - platform: esphome + password: "*" + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + +substitutions: + music_card_enity_id: 'media_player.media_keuken_2' + music_card_text_color: FFFFFF + music_card_icon_main_color: FF7F00 + music_card_icon_bar_color: FF7F00 + +packages: + remote_package_files: + url: https://github.com/dixi83/ESPHome_ButtonPlus + files: + - 'package/3bar_1display.yaml' + - 'package/cards/music.yaml' + ref: serialize-displays + refresh: 10s + +globals: + - id: !extend nr_of_pages + initial_value: '3' + +font: + - file: "https://github.com/web-fonts/ttf/raw/refs/heads/master/bpg-ingiri-arial-webfont.ttf" + id: font_arial20 + size: 20 + bpp: 4 + - file: "https://torinak.com/font/7segment.ttf" + id: font_clock + size: 64 + bpp: 4 + - file: "https://torinak.com/font/7segment.ttf" + id: font_date + size: 24 + bpp: 4 + +image: + - file: mdi:lightbulb + id: lightbulb + resize: 80x80 + - file: mdi:alert + id: alert + resize: 80x80 + - file: mdi:chevron-right + id: icon_next_page + resize: 30x30 + - file: mdi:chevron-left + id: icon_prev_page + resize: 30x30 + - file: mdi:sun-thermometer-outline + id: icon_temp_outside + resize: 40x40 + - file: mdi:home-thermometer-outline + id: icon_temp_inside + resize: 40x40 + - file: mdi:trash-can + id: icon_trashcan + resize: 20x20 + +color: + - id: red + hex: FF0000 + - id: blue + hex: 0000FF + - id: yellow + hex: FFFF00 + - id: green + hex: 00FF00 + - id: orange + hex: FF7F00 + - id: white + hex: FFFFFF + - 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" + - "press page 1" + - "release page 1" + - "long press page 1" + - "press page 2" + - "release page 2" + - "long press page 2" + - platform: template + name: BAR1 button Right event + id: bar1_btn_right_event + event_types: + - "press page 0" + - "release page 0" + - "long press page 0" + - "press page 1" + - "release page 1" + - "long press page 1" + - "press page 2" + - "release page 2" + - "long press page 2" + - platform: template + name: BAR2 button Left event + id: bar2_btn_left_event + event_types: + - "press page 0" + - "release page 0" + - "long press page 0" + - "press page 1" + - "release page 1" + - "long press page 1" + - "press page 2" + - "release page 2" + - "long press page 2" + - platform: template + name: BAR2 button Right event + id: bar2_btn_right_event + event_types: + - "press page 0" + - "release page 0" + - "long press page 0" + - "press page 1" + - "release page 1" + - "long press page 1" + - "press page 2" + - "release page 2" + - "long press page 2" + - platform: template + name: BAR3 button Left event + id: bar3_btn_left_event + event_types: + - "press page 0" + - "release page 0" + - "long press page 0" + - "press page 1" + - "release page 1" + - "long press page 1" + - "press page 2" + - "release page 2" + - "long press page 2" + - platform: template + name: BAR3 button Right event + id: bar3_btn_right_event + event_types: + - "press page 0" + - "release page 0" + - "long press page 0" + - "press page 1" + - "release page 1" + - "long press page 1" + - "press page 2" + - "release page 2" + - "long press page 2" + +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; + case 1: + id(bar1_btn_left_event).trigger("press page 1"); + id(music_card_vol_down).execute(); + break; + case 2: + id(bar1_btn_left_event).trigger("press page 2"); + break; + } + on_release: + lambda: |- + switch (id(actual_page)){ + case 0: + id(bar1_btn_left_event).trigger("release page 0"); + break; + case 1: + id(bar1_btn_left_event).trigger("release page 1"); + break; + case 2: + id(bar1_btn_left_event).trigger("release page 2"); + 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; + case 1: + id(bar1_btn_left_event).trigger("long press page 1"); + break; + case 2: + id(bar1_btn_left_event).trigger("long press page 2"); + 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; + case 1: + id(bar1_btn_right_event).trigger("press page 1"); + id(music_card_vol_up).execute(); + break; + case 2: + id(bar1_btn_right_event).trigger("press page 2"); + break; + } + on_release: + lambda: |- + switch (id(actual_page)){ + case 0: + id(bar1_btn_right_event).trigger("release page 0"); + break; + case 1: + id(bar1_btn_right_event).trigger("release page 1"); + break; + case 2: + id(bar1_btn_right_event).trigger("release page 2"); + 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; + case 1: + id(bar1_btn_right_event).trigger("long press page 1"); + break; + case 2: + id(bar1_btn_right_event).trigger("long press page 2"); + 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; + case 1: + id(bar2_btn_left_event).trigger("press page 1"); + id(music_card_prev).execute(); + break; + case 2: + id(bar2_btn_left_event).trigger("press page 2"); + break; + } + on_release: + lambda: |- + switch (id(actual_page)){ + case 0: + id(bar2_btn_left_event).trigger("release page 0"); + break; + case 1: + id(bar2_btn_left_event).trigger("release page 1"); + break; + case 2: + id(bar2_btn_left_event).trigger("release page 2"); + 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; + case 1: + id(bar2_btn_left_event).trigger("long press page 1"); + break; + case 2: + id(bar2_btn_left_event).trigger("long press page 2"); + 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; + case 1: + id(bar2_btn_right_event).trigger("press page 1"); + id(music_card_next).execute(); + break; + case 2: + id(bar2_btn_right_event).trigger("press page 2"); + break; + } + on_release: + lambda: |- + switch (id(actual_page)){ + case 0: + id(bar2_btn_right_event).trigger("release page 0"); + break; + case 1: + id(bar2_btn_right_event).trigger("release page 1"); + break; + case 2: + id(bar2_btn_right_event).trigger("release page 2"); + 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; + case 1: + id(bar2_btn_right_event).trigger("long press page 1"); + break; + case 2: + id(bar2_btn_right_event).trigger("long press page 2"); + 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; + case 1: + id(bar3_btn_left_event).trigger("press page 1"); + id(music_card_power).execute(); + break; + case 2: + id(bar3_btn_left_event).trigger("press page 2"); + break; + } + on_release: + lambda: |- + switch (id(actual_page)){ + case 0: + id(bar3_btn_left_event).trigger("release page 0"); + break; + case 1: + id(bar3_btn_left_event).trigger("release page 1"); + break; + case 2: + id(bar3_btn_left_event).trigger("release page 2"); + 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; + case 1: + id(bar3_btn_left_event).trigger("long press page 1"); + break; + case 2: + id(bar3_btn_left_event).trigger("long press page 2"); + 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; + case 1: + id(bar3_btn_right_event).trigger("press page 1"); + id(music_card_playpause).execute(); + break; + case 2: + id(bar3_btn_right_event).trigger("press page 2"); + break; + } + on_release: + lambda: |- + switch (id(actual_page)){ + case 0: + id(bar3_btn_right_event).trigger("release page 0"); + break; + case 1: + id(bar3_btn_right_event).trigger("release page 1"); + break; + case 2: + id(bar3_btn_right_event).trigger("release page 2"); + 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; + case 1: + id(bar3_btn_right_event).trigger("long press page 1"); + break; + case 2: + id(bar3_btn_right_event).trigger("long press page 2"); + break; + } + +sensor: + - platform: homeassistant + entity_id: sensor.gw1100a_outdoor_temperature + id: outside_temperature + ################### + ### containers: ### + ################### + - platform: debug + free: + name: "Heap Free" + loop_time: + name: "Loop Time" + +text_sensor: + - platform: homeassistant + id: container_first + entity_id: sensor.afvalinfo_containers_first_trash + - platform: homeassistant + id: container_first_color + entity_id: sensor.afvalinfo_containers_first_trash_color + - platform: homeassistant + id: container_second + entity_id: sensor.afvalinfo_containers_second_trash + - platform: homeassistant + id: container_second_color + entity_id: sensor.afvalinfo_containers_second_trash_color + +display: + ######### + # MAIN ## + ######### + - id: !extend main_display + # data_rate: 40MHz + lambda: |- + id(all_pages_main).execute(); + switch (id(actual_page)){ + case 0: + id(containers).execute(); + break; + case 1: + id(music_card).execute(20, 125); + break; + case 2: + it.print(100, 160, id(font_arial20), "This is page 3!"); + break; + } + +script: + - id: containers + then: + - lambda: |- + // first trashcan: + int x = 23; + int y = 125; + if(strcmp(id(container_first_color).state.c_str(), "grey") == 0) { + id(main_display).image(x, y+4, id(icon_trashcan), ImageAlign::TOP_LEFT, id(grey)); + } else if (strcmp(id(container_first_color).state.c_str(), "green") == 0) { + id(main_display).image(x, y+4, id(icon_trashcan), ImageAlign::TOP_LEFT, id(green)); + } else if (strcmp(id(container_first_color).state.c_str(), "blue") == 0) { + id(main_display).image(x, y+4, id(icon_trashcan), ImageAlign::TOP_LEFT, id(blue)); + } else if (strcmp(id(container_first_color).state.c_str(), "orange") == 0) { + id(main_display).image(x, y+4, id(icon_trashcan), ImageAlign::TOP_LEFT, id(orange)); + } + id(main_display).print(x+22, y, id(font_arial20), id(music_card_text_color), TextAlign::TOP_LEFT , id(container_first).state.c_str()); + // secomnd trashcan: + y = 151; + if(strcmp(id(container_second_color).state.c_str(), "grey") == 0) { + id(main_display).image(x, y+4, id(icon_trashcan), ImageAlign::TOP_LEFT, id(grey)); + } else if (strcmp(id(container_second_color).state.c_str(), "green") == 0) { + id(main_display).image(x, y+4, id(icon_trashcan), ImageAlign::TOP_LEFT, id(green)); + } else if (strcmp(id(container_second_color).state.c_str(), "blue") == 0) { + id(main_display).image(x, y+4, id(icon_trashcan), ImageAlign::TOP_LEFT, id(blue)); + } else if (strcmp(id(container_second_color).state.c_str(), "orange") == 0) { + id(main_display).image(x, y+4, id(icon_trashcan), ImageAlign::TOP_LEFT, id(orange)); + } + id(main_display).print(x+22, y, id(font_arial20), id(music_card_text_color), TextAlign::TOP_LEFT , id(container_second).state.c_str()); + - id: all_pages_main + then: + - lambda: |- + //>>> prev/next icons next to butotns + id(main_display).image(0, 208, id(icon_prev_page), ImageAlign::TOP_LEFT, id(red)); + id(main_display).image(320, 208, id(icon_next_page), ImageAlign::TOP_RIGHT, id(red)); + // + //>>> temperature inside: + id(main_display).image(36, 15, id(icon_temp_inside), ImageAlign::TOP_CENTER, id(red)); + id(main_display).printf(36, 80, id(font_arial20), id(white), TextAlign::TOP_CENTER , "%.1f°", id(inside_temperature).state); + // + //>>> print time and date + id(main_display).strftime(160, 5, id(font_clock), TextAlign::TOP_CENTER, "%H:%M", id(datetime).now()); + id(main_display).strftime(160, 80, id(font_date), TextAlign::TOP_CENTER, "%d-%m-%Y", id(datetime).now()); + // + //>>> outside temperature + id(main_display).image(285, 15, id(icon_temp_outside), ImageAlign::TOP_CENTER, id(red)); + id(main_display).printf(285, 80, id(font_arial20), id(white), TextAlign::TOP_CENTER , "%.1f°", id(outside_temperature).state); + - id: !extend bar1_left_draw + then: + - lambda: |- + switch (id(actual_page)){ + case 0: + id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); + break; + case 1: + id(music_card_bar).execute("volume_down"); + break; + case 2: + id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(blue)); + break; + } + - id: !extend bar1_right_draw + then: + - lambda: |- + switch (id(actual_page)){ + case 0: + id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); + break; + case 1: + id(music_card_bar).execute("volume_up"); + break; + case 2: + id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(blue)); + break; + } + - id: !extend bar2_left_draw + then: + - lambda: |- + switch (id(actual_page)){ + case 0: + id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); + break; + case 1: + id(music_card_bar).execute("prev"); + break; + case 2: + id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(blue)); + break; + } + - id: !extend bar2_right_draw + then: + - lambda: |- + switch (id(actual_page)){ + case 0: + id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); + break; + case 1: + id(music_card_bar).execute("next"); + break; + case 2: + id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(blue)); + break; + } + - id: !extend bar3_left_draw + then: + - lambda: |- + switch (id(actual_page)){ + case 0: + id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); + break; + case 1: + id(music_card_bar).execute("power"); + break; + case 2: + id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(blue)); + break; + } + - id: !extend bar3_right_draw + then: + - lambda: |- + switch (id(actual_page)){ + case 0: + id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(red)); + break; + case 1: + id(music_card_bar).execute("playpause"); + break; + case 2: + id(bar_display).image(80, 0, id(lightbulb), ImageAlign::TOP_CENTER, id(blue)); + break; + }