Skip to content

Instantly share code, notes, and snippets.

@gickowtf
Created August 24, 2025 19:34
Show Gist options
  • Select an option

  • Save gickowtf/6b59adf8231e437e49d5e7eb3782e2f5 to your computer and use it in GitHub Desktop.

Select an option

Save gickowtf/6b59adf8231e437e49d5e7eb3782e2f5 to your computer and use it in GitHub Desktop.
E-Paper Projekt
esphome:
name: epaperc3
on_boot:
priority: -10
then:
- delay: 30s # genug Zeit für WLAN + API + States
- component.update: epaper_display
- delay: 30s # Zeit für Display-Refresh
- deep_sleep.enter: sleep_mode
esp32:
board: esp32-s3-devkitc-1
framework:
type: arduino
logger:
api:
ota:
platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
external_components:
source: github://pr#6226
components: [waveshare_epaper]
i2c:
sda: GPIO1
scl: GPIO2
scan: true
id: bus_i2c
color:
- id: red
hex: "FF0000"
- id: black
hex: "FFFFFF"
- id: white
hex: "000000"
spi:
clk_pin: GPIO4
mosi_pin: GPIO6
display:
- platform: waveshare_epaper
id: epaper_display
model: 2.90in3c
cs_pin: GPIO7
dc_pin: GPIO8
busy_pin: GPIO3
reset_pin: GPIO10
rotation: 90
reset_duration: 30ms
update_interval: never # wir steuern Updates manuell
lambda: |-
// Nur rendern, wenn die wichtigsten Daten da sind
if (!(id(date1).has_state() && id(time1).has_state())) return;
it.fill(id(white));
// --- Wochenkästchen (Mo–So) ---
const int start_x = 1;
const int start_y = 1;
const int box_w = 26;
const int box_h = 26;
const int spacing = 1;
time_t now = id(homeassistant_time).now().timestamp;
struct tm timeinfo;
localtime_r(&now, &timeinfo);
int today_weekday = (timeinfo.tm_wday + 6) % 7; // Mo=0 … So=6
timeinfo.tm_mday -= today_weekday; // auf Montag der Woche
mktime(&timeinfo);
for (int i = 0; i < 7; i++) {
int x = start_x + i * (box_w + spacing);
int y = start_y;
struct tm dayinfo = timeinfo;
dayinfo.tm_mday += i;
mktime(&dayinfo);
char daystr[3];
strftime(daystr, sizeof(daystr), "%d", &dayinfo);
auto color = (i >= 5) ? id(red) : id(black);
// Markierung für "heute" (Balken oben)
if (i == today_weekday) {
it.filled_rectangle(x, y, box_w, 6, id(red));
}
it.rectangle(x, y, box_w, box_h, id(black));
it.print(x + 3, y + 7, id(size14_bold), color, daystr);
}
// --- Wetter (nur zeichnen, wenn vorhanden) ---
if (id(weather_temp_today).has_state() && id(weather_temp_low_today).has_state()) {
if (id(weather_condition_today).has_state()) {
std::string condition = id(weather_condition_today).state;
std::string icon = "\U000F0599"; // sunny
if (condition == "cloudy") icon = "\U000F0590";
else if (condition == "partlycloudy") icon = "\U000F0595";
else if (condition == "rainy") icon = "\U000F0597";
else if (condition == "snowy") icon = "\U000F0598";
else if (condition == "windy") icon = "\U000F059D";
else if (condition == "fog") icon = "\U000F0591";
it.printf(200, 1, id(icon_font40), id(black), "%s", icon.c_str());
}
it.printf(295, 7, id(size12_bold), id(black), TextAlign::RIGHT, "%.1f°C", id(weather_temp_today).state);
it.printf(295, 21, id(size12_bold), id(black), TextAlign::RIGHT, "%.1f°C", id(weather_temp_low_today).state);
}
// --- Einträge ---
if (id(title1).has_state()) {
it.print(4, 40, id(size19), id(black), id(title1).state.c_str());
}
if (id(date1).has_state() && id(time1).has_state()) {
std::string datetime = id(date1).state + " - " + id(time1).state;
it.print(4, 65, id(size12_bold), id(black), datetime.c_str());
}
if (id(tag1).has_state()) {
std::string tag = "#" + id(tag1).state;
it.print(140, 65, id(size12_bold), id(red), tag.c_str());
}
if (id(title2).has_state()) {
it.print(4, 85, id(size19), id(black), id(title2).state.c_str());
}
if (id(date2).has_state() && id(time2).has_state()) {
std::string datetime2 = id(date2).state + " - " + id(time2).state;
it.print(4, 110, id(size12_bold), id(black), datetime2.c_str());
}
if (id(tag2).has_state()) {
std::string tag_2 = "#" + id(tag2).state;
it.print(140, 110, id(size12_bold), id(red), tag_2.c_str());
}
deep_sleep:
id: sleep_mode
sleep_duration: 2h
font:
- file: "fonts/Verdana.ttf"
id: size19
size: 19
- file: "fonts/Verdana.ttf"
id: size12
size: 12
- file: "fonts/Verdana_Bold.ttf"
id: size12_bold
size: 12
- file: "fonts/Verdana_Bold.ttf"
id: size14_bold
size: 14
- file: 'fonts/materialdesignicons-webfont.ttf'
id: icon_font40
size: 40
glyphs:
- "\U000F0590" # cloudy
- "\U000F0591" # fog
- "\U000F0595" # partly-cloudy
- "\U000F0597" # rainy
- "\U000F0598" # snowy
- "\U000F0599" # sunny
- "\U000F059D" # windy
sensor:
# Wetter (aus deinen HA-Template-Sensoren)
- platform: homeassistant
entity_id: sensor.wettervorhersage_heute
id: weather_temp_today
- platform: homeassistant
entity_id: sensor.wettervorhersage_morgen
id: weather_temp_tomorrow
- platform: homeassistant
entity_id: sensor.weather_low_temp_today
id: weather_temp_low_today
- platform: homeassistant
entity_id: sensor.weather_low_temp_tomorrow
id: weather_temp_low_tomorrow
# INA219 (I2C)
- platform: ina219
address: 0x40
shunt_resistance: 0.1 ohm
max_current: 3.2A
bus_voltage:
name: "INA219 Bus Voltage"
id: ina_bus_v
shunt_voltage:
name: "INA219 Shunt Voltage"
id: ina_shunt_v
current:
name: "INA219 Current"
id: ina_current
power:
name: "INA219 Power"
id: ina_power
update_interval: 5s
text_sensor:
- platform: homeassistant
entity_id: sensor.nextertitle
id: title1
- platform: homeassistant
entity_id: sensor.nexterdate
id: date1
- platform: homeassistant
entity_id: sensor.nextertime
id: time1
- platform: homeassistant
entity_id: sensor.nextertag
id: tag1
- platform: homeassistant
entity_id: sensor.nextertitle2
id: title2
- platform: homeassistant
entity_id: sensor.nexterdate2
id: date2
- platform: homeassistant
entity_id: sensor.nextertime2
id: time2
- platform: homeassistant
entity_id: sensor.nextertag2
id: tag2
- platform: homeassistant
entity_id: sensor.weather_condition_today
id: weather_condition_today
time:
- platform: homeassistant
id: homeassistant_time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment