From f3a108d6882e73eec1324570e4ac4da302f343fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Bing=C3=B6l?= Date: Sat, 4 Jan 2025 11:33:39 +0100 Subject: [PATCH 1/6] Add configuration for Guition 4-inch display --- HomeDicator/core.yaml | 8 +- HomeDicator/core/config/common/light.yaml | 4 +- .../config/device/guition-4inch/hardware.yaml | 107 ++++++++++++++++++ .../core/config/device/sdl/hardware.yaml | 2 +- .../seeed-sensecap-indicator/hardware.yaml | 2 +- HomeDicator/device/guition-4inch.yaml | 4 + 6 files changed, 119 insertions(+), 8 deletions(-) mode change 100755 => 100644 HomeDicator/core/config/common/light.yaml create mode 100644 HomeDicator/core/config/device/guition-4inch/hardware.yaml create mode 100644 HomeDicator/device/guition-4inch.yaml diff --git a/HomeDicator/core.yaml b/HomeDicator/core.yaml index c680be6..2abc3eb 100644 --- a/HomeDicator/core.yaml +++ b/HomeDicator/core.yaml @@ -1,7 +1,7 @@ ---- +--- substitutions: - homedicator_core_version_tag: "v0.3.2" - + homedicator_core_version_tag: "v0.3.2" + sensor: - !include core/config/common/sensors/wifi_signal.yaml - !include core/config/common/sensors/wifi_signal_percent.yaml @@ -11,7 +11,7 @@ text_sensor: - !include core/config/common/text_sensors/esphome_version.yaml binary_sensor: - - !include core/config/common/binary_sensors/indicator_button.yaml + # - !include core/config/common/binary_sensors/indicator_button.yaml switch: - !include core/config/common/switches/use_24h_clock_switch.yaml diff --git a/HomeDicator/core/config/common/light.yaml b/HomeDicator/core/config/common/light.yaml old mode 100755 new mode 100644 index dd0033f..ffde87a --- a/HomeDicator/core/config/common/light.yaml +++ b/HomeDicator/core/config/common/light.yaml @@ -1,6 +1,6 @@ light: - platform: monochromatic - output: ledc_gpio45 + output: ledc_pin name: Display id: indicator_display_backlight entity_category: config @@ -15,4 +15,4 @@ light: - delay: 220ms # Waiting for transition to be done so the new state is reflected. Maybe there is a better way? - lvgl.slider.update: id: lvgl_indicator_lcd_brightness_slider - value: !lambda 'return id(indicator_display_backlight).current_values.get_brightness() * 100.0;' + value: !lambda "return id(indicator_display_backlight).current_values.get_brightness() * 100.0;" diff --git a/HomeDicator/core/config/device/guition-4inch/hardware.yaml b/HomeDicator/core/config/device/guition-4inch/hardware.yaml new file mode 100644 index 0000000..c1642c3 --- /dev/null +++ b/HomeDicator/core/config/device/guition-4inch/hardware.yaml @@ -0,0 +1,107 @@ +esp32: + board: esp32-s3-devkitc-1 + variant: esp32s3 + flash_size: 16MB + framework: + type: esp-idf + sdkconfig_options: + COMPILER_OPTIMIZATION_SIZE: y + CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y" + CONFIG_ESP32S3_DATA_CACHE_64KB: "y" + CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y" + CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y + CONFIG_SPIRAM_RODATA: y + +psram: + mode: octal + speed: 80MHz + +output: + - platform: ledc + pin: + number: GPIO38 + id: ledc_pin + frequency: 100Hz + +i2c: + - id: bus_a + scl: GPIO45 + sda: GPIO19 + scan: false + +spi: + - id: lcd_spi + clk_pin: GPIO48 + mosi_pin: GPIO47 + +touchscreen: + platform: gt911 + id: guition_touchscreen + transform: + mirror_x: false + mirror_y: false + on_release: + - script.execute: activity_detected + +display: + - platform: st7701s + id: guition_display + update_interval: never + auto_clear_enabled: False + spi_mode: MODE3 + data_rate: 2MHz + color_order: RGB + invert_colors: False + dimensions: + width: 480 + height: 480 + cs_pin: 39 + de_pin: 18 + hsync_pin: 16 + vsync_pin: 17 + pclk_pin: 21 + pclk_frequency: 12MHz + pclk_inverted: False + hsync_pulse_width: 8 + hsync_front_porch: 10 + hsync_back_porch: 20 + vsync_pulse_width: 8 + vsync_front_porch: 10 + vsync_back_porch: 10 + init_sequence: + - 1 + # Custom sequences are an array, first byte is command, the rest are data. + - [0xFF, 0x77, 0x01, 0x00, 0x00, 0x10] # CMD2_BKSEL_BK0 + - [0xCD, 0x00] # disable MDT flag + data_pins: + red: + - 11 #r1 + - 12 #r2 + - 13 #r3 + - 14 #r4 + - 0 #r5 + green: + - 8 #g0 + - 20 #g1 + - 3 #g2 + - 46 #g3 + - 9 #g4 + - 10 #g5 + blue: + - 4 #b1 + - 5 #b2 + - 6 #b3 + - 7 #b4 + - 15 #b5 + +ota: + - platform: esphome + password: ${ota_key} + +wifi: + ssid: ${wifi_ssid} + password: ${wifi_password} + on_disconnect: + - lvgl.label.update: + id: lvgl_wifi_signal_icon + text: "\U000F092E" diff --git a/HomeDicator/core/config/device/sdl/hardware.yaml b/HomeDicator/core/config/device/sdl/hardware.yaml index a770d67..6bfef7c 100755 --- a/HomeDicator/core/config/device/sdl/hardware.yaml +++ b/HomeDicator/core/config/device/sdl/hardware.yaml @@ -2,7 +2,7 @@ host: output: - platform: template - id: ledc_gpio45 + id: ledc_pin type: float write_action: - logger.log: "Backlight output changed!" diff --git a/HomeDicator/core/config/device/seeed-sensecap-indicator/hardware.yaml b/HomeDicator/core/config/device/seeed-sensecap-indicator/hardware.yaml index d07071f..7fa67b8 100755 --- a/HomeDicator/core/config/device/seeed-sensecap-indicator/hardware.yaml +++ b/HomeDicator/core/config/device/seeed-sensecap-indicator/hardware.yaml @@ -22,7 +22,7 @@ output: pin: number: GPIO45 ignore_strapping_warning: true - id: ledc_gpio45 + id: ledc_pin frequency: 100Hz i2c: diff --git a/HomeDicator/device/guition-4inch.yaml b/HomeDicator/device/guition-4inch.yaml new file mode 100644 index 0000000..0207444 --- /dev/null +++ b/HomeDicator/device/guition-4inch.yaml @@ -0,0 +1,4 @@ +packages: + HomeDicatorBase: !include ../core.yaml + +<<: !include ../core/config/device/guition-4inch/hardware.yaml \ No newline at end of file From 5bf0023261942e979056c13410c34233a03f5bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Bing=C3=B6l?= Date: Sat, 4 Jan 2025 11:35:44 +0100 Subject: [PATCH 2/6] Add new 3-minute timeout option --- HomeDicator/core/config/common/lvgl/on_idle.yaml | 5 +++-- HomeDicator/user_interface/pages/settings.yaml | 13 +++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) mode change 100755 => 100644 HomeDicator/core/config/common/lvgl/on_idle.yaml mode change 100755 => 100644 HomeDicator/user_interface/pages/settings.yaml diff --git a/HomeDicator/core/config/common/lvgl/on_idle.yaml b/HomeDicator/core/config/common/lvgl/on_idle.yaml old mode 100755 new mode 100644 index 58e1efa..5518634 --- a/HomeDicator/core/config/common/lvgl/on_idle.yaml +++ b/HomeDicator/core/config/common/lvgl/on_idle.yaml @@ -2,8 +2,9 @@ timeout: !lambda |- switch (id(turn_off_screen_after_value)) { case 0: return 600000; // "Never" (10 min in ms / will check as a condition in the then block) case 1: return 60000; // "1 min" - case 2: return 300000; // "5 min" - case 3: return 900000; // "15 min" + case 2: return 180000; // "3 min" + case 3: return 300000; // "5 min" + case 4: return 900000; // "15 min" default: return 600000; // Default to 10 min in case of an invalid index } then: diff --git a/HomeDicator/user_interface/pages/settings.yaml b/HomeDicator/user_interface/pages/settings.yaml old mode 100755 new mode 100644 index d22b776..54af3c4 --- a/HomeDicator/user_interface/pages/settings.yaml +++ b/HomeDicator/user_interface/pages/settings.yaml @@ -4,9 +4,9 @@ bg_opa: COVER widgets: # PAGE TITLE - !include - file: ../templates/page_title.yaml - vars: - title: "Settings" + file: ../templates/page_title.yaml + vars: + title: "Settings" - obj: styles: content_container layout: @@ -69,12 +69,12 @@ widgets: then: - globals.set: id: user_is_interacting - value: 'true' + value: "true" on_release: then: - globals.set: id: user_is_interacting - value: 'false' + value: "false" on_value: if: condition: @@ -84,7 +84,7 @@ widgets: - light.control: id: indicator_display_backlight state: on - brightness: !lambda 'return x / 100.0;' + brightness: !lambda "return x / 100.0;" - label: text_color: 0xffffff text_font: brightness_big @@ -130,6 +130,7 @@ widgets: options: - "Never" - "1 min" + - "3 min" - "5 min" - "15 min" - obj: From 28dc16bb57f26bce81d45f645530e9fb83ace0a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Bing=C3=B6l?= Date: Sat, 4 Jan 2025 11:37:24 +0100 Subject: [PATCH 3/6] Change label color --- HomeDicator/user_interface/templates/tiles/sensor/square.yaml | 1 + 1 file changed, 1 insertion(+) mode change 100755 => 100644 HomeDicator/user_interface/templates/tiles/sensor/square.yaml diff --git a/HomeDicator/user_interface/templates/tiles/sensor/square.yaml b/HomeDicator/user_interface/templates/tiles/sensor/square.yaml old mode 100755 new mode 100644 index 27d64fe..42a7283 --- a/HomeDicator/user_interface/templates/tiles/sensor/square.yaml +++ b/HomeDicator/user_interface/templates/tiles/sensor/square.yaml @@ -28,6 +28,7 @@ obj: - obj: styles: info_or_button_tile_info width: SIZE_CONTENT + text_color: ${color} layout: type: FLEX flex_flow: ROW From b3db66c19d7c3d4e6b322e08452c640ba88d12c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer?= Date: Sat, 4 Jan 2025 13:48:26 +0100 Subject: [PATCH 4/6] Remove indicator_button in guition config, instead in core.yml --- HomeDicator/core.yaml | 2 +- HomeDicator/device/guition-4inch.yaml | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/HomeDicator/core.yaml b/HomeDicator/core.yaml index 2abc3eb..1448a05 100644 --- a/HomeDicator/core.yaml +++ b/HomeDicator/core.yaml @@ -11,7 +11,7 @@ text_sensor: - !include core/config/common/text_sensors/esphome_version.yaml binary_sensor: - # - !include core/config/common/binary_sensors/indicator_button.yaml + - !include core/config/common/binary_sensors/indicator_button.yaml switch: - !include core/config/common/switches/use_24h_clock_switch.yaml diff --git a/HomeDicator/device/guition-4inch.yaml b/HomeDicator/device/guition-4inch.yaml index 0207444..3dd9c60 100644 --- a/HomeDicator/device/guition-4inch.yaml +++ b/HomeDicator/device/guition-4inch.yaml @@ -1,4 +1,7 @@ packages: HomeDicatorBase: !include ../core.yaml - -<<: !include ../core/config/device/guition-4inch/hardware.yaml \ No newline at end of file + +binary_sensor: + - id: !remove indicator_button + +<<: !include ../core/config/device/guition-4inch/hardware.yaml From c37f915e988155815d752e419b77d05028a9b2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Bing=C3=B6l?= Date: Mon, 10 Feb 2025 21:43:54 +0100 Subject: [PATCH 5/6] Refactor YAML strings to use single quotes for consistency --- HomeDicator/core/config/common/light.yaml | 2 +- HomeDicator/user_interface/pages/settings.yaml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/HomeDicator/core/config/common/light.yaml b/HomeDicator/core/config/common/light.yaml index ffde87a..bb68867 100644 --- a/HomeDicator/core/config/common/light.yaml +++ b/HomeDicator/core/config/common/light.yaml @@ -15,4 +15,4 @@ light: - delay: 220ms # Waiting for transition to be done so the new state is reflected. Maybe there is a better way? - lvgl.slider.update: id: lvgl_indicator_lcd_brightness_slider - value: !lambda "return id(indicator_display_backlight).current_values.get_brightness() * 100.0;" + value: !lambda 'return id(indicator_display_backlight).current_values.get_brightness() * 100.0;' diff --git a/HomeDicator/user_interface/pages/settings.yaml b/HomeDicator/user_interface/pages/settings.yaml index 54af3c4..466d659 100644 --- a/HomeDicator/user_interface/pages/settings.yaml +++ b/HomeDicator/user_interface/pages/settings.yaml @@ -4,9 +4,9 @@ bg_opa: COVER widgets: # PAGE TITLE - !include - file: ../templates/page_title.yaml - vars: - title: "Settings" + file: ../templates/page_title.yaml + vars: + title: "Settings" - obj: styles: content_container layout: @@ -69,12 +69,12 @@ widgets: then: - globals.set: id: user_is_interacting - value: "true" + value: 'true' on_release: then: - globals.set: id: user_is_interacting - value: "false" + value: 'false' on_value: if: condition: @@ -84,7 +84,7 @@ widgets: - light.control: id: indicator_display_backlight state: on - brightness: !lambda "return x / 100.0;" + brightness: !lambda 'return x / 100.0;' - label: text_color: 0xffffff text_font: brightness_big From 1c4ce9785dada64e9fd9c60c7eed775d6c3e8cdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Bing=C3=B6l?= Date: Mon, 10 Feb 2025 21:46:00 +0100 Subject: [PATCH 6/6] Fix indentation in core.yaml --- HomeDicator/core.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HomeDicator/core.yaml b/HomeDicator/core.yaml index 1448a05..2df4a32 100644 --- a/HomeDicator/core.yaml +++ b/HomeDicator/core.yaml @@ -1,7 +1,7 @@ --- substitutions: - homedicator_core_version_tag: "v0.3.2" - + homedicator_core_version_tag: "v0.3.2" + sensor: - !include core/config/common/sensors/wifi_signal.yaml - !include core/config/common/sensors/wifi_signal_percent.yaml