Last active
October 12, 2024 20:34
-
-
Save ChristophCaina/6c604e71f8e6910c2a87994c41a93b7b to your computer and use it in GitHub Desktop.
Code for the ESP32-S3-Box3
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
#------------------------------------------------------------------------------------# | |
# PIN Schematics # | |
# # | |
# GPIO-00 MCU-BOOT # | |
# GPIO-01 Speaker Mute-Status # | |
# GPIO-02 I2S MCLK # | |
# GPIO-03 Touch-Screen TT21100 Interrupt Pin # | |
# GPIO-04 ILI92xxx Display DC-Pin (SPI: CLK-Pin) # | |
# GPIO-05 ILI92xxx Display CS-Pin (SPI: MOSI-Pin) # | |
# GPIO-06 ILI92xxx Display SDA # | |
# GPIO-07 ILI92xxx Display SCK # | |
# GPIO-17 I2S_SCLK # | |
# GPIO-40 I2C_SCL (Temp & Hum) -- SENSOR v1.1 [AHT30] # | |
# GPIO-41 I2C_SDA (Temp & Hum) -- SENSOR v1.1 [AHT30] # | |
# GPIO-45 I2S_LRCK | |
# GPIO-46 PA_CTRL | |
# GPIO-47 LCD Backlight (CTRL) | |
# GPIO-48 LCD Reset-Pin | |
substitutions: | |
device_name: "esp32-s3-box-3" | |
friendly_name: ESP32 S3 Box 3 | |
description: ESP32 S3 Box3 | |
comment: "ESP32 S3 Box3" | |
wifi_ssid: !secret wifi_ssid | |
wifi_password: !secret wifi_password | |
wifi_hotspot_ssid: "ESP32-S3-Box-3" | |
wifi_hotspot_password: !secret wifi_password | |
wifi_update_interval: 3s | |
esphome: | |
name: ${device_name} | |
friendly_name: ${friendly_name} | |
comment: ${comment} | |
platformio_options: | |
board_build.flash_mode: dio | |
project: | |
name: esphome.s3-box3 | |
version: "0.1" | |
min_version: 2023.10.0 | |
esp32: | |
board: esp32s3box | |
framework: | |
type: esp-idf | |
# version: latest | |
sdkconfig_options: | |
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y" | |
CONFIG_ESP32S3_DATA_CACHE_64KB: "y" | |
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y" | |
external_components: | |
# - source: github://pr#4793 | |
# components: [ tt21100 ] | |
- source: github://pr#4861 | |
components: [ es8311 ] | |
- source: github://rpatel3001/esphome@es7210 | |
components: [ es7210 ] | |
psram: | |
mode: octal | |
speed: 80MHz | |
ota: | |
password: | |
api: | |
encryption: | |
key: | |
# Wifi-Settings | |
wifi: | |
ssid: ${wifi_ssid} | |
password: ${wifi_password} | |
fast_connect: true | |
ap: | |
ssid: $(wifi_hotspot_ssid) | |
password: $(wifi_hotspot_password) | |
bluetooth_proxy: | |
active: true | |
logger: | |
# CDC logging is currently not working on the S3 | |
# See https://github.com/espressif/esp-idf/commit/9924d9f27192a5fab5f66230c72249ecc6cad34c | |
#hardware_uart: USB_CDC | |
level: VERBOSE | |
logs: | |
esp32_ble: WARN | |
esp32_ble_tracker: WARN | |
ble_dist: WARN | |
sensor: WARN | |
ledc.output: WARN | |
component: WARN | |
ili9xxx: WARN | |
tt21100: WARN | |
touchscreen: WARN | |
wifi: WARN | |
es8311: WARN | |
i2s_audio: VERBOSE | |
voice_assistant: VERBOSE | |
es7210: WARN | |
sensor: | |
- platform: wifi_signal | |
name: "WiFi Signal dB" | |
id: wifi_signal_db | |
update_interval: 60s | |
entity_category: "diagnostic" | |
- platform: internal_temperature | |
name: "Internal Temperature" | |
entity_category: "diagnostic" | |
# Needs support for AHT-30 sensors | |
- platform: aht10 | |
temperature: | |
name: "Test-Temp" | |
humidity: | |
name: "Test-Hum" | |
- platform: uptime | |
name: Uptime | |
id: uptime_sensor | |
entity_category: "diagnostic" | |
update_interval: $wifi_update_interval | |
on_raw_value: | |
then: | |
- text_sensor.template.publish: | |
id: uptime_human | |
state: !lambda |- | |
int seconds = round(id(uptime_sensor).raw_state); | |
int days = seconds / (24 * 3600); | |
seconds = seconds % (24 * 3600); | |
int hours = seconds / 3600; | |
seconds = seconds % 3600; | |
int minutes = seconds / 60; | |
seconds = seconds % 60; | |
return ( | |
(days ? to_string(days) + "d " : "") + | |
(hours ? to_string(hours) + "h " : "") + | |
(minutes ? to_string(minutes) + "m " : "") + | |
(to_string(seconds) + "s") | |
).c_str(); | |
text_sensor: | |
- platform: wifi_info | |
ip_address: | |
update_interval: 60s | |
name: IP Address | |
entity_category: "diagnostic" | |
ssid: | |
update_interval: 60s | |
name: Connected SSID | |
entity_category: "diagnostic" | |
bssid: | |
update_interval: 60s | |
name: Connected BSSID | |
entity_category: "diagnostic" | |
mac_address: | |
name: Mac Wifi Address | |
entity_category: "diagnostic" | |
scan_results: | |
update_interval: 60s | |
name: Latest Scan Results | |
entity_category: "diagnostic" | |
# Device Uptime Information | |
- platform: template | |
name: Uptime Human Readable | |
id: uptime_human | |
icon: mdi:clock-start | |
binary_sensor: | |
- platform: gpio | |
name: Mute-Button | |
pin: | |
number: GPIO1 | |
inverted: true | |
- platform: homeassistant | |
id: ladepunkt_aktiv | |
entity_id: binary_sensor.openwb_cp1_ladepunkt_aktiv | |
internal: True | |
- platform: homeassistant | |
id: ladestatus_auto | |
entity_id: binary_sensor.openwb_cp1_autoladestatus | |
internal: True | |
#remote_receiver: | |
# pin: | |
# number: GPIO38 | |
# dump: all | |
#remote_transmitter: | |
# pin: | |
# number: GPIO39 | |
# carrier_duty_percent: 100% | |
# Enable Buttons in HA UI | |
button: | |
- platform: restart | |
name: "Restart Device" | |
entity_category: "diagnostic" | |
- platform: shutdown | |
name: "Shutdown Device" | |
entity_category: "diagnostic" | |
time: | |
- platform: homeassistant | |
id: time_ha | |
timezone: Europe/Berlin | |
output: | |
- platform: ledc | |
pin: GPIO47 | |
id: lcd_backlight_pin | |
light: | |
- platform: monochromatic | |
output: lcd_backlight_pin | |
id: lcd_backlight | |
name: "LCD Backlight" | |
restore_mode: ALWAYS_ON | |
spi: | |
clk_pin: GPIO7 | |
mosi_pin: GPIO6 | |
i2c: | |
sda: GPIO41 | |
scl: GPIO40 | |
scan: true | |
# does not work on the ESP32-S3-Box3 | |
display: | |
- platform: ili9xxx | |
model: s3box | |
cs_pin: GPIO5 | |
dc_pin: GPIO4 | |
id: lcd | |
auto_clear_enabled: false | |
# Width = 320, Height = 240 | |
lambda: |- | |
auto bg = Color(250, 250, 250); | |
auto text = Color(250, 250, 250); | |
auto border_color = Color(60, 60, 60); | |
auto button_bg_on = Color(36, 180, 245); | |
auto button_bg_off = Color(158, 158, 158); | |
auto red = Color(255, 0, 0); | |
auto green = Color(0, 255, 0); | |
auto blue = Color(0, 0, 255); | |
it.image(0,0, id(background_image), ImageAlign::TOP_LEFT); | |
it.strftime(160, 65, id(font_large), text, TextAlign::CENTER, "%H:%M:%S", id(time_ha).now()); | |
it.strftime(160, 115, id(font_medium), text, TextAlign::CENTER, "%d.%m.%Y", id(time_ha).now()); | |
int circleY = 187; | |
int circleX1 = 53, circleX2 = 267; | |
int circleRadius = 40; | |
it.filled_circle(circleX1, circleY, circleRadius+2, text); | |
it.filled_circle(circleX2, circleY, circleRadius+2, text); | |
if (id(ladepunkt_aktiv).state){ | |
it.filled_circle(circleX1, circleY, circleRadius, button_bg_on); | |
it.image(circleX1, circleY, id(station_status_icon), ImageAlign::CENTER); | |
} | |
else{ | |
it.filled_circle(circleX1, circleY, circleRadius, button_bg_off); | |
it.image(circleX1, circleY, id(station_status_icon), ImageAlign::CENTER); | |
} | |
if (id(ladestatus_auto).state){ | |
it.filled_circle(circleX2, circleY, circleRadius, button_bg_on); | |
it.image(circleX2, circleY, id(charger_status_icon), ImageAlign::CENTER); | |
} | |
else{ | |
it.filled_circle(circleX2, circleY, circleRadius, button_bg_off); | |
it.image(circleX2, circleY, id(charger_status_icon), ImageAlign::CENTER); | |
} | |
font: | |
- file: "gfonts://Roboto@500" | |
id: font_large | |
size: 70 | |
glyphs: "0123456789:APM." | |
- file: "gfonts://Roboto@500" | |
id: font_medium | |
size: 30 | |
- file: "gfonts://Roboto@500" | |
id: font_small | |
size: 15 | |
image: | |
- file: mdi:volume-off | |
id: mute_icon | |
resize: 40x40 | |
- file: mdi:microphone-off | |
id: mic_mute_icon | |
resize: 40x40 | |
- file: mdi:account-voice | |
id: voice_icon | |
resize: 40x40 | |
- file: mdi:ev-plug-type2 | |
id: charger_status_icon | |
resize: 40x40 | |
- file: mdi:ev-station | |
id: station_status_icon | |
resize: 40x40 | |
- file: "images/background_spots_lines_85563_320x240.jpg" | |
id: background_image | |
resize: 320x240 | |
type: rgba | |
#touchscreen: | |
# - platform: tt21100 | |
# address: 0x24 | |
# interrupt_pin: GPIO3 # strapping CTP_INT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment