Created
October 30, 2024 11:52
-
-
Save maxious/25cc6bbee4c3c26969f1c28f7bf86af0 to your computer and use it in GitHub Desktop.
ESPHome LVGL example config for SenseCAP Indicator D1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
substitutions: | |
name: esphome-web-95b0c8 | |
friendly_name: ESPHome Web 95b0c8 | |
esphome: | |
name: ${name} | |
friendly_name: ${friendly_name} | |
min_version: 2024.6.0 | |
name_add_mac_suffix: false | |
platformio_options: | |
board_build.flash_mode: dio | |
build_unflags: -Werror=all | |
project: | |
name: esphome.web | |
version: dev | |
on_boot: | |
then: | |
- light.turn_on: | |
id: lv_light | |
brightness: 100% | |
red: 100% | |
green: 0 | |
blue: 0 | |
esp32: | |
board: esp32-s3-devkitc-1 | |
framework: | |
type: esp-idf | |
# Required to achieve sufficient PSRAM bandwidth for screen graphics | |
sdkconfig_options: | |
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: y | |
CONFIG_ESP32S3_DATA_CACHE_64KB: y | |
CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y | |
CONFIG_SPIRAM_RODATA: y | |
# Enable Home Assistant API | |
api: | |
# Allow Over-The-Air updates | |
ota: | |
- platform: esphome | |
# Allow provisioning Wi-Fi via serial | |
improv_serial: | |
wifi: | |
# Set up a wifi access point | |
ap: {} | |
# In combination with the `ap` this allows the user | |
# to provision wifi credentials to the device via WiFi AP. | |
captive_portal: | |
dashboard_import: | |
package_import_url: github://esphome/firmware/esphome-web/esp32s3.yaml@main | |
import_full_config: true | |
# Sets up Bluetooth LE (Only on ESP32) to allow the user | |
# to provision wifi credentials to the device. | |
esp32_improv: | |
authorizer: none | |
# To have a "next url" for improv serial | |
web_server: | |
psram: | |
mode: octal | |
speed: 80MHz | |
logger: | |
level: DEBUG | |
hardware_uart: UART0 | |
output: | |
- platform: ledc | |
pin: | |
number: GPIO45 | |
ignore_strapping_warning: true | |
id: ledc_gpio4 | |
frequency: 100Hz | |
binary_sensor: | |
- platform: homeassistant | |
id: study_light_light | |
entity_id: light.study_light_light | |
publish_initial_state: true | |
on_state: | |
then: | |
lvgl.widget.update: | |
id: light_btn | |
state: | |
checked: !lambda return x; | |
light: | |
- platform: monochromatic | |
output: ledc_gpio4 | |
name: Display Backlight | |
id: display_backlight | |
restore_mode: ALWAYS_ON | |
- platform: lvgl | |
name: LVGL LED | |
id: lv_light | |
led: lv_led | |
effects: | |
- pulse: | |
name: "Slow Pulse" | |
# transition_length: 1s # defaults to 1s | |
update_interval: 2s | |
- strobe: | |
- strobe: | |
name: "Strobe Effect With Custom Values" | |
colors: | |
- state: true | |
brightness: 100% | |
red: 100% | |
green: 90% | |
blue: 0% | |
duration: 500ms | |
- state: false | |
duration: 250ms | |
- state: true | |
brightness: 100% | |
red: 0% | |
green: 100% | |
blue: 0% | |
duration: 500ms | |
spi: | |
- id: lcd_spi | |
clk_pin: 41 | |
mosi_pin: 48 | |
i2c: | |
sda: 39 | |
scl: 40 | |
scan: false | |
id: bus_a | |
# I/O expander. Touchscreen RESET and INTERRUPT are not used. | |
pca9554: | |
- id: p_c_a | |
pin_count: 16 | |
address: 0x20 | |
touchscreen: | |
- platform: ft5x06 | |
id: ft5x06_touchscreen | |
transform: | |
mirror_x: true | |
mirror_y: true | |
on_release: | |
then: | |
- if: | |
condition: lvgl.is_paused | |
then: | |
- light.turn_on: display_backlight | |
- lvgl.resume: | |
- lvgl.widget.redraw: | |
display: | |
- platform: st7701s | |
auto_clear_enabled: false | |
update_interval: never | |
spi_mode: MODE3 | |
color_order: RGB | |
dimensions: | |
width: 480 | |
height: 480 | |
invert_colors: true | |
transform: | |
mirror_x: true | |
mirror_y: true | |
cs_pin: | |
pca9554: p_c_a | |
number: 4 | |
reset_pin: | |
pca9554: p_c_a | |
number: 5 | |
de_pin: 18 | |
hsync_pin: 16 | |
vsync_pin: 17 | |
pclk_pin: 21 | |
# Init sequence can be one of the defaults and/or custom sequences. | |
init_sequence: | |
- 1 # select canned init sequence number 1 | |
# Custom sequences are an array, first byte is command, the rest are data. | |
- [ 0xE0, 0x1F ] # Set sunlight readable enhancement | |
data_pins: | |
red: | |
- 4 #r1 | |
- 3 #r2 | |
- 2 #r3 | |
- 1 #r4 | |
- 0 #r5 | |
green: | |
- 10 #g0 | |
- 9 #g1 | |
- 8 #g2 | |
- 7 #g3 | |
- 6 #g4 | |
- 5 #g5 | |
blue: | |
- 15 #b1 | |
- 14 #b2 | |
- 13 #b3 | |
- 12 #b4 | |
- 11 #b5 | |
lvgl: | |
touchscreens: ft5x06_touchscreen | |
buffer_size: 100% | |
default_font: montserrat_48 | |
on_idle: | |
- timeout: 10s | |
then: | |
- logger.log: idle timeout | |
- if: | |
condition: | |
lvgl.is_idle: | |
timeout: 5s | |
then: | |
- logger.log: LVGL is idle | |
- timeout: 15s | |
then: | |
- logger.log: idle 15s timeout | |
- lvgl.pause: | |
- light.turn_off: | |
id: display_backlight | |
transition_length: 5s | |
# debugging info will write all the touchscreen taps and their x/y to console | |
log_level: INFO | |
color_depth: 16 | |
widgets: | |
- led: | |
id: lv_led | |
color: 0xFF0000 | |
brightness: 50% | |
# - label: | |
# align: CENTER | |
# id: lbl_id | |
# recolor: true | |
# text: "#FF0000 write# #00FF00 colored# #0000FF text#" | |
- button: | |
id: light_btn | |
align: CENTER | |
width: 300 | |
height: 70 | |
checkable: true | |
widgets: | |
- label: | |
align: CENTER | |
text: 'let there be light' | |
on_click: | |
- homeassistant.action: | |
action: light.toggle | |
data: | |
entity_id: light.study_light_light |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment