I am using an esp32 with a waveshare 7.5 inch epaper.
I am trying to display date, and weather info. I am getting an issue with timeouts and disconnection.
Any help is much appreciated. Here is the error logs:
[22:22:30][I][app:100]: ESPHome version 2025.2.0 compiled on Feb 22 2025, 22:19:33
[22:22:34][I][display:267]: Updating ePaper Calendar...
[22:22:34][I][display:271]: Received Day Name: Saturday
[22:22:34][I][display:272]: Received Day Number: 22
[22:22:34][I][display:273]: Received Month: February
[22:22:34][I][display:286]: Formatted Date: Saturday 22 February
[22:22:34][I][display:314]: Mapped Weather Icon:
[22:22:34][I][waveshare_epaper:3563]: Power on the display and hat
[22:22:45][E][waveshare_epaper:3508]: Timeout while displaying image!
[22:22:56][E][waveshare_epaper:3508]: Timeout while displaying image!
[22:22:56][W][component:237]: Component esphome.coroutine took a long time for an operation (21455 ms).
[22:22:56][W][component:238]: Components should block for at most 30 ms.
[22:23:10][I][safe_mode:041]: Boot seems successful; resetting boot loop counter
This is my yaml file:
esphome:
name: mehdicalendar
min_version: 2025.2.0
build_path: build/mehdicalendar
# on_boot must be under 'esphome:', not 'esp32:'
on_boot:
then:
- wait_until:
condition:
lambda: "return !id(current_day_number).state.empty() && !id(current_month).state.empty();"
- script.execute: update_screen
esp32:
board: esp32dev
framework:
type: arduino
wifi:
ssid: "xx"
password: "xxxx"
ap:
ssid: "xxx"
password: "xxx"
logger:
level: INFO
api:
encryption:
key: "xxxxx"
services:
- service: refresh_display
then:
- component.update: eink_display
ota:
platform: esphome
script:
- id: update_screen
then:
- component.update: eink_display
time:
- platform: sntp
id: sntp_time
on_time:
- seconds: 0
minutes: 0
hours: 1
then:
- script.execute: update_screen
- seconds: 0
minutes: 0
hours: 8
days_of_week: SAT-SUN
then:
- script.execute: update_screen
- seconds: 0
minutes: 0
hours: 16
then:
- script.execute: update_screen
# --- UPDATED SPI PINS ---
spi:
clk_pin: 18
mosi_pin: 23
# MISO is typically not needed for e-paper
font:
- file: "fonts/GothamRnd-Book.ttf"
id: book20
size: 20
glyphs: &font-glyphs
['!', '"', '%', '(', ')', '+', '=', ',', '-', '_', '.', ':', '°', ' ',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'é', 'à', 'è', 'ç', 'ù', 'É', 'À', 'È', 'Ç', 'Ù']
- file: "fonts/GothamRnd-Book.ttf"
id: book25
size: 25
- file: "fonts/GothamRnd-Bold.ttf"
id: bold20
size: 20
- file: "fonts/GothamRnd-Bold.ttf"
id: bold25
size: 25
- file: "fonts/GothamRnd-Bold.ttf"
id: bold30
size: 30
- file: "fonts/GothamRnd-Bold.ttf"
id: bold35
size: 35
- file: "fonts/GothamRnd-Bold.ttf"
id: bold40
size: 40
- file: "fonts/GothamRnd-Bold.ttf"
id: bold55
size: 55
glyphs: ['.', '°', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'C', '-']
- file: "fonts/materialdesignicons-webfont.ttf"
id: mdi120
size: 120
glyphs: &mdi-weather-glyphs
- "\U000F0590" # mdi-weather-cloudy
- "\U000F0F2F" # mdi-weather-cloudy-alert
- "\U000F0E6E" # mdi-weather-cloudy-arrow-right
- "\U000F0591" # mdi-weather-fog
- "\U000F0592" # mdi-weather-hail
- "\U000F0F30" # mdi-weather-hazy
- "\U000F0898" # mdi-weather-hurricane
- "\U000F0593" # mdi-weather-lightning
- "\U000F067E" # mdi-weather-lightning-rainy
- "\U000F0594" # mdi-weather-night
- "\U000F0F31" # mdi-weather-night-partly-cloudy
- "\U000F0595" # mdi-weather-partly-cloudy
- "\U000F0F32" # mdi-weather-partly-lightning
- "\U000F0F33" # mdi-weather-partly-rainy
- "\U000F0F34" # mdi-weather-partly-snowy
- "\U000F0F35" # mdi-weather-partly-snowy-rainy
- "\U000F0596" # mdi-weather-pouring
- "\U000F0597" # mdi-weather-rainy
- "\U000F0598" # mdi-weather-snowy
- "\U000F0F36" # mdi-weather-snowy-heavy
- "\U000F067F" # mdi-weather-snowy-rainy
- "\U000F0599" # mdi-weather-sunny
- "\U000F0F37" # mdi-weather-sunny-alert
- "\U000F14E4" # mdi-weather-sunny-off
- "\U000F059A" # mdi-weather-sunset
- "\U000F059B" # mdi-weather-sunset-down
- "\U000F059C" # mdi-weather-sunset-up
- "\U000F0F38" # mdi-weather-tornado
- "\U000F059D" # mdi-weather-windy
- "\U000F059E" # mdi-weather-windy-variant
- "\U000F00E9" # mdi-cake
- "\U000F0A70" # mdi-silverware-fork-knife
- "\U000F1A74" # mdi-solar-power-variant-outline
- "\U000F1904" # mdi-home-lightning-bolt-outline
- "\U000F05C3" # mdi-youtube
- "\U000F05D6" # mdi-alert-circle-outline
- file: "fonts/materialdesignicons-webfont.ttf"
id: mdi36
size: 36
text_sensor:
- platform: homeassistant
entity_id: sensor.current_day_name
id: current_day_name
- platform: homeassistant
entity_id: sensor.current_day_number
id: current_day_number
- platform: homeassistant
entity_id: sensor.current_month
id: current_month
- platform: homeassistant
entity_id: sensor.weather_condition
id: weather_condition
- platform: homeassistant
entity_id: sensor.weather_temperature
id: weather_temperature
- platform: homeassistant
entity_id: sensor.weather_icon
id: weather_icon
- platform: homeassistant
entity_id: sensor.weather_icon_0
id: weather_icon_0
- platform: homeassistant
entity_id: sensor.weather_icon1
id: weather_icon_1
- platform: homeassistant
entity_id: sensor.weather_icon_2
id: weather_icon_2
- platform: homeassistant
entity_id: sensor.weather_icon_3
id: weather_icon_3
- platform: homeassistant
entity_id: sensor.weather_icon_4
id: weather_icon_4
- platform: homeassistant
entity_id: sensor.home_condition_day_0d
id: home_condition_day_0d
- platform: homeassistant
entity_id: sensor.home_condition_day_1d
id: home_condition_day_1d
- platform: homeassistant
entity_id: sensor.home_condition_day_2d
id: home_condition_day_2d
- platform: homeassistant
entity_id: sensor.home_condition_day_3d
id: home_condition_day_3d
- platform: homeassistant
entity_id: sensor.home_condition_day_4d
id: home_condition_day_4d
- platform: homeassistant
entity_id: sensor.home_realfeel_temperature_max_0d
id: home_realfeel_temperature_max_0d
- platform: homeassistant
entity_id: sensor.home_realfeel_temperature_max_1d
id: home_realfeel_temperature_max_1d
- platform: homeassistant
entity_id: sensor.home_realfeel_temperature_max_2d
id: home_realfeel_temperature_max_2d
- platform: homeassistant
entity_id: sensor.home_realfeel_temperature_max_3d
id: home_realfeel_temperature_max_3d
- platform: homeassistant
entity_id: sensor.home_realfeel_temperature_max_4d
id: home_realfeel_temperature_max_4d
- platform: homeassistant
entity_id: sensor.home_realfeel_temperature_min_0d
id: home_realfeel_temperature_min_0d
- platform: homeassistant
entity_id: sensor.home_realfeel_temperature_min_1d
id: home_realfeel_temperature_min_1d
- platform: homeassistant
entity_id: sensor.home_realfeel_temperature_min_2d
id: home_realfeel_temperature_min_2d
- platform: homeassistant
entity_id: sensor.home_realfeel_temperature_min_3d
id: home_realfeel_temperature_min_3d
- platform: homeassistant
entity_id: sensor.home_realfeel_temperature_min_4d
id: home_realfeel_temperature_min_4d
- platform: homeassistant
entity_id: sensor.esp_calendar_data
attribute: event_title_1
id: event_title_1
- platform: homeassistant
entity_id: sensor.esp_calendar_data
attribute: event_start_1
id: event_start_1
- platform: homeassistant
entity_id: sensor.esp_calendar_data
attribute: event_title_2
id: event_title_2
- platform: homeassistant
entity_id: sensor.esp_calendar_data
attribute: event_start_2
id: event_start_2
# --- UPDATED DISPLAY PINS ---
display:
- platform: waveshare_epaper
reset_duration: 10ms
id: eink_display
cs_pin: 5 # was 15
dc_pin: 17 # was 27
busy_pin: 4 # was 25
reset_pin: 16 # was 26
model: 7.50inv2
rotation: 270°
update_interval: never
lambda: |-
ESP_LOGI("display", "Updating ePaper Calendar...");
it.fill(Color(0, 0, 0));
// Debugging: Log the received date values
ESP_LOGI("display", "Received Day Name: %s", id(current_day_name).state.c_str());
ESP_LOGI("display", "Received Day Number: %s", id(current_day_number).state.c_str());
ESP_LOGI("display", "Received Month: %s", id(current_month).state.c_str());
// Step 1: Display Today's Date (Centered at the Top)
if (id(current_day_name).has_state() &&
id(current_day_number).has_state() &&
id(current_month).has_state() &&
!id(current_day_name).state.empty() &&
!id(current_day_number).state.empty() &&
!id(current_month).state.empty()) {
std::string formatted_date = id(current_day_name).state + " " +
id(current_day_number).state + " " +
id(current_month).state;
ESP_LOGI("display", "Formatted Date: %s", formatted_date.c_str());
it.printf(240, 40, id(bold30), TextAlign::CENTER, "%s", formatted_date.c_str());
} else {
ESP_LOGE("display", "Date sensors missing!");
it.printf(240, 40, id(bold30), TextAlign::CENTER, "No Date Available");
}
// Step 2: Draw a Horizontal Line
it.filled_rectangle(50, 90, 380, 2);
// Step 3: Display Weather Section (Icon + Condition + Temperature)
std::map<std::string, std::string> weather_icon_map = {
{"mdi-weather-night", "\U000F0594"}, {"mdi-weather-cloudy", "\U000F0590"},
{"mdi-weather-fog", "\U000F0591"}, {"mdi-weather-hail", "\U000F0592"},
{"mdi-weather-lightning", "\U000F0593"}, {"mdi-weather-lightning-rainy", "\U000F067E"},
{"mdi-weather-partly-cloudy", "\U000F0595"}, {"mdi-weather-pouring", "\U000F0596"},
{"mdi-weather-rainy", "\U000F0597"}, {"mdi-weather-snowy", "\U000F0598"},
{"mdi-weather-snowy-rainy", "\U000F067F"}, {"mdi-weather-sunny", "\U000F0599"},
{"mdi-weather-windy", "\U000F059D"}, {"mdi-help-circle", "\U000F059D"}
};
// Get weather icon from the map
std::string weather_condition_str = id(weather_icon).has_state() ? id(weather_icon).state : "mdi-help-circle";
std::string weather_icon = weather_icon_map.count(weather_condition_str)
? weather_icon_map[weather_condition_str]
: "\U000F059D"; // fallback
ESP_LOGI("display", "Mapped Weather Icon: %s", weather_icon.c_str());
it.printf(100, 140, id(mdi120), TextAlign::LEFT, "%s", weather_icon.c_str()); // Icon
it.printf(230, 150, id(bold35), TextAlign::LEFT, "%s", id(weather_condition).state.c_str()); // Condition
it.printf(230, 190, id(bold55), TextAlign::LEFT, "%s°C", id(weather_temperature).state.c_str()); // Temp
// Step 4: Draw Another Horizontal Line
it.filled_rectangle(50, 250, 380, 2);
int y_pos = 270;
// Forecast for Day 0
{
std::string icon_0 = weather_icon_map[id(weather_icon_0).state];
// Optional: Show the "Day Name" if you have it. Some folks reuse home_condition_day_0d for something else.
// it.printf(90, y_pos, id(bold25), TextAlign::LEFT, "%s", id(home_condition_day_0d).state.c_str());
it.printf(50, y_pos, id(mdi36), TextAlign::LEFT, "%s", icon_0.c_str());
it.printf(320, y_pos, id(bold20), TextAlign::RIGHT, "%s°C / %s°C",
id(home_realfeel_temperature_max_0d).state.c_str(),
id(home_realfeel_temperature_min_0d).state.c_str());
y_pos += 40;
}