Agreed @clydebarrow, the result wasn’t what I was expecting. Only noticed it as I’m (slowly!) updating all my yaml to the modern format and removing any legacy platforms.
Core elements of my YAML below. This code emulates a clock radio display with a 7-segment numeric emulation, flashing colon in the time (HH:MM) plus a seconds display, and brightness changes for overnight viewing.
esphome:
name: $devicename
friendly_name: $upper_devicename
min_version: 2025.5.0
name_add_mac_suffix: false
esp32:
board: esp32-c3-devkitm-1
framework:
type: esp-idf
# Enable logging
logger:
# Enable Home Assistant API
api:
# Allow Over-The-Air updates
ota:
- platform: esphome
substitutions:
devicename: esp32-c3mini-01
upper_devicename: ESP32-C3mini-01
pin_C3_sda: "20" #GPIO20 - I2C SDA
pin_C3_scl: "21" #GPIO21 - I2C SCL
pin_C3_led: "8" #GPIO8 - ESP C3 onboard LED
pin_lcd_reset: "1" #GPIO1 - LCD reset
pin_lcd_cs: "2" #GPIO2 - LCD CS
pin_lcd_dc: "0" #GPIO0 - LCD DC
pin_lcd_bklit: "3" #GPIO3 - LCD backlight
# FONTS for screen
font_3: "fonts/DigitalDisplay.ttf"
# ===== Networking =====
wifi:
networks:
- ssid: !secret wifi_ssid3
password: !secret wifi_password3
# priority: 3 #highest
i2c:
sda: GPIO${pin_C3_sda} # Non-default
scl: GPIO${pin_C3_scl} # Non-default
time:
- platform: homeassistant
id: homeassistant_time
on_time:
# dim display at 23:00 and full brightness at 06:00
- seconds: 0
minutes: 0
hours: 23
then:
- light.turn_on:
id: back_light
brightness: 50%
- seconds: 0
minutes: 0
hours: 6
then:
- light.turn_on:
id: back_light
brightness: 100%
light:
- platform: status_led
# Onboard status LED
name: $upper_devicename Status LED
id: esp32_c3mini_01_status_led
pin:
number: GPIO${pin_C3_led}
inverted: true
- platform: monochromatic
# Define a monochromatic, dimmable light for the backlight
output: backlight_pwm
name: $upper_devicename Display Backlight
id: back_light
restore_mode: ALWAYS_ON
output:
- platform: ledc
# Define a PWM output on the ESP32
pin: GPIO${pin_lcd_bklit}
id: backlight_pwm
font:
- file: $font_3
id: font_3r_s1
size: 40
- file: $font_3
id: font_3r_s2
size: 20
display:
- platform: ili9xxx
# - platform: mipi_spi # replaces ili9xxx, but causes C3 failure
model: ST7735
# 1.8" TFT display (red board) 128x160
dimensions:
height: 160
width: 128
invert_colors: false
show_test_card: false
reset_pin: GPIO${pin_lcd_reset}
cs_pin: GPIO${pin_lcd_cs}
dc_pin: GPIO${pin_lcd_dc}
rotation: 180°
update_interval: 500ms
lambda: |-
auto black = Color(0, 0, 0);
auto red = Color(255, 0, 0);
auto green = Color(0, 255, 0);
auto blue = Color(0, 0, 255);
auto yellow = Color(255, 255, 0);
auto amber = Color(255, 170, 0);
auto white = Color(255, 255, 255);
static bool show_text = true; // Static variable to toggle text visibility
static unsigned long last_toggle_time = 0;
unsigned long current_time = millis();
// Toggle text visibility every 500ms (adjust as needed)
if (current_time - last_toggle_time >= 500) {
show_text = !show_text;
last_toggle_time = current_time;
}
// ===== Display time with seconds and flashing colon separator
if (show_text) {
it.strftime(3, 5, id(font_3r_s1), amber, "%H:%M", id(homeassistant_time).now());
} else {
it.strftime(3, 5, id(font_3r_s1), amber, "%H %M", id(homeassistant_time).now());
}
it.strftime(100, 5, id(font_3r_s2), amber, "%S", id(homeassistant_time).now());
it.strftime(it.get_width(), 35, id(font_2r_s1), amber, TextAlign::RIGHT, "%a %d %b %Y", id(homeassistant_time).now());
It has now been running reliably for around 10 days.
Prior to this run I was using - platform: mipi_spi which caused problems with C3 overheating and failing, so I’ve reverted for reliability. In the HA core logs I didn’t see anything prior to the C3 failure, same in the ESPHome logs. I’ll check further next week when I get a chance to make some updates.