matze, trying your code and getting errors:
[image]
Just remove the fonts or download it from font.google.com :
I now also have the touchscreen working!
This is the code without the font:
esphome:
name: esp32-s3-touch-lcd-185
friendly_name: esp32-s3-touch-lcd-1.85
# Enable logging
logger:
# Enable Home Assistant API
api:
on_client_connected:
then:
- delay: 1s
- voice_assistant.start_continuous:
- delay: 1s
- voice_assistant.stop:
- delay: 2s
- voice_assistant.start_continuous:
encryption:
key: !secret encryption_key
services:
- service: set_display_text
variables:
new_text: string # "text" wird zu "new_text" geändert
then:
- text_sensor.template.publish:
id: display_text
state: !lambda 'return new_text;'
external_components:
- source: github://pr#5230
components: esp_adf
refresh: 0s
- source:
type: git
url: https://github.com/esphome/voice-kit
ref: dev
components:
- media_player
- nabu
- voice_assistant
media_player:
- platform: nabu
id: nabu_media_player
name: Media Player
internal: false
speaker: i2s_speaker
sample_rate: 48000
volume_increment: 0.05
volume_min: 0.1
volume_max: 1
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp32-S3-Touch-Lcd-185"
password: "DZGnV9UlnSE4"
captive_portal:
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
sdkconfig_options:
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: 120MHz
web_server:
port: 80
version: 2
include_internal: true
i2s_audio:
- id: i2s_in
i2s_lrclk_pin: GPIO2
i2s_bclk_pin: GPIO15
- id: i2s_out
i2s_lrclk_pin: GPIO38
i2s_bclk_pin: GPIO48
speaker:
- platform: i2s_audio
id: i2s_speaker
i2s_audio_id: i2s_out
i2s_dout_pin: GPIO47
dac_type: external
channel: stereo
# Media Player does not work for esp-idf
# media_player:
# - platform: i2s_audio
# name: ESPHome I2S Media Player
# dac_type: external
# i2s_dout_pin: GPIO47
# i2s_audio_id: i2s_out
# mode: stereo
microphone:
- platform: i2s_audio
id: i2s_microphone
i2s_audio_id: i2s_in
i2s_din_pin: GPIO39
adc_type: external
pdm: false
channel: right
sample_rate: 16000
bits_per_sample: 16bit
voice_assistant:
id: va
microphone: i2s_microphone
speaker: i2s_speaker
use_wake_word: true
on_wake_word_detected:
then:
- light.turn_on:
id: display_backlight
brightness: 100%
- lvgl.resume:
- text_sensor.template.publish:
id: display_text
state: "I'm listening"
- lvgl.widget.redraw:
on_tts_end:
then:
- light.turn_on:
id: display_backlight
brightness: 30%
- text_sensor.template.publish:
id: display_text
state: "Say OK Nabu..."
on_client_connected:
- text_sensor.template.publish:
id: display_text
state: "Say OK Nabu..."
binary_sensor:
- platform: gpio
pin: GPIO6
name: "Power Button"
on_press:
- voice_assistant.start:
silence_detection: false
- platform: gpio
pin: GPIO0
name: "Boot Button"
- platform: cst816
name: "Touch"
i2c:
- id: i2c_main
sda: GPIO11 # Haupt-I2C (für Display, Sensoren, etc.)
scl: GPIO10
scan: true
- id: i2c_touch
sda: GPIO1
scl: GPIO3
frequency: 400kHz
scan: false # Prüft, ob das Touchpanel gefunden wird
pca9554:
- id: 'pca9554a_device'
i2c_id: i2c_main
output:
- platform: ledc
pin: GPIO5
id: backlight
light:
- platform: monochromatic
output: backlight
id: display_backlight
name: "backlight Light"
restore_mode: ALWAYS_ON
spi:
id: display_qspi
type: quad
clk_pin: GPIO40
data_pins: [GPIO46, GPIO45, GPIO42, GPIO41]
display:
- platform: qspi_dbi
model: CUSTOM
#lambda: |-
# auto touch = id(my_touchscreen)->get_touch();
# if (touch) // or touch.has_value()
# it.filled_circle(touch.value().x, touch.value().y, 10, RED);
# data_rate: 40MHz
id: main_display
spi_id: display_qspi
color_order: rgb
dimensions:
height: 360
width: 360
cs_pin: GPIO21
reset_pin:
pca9554: pca9554a_device
number: 1
auto_clear_enabled: false #set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xD7, 0x88 ]
- [ 0xD8, 0x99 ]
- [ 0xD9, 0x33 ]
- [ 0xF3, 0x01 ]
- [ 0xF0, 0x00 ]
- [ 0xF0, 0x01 ]
- [ 0xF1, 0x01 ]
- [ 0xA0, 0x0B ]
- [ 0xA3, 0x2A ]
- [ 0xA5, 0xC3 ]
- delay 1ms
- [ 0xA3, 0x2B ]
- [ 0xA5, 0xC3 ]
- delay 1ms
- [ 0xA3, 0x2C ]
- [ 0xA5, 0xC3 ]
- delay 1ms
- [ 0xA3, 0x2D ]
- [ 0xA5, 0xC3 ]
- delay 1ms
- [ 0xA3, 0x2E ]
- [ 0xA5, 0xC3 ]
- delay 1ms
- [ 0xA3, 0x2F ]
- [ 0xA5, 0xC3 ]
- delay 1ms
- [ 0xA3, 0x30 ]
- [ 0xA5, 0xC3 ]
- delay 1ms
- [ 0xA3, 0x31 ]
- [ 0xA5, 0xC3 ]
- delay 1ms
- [ 0xA3, 0x32 ]
- [ 0xA5, 0xC3 ]
- delay 1ms
- [ 0xA3, 0x33 ]
- [ 0xA5, 0xC3 ]
- delay 1ms
- [ 0xA0, 0x09 ]
- [ 0xF1, 0x10 ]
- [ 0xF0, 0x00 ]
- [ 0x2A, 0x00, 0x00, 0x01, 0x67 ]
- [ 0x2B, 0x01, 0x68, 0x01, 0x68 ]
- [ 0x4D, 0x00 ]
- [ 0x4E, 0x00 ]
- [ 0x4F, 0x00 ]
- [ 0x4C, 0x01 ]
- delay 10ms
- [ 0x4C, 0x00 ]
- [ 0x2A, 0x00, 0x00, 0x01, 0x67 ]
- [ 0x2B, 0x00, 0x00, 0x01, 0x67 ]
- [ 0x3A, 0x55 ]
- [ 0x21, 0x00 ]
- [ 0x11, 0x00 ]
- delay 120ms
- [ 0x29, 0x00 ]
font:
- file: "fonts/Montserrat-Medium.ttf" # Alternative große Schriftart (48px)
id: montserrat_48
size: 48
touchscreen:
platform: cst816
update_interval: 50ms
skip_probe: true
id: my_touchscreen
i2c_id: i2c_touch
address: 0x15 # Fixe I2C-Adresse aus dem Beispielcode
interrupt_pin: GPIO4
calibration:
x_min: 7
x_max: 360
y_min: 9
y_max: 350
on_touch:
then:
- light.turn_on: display_backlight
- lvgl.resume:
- lvgl.widget.redraw:
lvgl:
displays:
- main_display
touchscreens:
- touchscreen_id: my_touchscreen
on_idle:
timeout: 20s
then:
- logger.log: "LVGL is idle"
- lvgl.pause:
- light.turn_off:
id: display_backlight
transition_length: 5s
widgets:
- label:
id: display_label
align: CENTER
text: "Getting ready..."
text_font: montserrat_48 # Hier die Schriftgröße erhöhen!
long_mode: WRAP # Falls der Text länger ist, umbricht er automatisch
width: 300 # Falls nötig, die Breite des Labels anpassen
#text_sensor:
# - platform: template
# name: "Display Text"
# id: display_text
# update_interval: never
# on_value:
# then:
# - lambda: |-
# if (id(display_label)) {
# lv_label_set_text(id(display_label), x.c_str());
# lv_refr_now(NULL);
# }
text_sensor:
- platform: template
name: "Display Text"
id: display_text
update_interval: never
on_value:
then:
- lambda: |-
if (id(display_label)) {
lv_label_set_text(id(display_label), id(display_text).state.c_str());
lv_refr_now(NULL); // Erzwingt ein sofortiges Redraw
}
Here you can always find the latest version of my code: