esphome:
  name: tdongle
  friendly_name: tdongle

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf
  flash_size: 16MB

logger:

# Enable Home Assistant API
api:
  encryption:
    key: !secret lilygo_tdongle_key

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  domain: .reeselink.com
  fast_connect: true
  enable_btm: true
  id: wifithing
  # on_connect:
  #   - component.update: my_online_image

ota:
  - platform: esphome
    password: !secret ota_password

captive_portal:

binary_sensor:
  - platform: gpio
    pin: GPIO0
    name: Button

spi:
  - id: spi_led
    clk_pin: GPIO39
    mosi_pin: GPIO40
  - id: spi_lcd
    clk_pin: GPIO5
    mosi_pin: GPIO3

output:
  - platform: ledc
    frequency: 2000
    pin: GPIO38
    inverted: True
    id: backlight_output

light:
  - platform: monochromatic
    output: backlight_output
    name: "LCD Backlight"
    id: lcd_backlight
    restore_mode: ALWAYS_ON
# RGB Led, APA102 on GPIO39/GPIO40
  - platform: spi_led_strip
    spi_id: spi_led
    num_leds: 1
    name: "FastLED SPI Light"
    data_rate: 1MHz # Adjust as needed, APA102 supports up to 20MHz, 1MHz is a safe starting point

display:
  - platform: st7735
    spi_id: spi_lcd
    model: "INITR_MINI160X80"
    reset_pin: GPIO1
    cs_pin: GPIO4
    dc_pin: GPIO2
    rotation: 270
    device_width: 82
    device_height: 161
    col_start: 0
    row_start: 0
    eight_bit_color: true
    invert_colors: true
    use_bgr: true
    auto_clear_enabled: true
    id: my_display
    pages:
      - id: page1
        lambda: |-
          it.print(0, 10, id(font_roboto), "Connecting to");
          it.print(0, 30, id(font_roboto), "Home Assistant...");
      - id: page2
        lambda: |-
          it.print(0, 10, id(font_roboto), "Configuring");
          it.print(0, 30, id(font_roboto), "sensors...");
      - id: page3
        lambda: |-
          it.print(0, 10, id(font_roboto), "Loading");
          it.print(0, 30, id(font_roboto), "important");
          it.print(0, 50, id(font_roboto), "update...");
      - id: page4
        lambda: |-
          it.image(0, 0, id(my_image), COLOR_OFF, COLOR_ON);

image:
  - file: "test_tdongle_image.png"
    type: RGB
    id: my_image

http_request:

font:
  - file: "gfonts://Roboto"
    id: font_roboto
    size: 20

interval:
  - interval: 5s
    then:
      - display.page.show_next: my_display
      - component.update: my_display