initial commit

This commit is contained in:
iggy 2025-03-28 17:31:38 +08:00
commit 714aac9179
2 changed files with 134 additions and 0 deletions

134
esphome/cyb1.yaml Normal file
View File

@ -0,0 +1,134 @@
esphome:
name: cyb1
friendly_name: cyb1
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "W9XTb4Pds0pmbvnyDRSCOZrH7+r+9rOjg0hZmRK/uwo="
ota:
- platform: esphome
password: "e6ca3cee32249ed15ee0bc06bce56375"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
#ap:
# ssid: "Cyb1 Fallback Hotspot"
# password: "l0Vs6bxErB2F"
#captive_portal:
# ============================================================
# ESPHome Display related setup
#
# Create a font to use, add and remove glyphs as needed.
font:
- file: 'fonts/Arimo-Regular.ttf'
id: arimo20
size: 20
glyphs: "!\"%()+=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ abcdefghijklmnopqrstuvwxyzåäö"
# Create a Home Assistant blue color
color:
- id: ha_blue
hex: 51c0f2
# ============================================================
# Home Assistant related setup
#
light:
- platform: monochromatic
output: backlight_pwm
name: Display Backlight
id: backlight
restore_mode: ALWAYS_ON
#on_state:
# - lvgl.slider.update:
# id: backlight_slider
# value: !lambda return x;
# ============================================================
# Hardware related setup
#
# Setup SPI for the display. The ESP32-2432S028R uses separate SPI buses for display and touch
spi:
- id: tft
clk_pin: GPIO14
mosi_pin: GPIO13
miso_pin: GPIO12
- id: touch
clk_pin: GPIO25
mosi_pin: GPIO32
miso_pin: GPIO39
# Setup a pin to control the backlight
output:
- platform: ledc
pin: GPIO21
id: backlight_pwm
# Setup the ili9xxx platform
#
# Display is used as 240x320 by default so we rotate it to 90°
display:
- platform: ili9xxx
id: esp_display
model: ili9342
spi_id: tft
cs_pin: GPIO15
dc_pin: GPIO2
#invert_display: true (changed to below with ESPhome 2023.12.0)
invert_colors: true
# Set up the xpt2046 touch platform
touchscreen:
platform: xpt2046
spi_id: touch
cs_pin: GPIO33
interrupt_pin: GPIO36
update_interval: 50ms
threshold: 400
calibration:
x_max: 3860
x_min: 280
y_min: 340
y_max: 3860
transform:
swap_xy: true
mirror_x: true
mirror_y: true
lvgl:
buffer_size: 25%
pages:
- id: main_page
widgets:
- slider:
id: backlight_slider
x: 20
y: 50
width: 30
height: 100
pad_all: 8
min_value: 0
max_value: 255
on_release:
then:
- light.turn_on:
id: backlight
brightness: !lambda |-
return int(x) / 255.0;

Binary file not shown.