psf Nel mio caso il display eink da 4,2 pollici della waveshare
si, io ho il 7.5" della waveshare e la relativa driver board per gestirlo. Come lo comandi tu?
Questo è il sorgente, al momento ho messo solo un "punto di rottura" che è quando va a convertire il meteo in immagine (ma mi succede sempre quando ho costrutti tipo
it.printf(245, 335, id(font_mdi_large), color_black, TextAlign::TOP_CENTER, "%s", weather_icon_map[id(weather_condition_now).state.c_str()].c_str());
Cosa che apparentemente non succede a chi ha postato il codice nel sito sopra....
La formattazione su questo forum esce male, anche provando a mettere codice, dimmi eventualmente dove ti posso passare il codice
esphome:
name: eink-frame-1
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: "XXXXXXXXXXXXXXXXX"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Eink-Frame-1 Fallback Hotspot"
password: "XXXXXXXXXXXXX"
# Include time
time:
- platform: sntp
timezone: Europe/Rome
id: esptime
#Include sun
sun:
latitude: 45.738760
longitude: 8.977543
font:
- file: 'fonts/GothamRnd-Book.ttf'
id: font_small_book
size: 18
- file: 'fonts/GothamRnd-Bold.ttf'
id: font_large_bold
size: 108
glyphs: [' ', '°', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'C',]
- file: 'fonts/GothamRnd-Bold.ttf'
id: font_time
size: 90
glyphs: [' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':']
- file: 'fonts/GothamRnd-Book.ttf'
id: font_weekday
size: 30
- file: 'fonts/GothamRnd-Book.ttf'
id: font_day
size: 65
glyphs: [' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
- file: 'fonts/GothamRnd-Bold.ttf'
id: font_month
size: 40
- file: 'fonts/GothamRnd-Bold.ttf'
id: font_medium_bold
size: 40
#glyphs: [' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'M', 'I', 'N']
- file: 'fonts/GothamRnd-Bold.ttf'
id: font_small_bold
size: 18
# glyphs: ['°', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'C', 'M', 'I', 'N']
# Include Material Design Icons font
# Thanks to https://community.home-assistant.io/t/display-materialdesign-icons-on-esphome-attached-to-screen/199790/16
- file: 'fonts/materialdesignicons-webfont.ttf'
id: font_mdi_large
size: 96
glyphs: &mdi-weather-glyphs
- "\U000F029A" # mdi-gauge
- "\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
- "\U000F058E" # mdi-water-percent
- "\U000F04C5" # mdi-spedometer
- "\U000F0F29" # mdi-snowflake-alert
- "\U000F15FA" # mdi-windsock
- "\U000F19B3" # mdi-arrow-down-thin
- "\U000F19B2" # mdi-arrow-up-thin
- "\U000F19B4" # mdi-arrow-top-right-thin
- "\U000F19B7" # mdi-arrow-bottom-right-thin
- "\U000F018C" # mdi-compass-outline
- "\U000F05A9" # mdi-wifi
- "\U000F0928" # mdi-wifi-strength-4
- "\U000F0925" # mdi-wifi-strength-3
- "\U000F0922" # mdi-wifi-strength-2
- "\U000F091F" # mdi-wifi-strength-1
- "\U000F092B" # mdi-wifi-strength-alert-outline
- "\U000F0079" # mdi-battery
- "\U000F0082" # mdi-battery-90
- "\U000F0081" # mdi-battery-80
- "\U000F0080" # mdi-battery-70
- "\U000F007F" # mdi-battery-60
- "\U000F007E" # mdi-battery-50
- "\U000F007D" # mdi-battery-40
- "\U000F007C" # mdi-battery-30
- "\U000F007B" # mdi-battery-20
- "\U000F007A" # mdi-battery-10
- "\U000F10CD" # mdi-battery-alert-variant-outline
- "\U000F0E03" # mdi-thermometer-chevron-up
- "\U000F0E02" # mdi-thermometer-chevron-down
- "\U000F1A09" # mdi-triangle-small-down
- "\U000F1A0A" # mdi-triangle-small-up
- "\U000F050F" # mdi-thermometer
- "\U000F054A" # mdi-umbrella
- file: 'fonts/materialdesignicons-webfont.ttf'
id: font_mdi_medlarge
size: 60
glyphs:
- "\U000F058E" # mdi-water-percent
- "\U000F04C5" # mdi-spedometer
- "\U000F0F29" # mdi-snowflake-alert
- "\U000F15FA" # mdi-windsock
- "\U000F0F61" # mdi-moon-first-quarter
- "\U000F0F62" # mdi-moon-full
- "\U000F0F63" # mdi-moon-last-quarter
- "\U000F0F64" # mdi-moon-new
- "\U000F0F65" # mdi-moon-waning-crescent
- "\U000F0F66" # mdi-moon-waning-gibbous
- "\U000F0F67" # mdi-moon-waxing-crescent
- "\U000F0F68" # mdi-moon-waxing-gibbous
- file: 'fonts/materialdesignicons-webfont.ttf'
id: font_mdi_medium
size: 36
glyphs: *mdi-weather-glyphs
# Call Weather sensors from HA
sensor:
# Temperature
- platform: homeassistant
name: "Temperature"
entity_id: sensor.temperature_3
id: weather_temperature
# Humidity
- platform: homeassistant
name: "Humidity"
entity_id: sensor.humidity_2
id: weather_humidity
# Air Pressure
- platform: homeassistant
name: "Air Pressure"
entity_id: sensor.pressure_4
id: weather_pressure
# Moon phase
- platform: homeassistant
entity_id: sensor.moon_phase
id: moon_phase
- platform: homeassistant
entity_id: sensor.moon_rise
id: moon_rise
- platform: homeassistant
entity_id: sensor.moon_set
id: moon_set
# Wind Speed
- platform: homeassistant
entity_id: weather.home
attribute: wind_speed
id: wind_speed
# UV Index
- platform: homeassistant
entity_id: sensor.home_uv_index
id: uv_index
# Rain
- platform: homeassistant
entity_id: sensor.home_precipitation
id: rain
# # Weatherman entities
- platform: homeassistant
entity_id: sensor.weatherman_data
attribute: weather_condition_now
id: weather_condition_now
text_sensor:
- platform: sun
name: Sun Next Sunrise
type: sunrise
id: sun_sunrise
format: "%H:%M"
- platform: sun
name: Sun Next Sunset
type: sunset
id: sun_sunset
format: "%H:%M"
color:
- id: color_black
red: 0%
green: 0%
blue: 0%
white: 50%
- id: color_white
red: 0%
green: 0%
blue: 0%
white: 0%
# Pins for Waveshare ePaper ESP Board
spi:
clk_pin: GPIO13
mosi_pin: GPIO14
# Now render everything on the ePaper screen.
display:
- platform: waveshare_epaper
cs_pin: GPIO15
dc_pin: GPIO27
busy_pin: GPIO25
reset_pin: GPIO26
model: 7.50inV2
update_interval: 600s
rotation: 90°
auto_clear_enabled: true
lambda: |-
// Map weather states to MDI characters.
std::map<std::string, std::string> moon_icon_map
{
{"first_quarter", "\U000F0F61"},
{"full_moon", "\U000F0F62"},
{"last_quarter", "\U000F0F63"},
{"new_moon", "\U000F0F64"},
{"waning_crescent", "\U000F0F65"},
{"waning_gibbous", "\U000F0F66"},
{"waning_crescent", "\U000F0F67"},
{"waxing_gibbous", "\U000F0F68"},
};
std::map<std::string, std::string> weather_icon_map
{
{"cloudy", "\U000F0590"},
{"cloudy-alert", "\U000F0F2F"},
{"cloudy-arrow-right", "\U000F0E6E"},
{"fog", "\U000F0591"},
{"hail", "\U000F0592"},
{"hazy", "\U000F0F30"},
{"hurricane", "\U000F0898"},
{"lightning", "\U000F0593"},
{"lightning-rainy", "\U000F067E"},
{"night", "\U000F0594"},
{"night-partly-cloudy", "\U000F0F31"},
{"partlycloudy", "\U000F0595"},
{"partly-lightning", "\U000F0F32"},
{"partly-rainy", "\U000F0F33"},
{"partly-snowy", "\U000F0F34"},
{"partly-snowy-rainy", "\U000F0F35"},
{"pouring", "\U000F0596"},
{"rainy", "\U000F0597"},
{"snowy", "\U000F0598"},
{"snowy-heavy", "\U000F0F36"},
{"snowy-rainy", "\U000F067F"},
{"sunny", "\U000F0599"},
{"sunny-alert", "\U000F0F37"},
{"sunny-off", "\U000F14E4"},
{"sunset", "\U000F059A"},
{"sunset-down", "\U000F059B"},
{"sunset-up", "\U000F059C"},
{"tornado", "\U000F0F38"},
{"windy", "\U000F059D"},
{"windy-variant", "\U000F059E"},
};
// ----------------------------------------------------------------------------------- Print day, date and month
it.strftime(265, 70, id(font_weekday), TextAlign::TOP_CENTER, "%A %d %b", id(esptime).now());
// Weather Section ------------------------------------------------------------------- PLACE NAME
it.print(265, 280, id(font_weekday), color_black, TextAlign::TOP_CENTER, "Appiano Gentile");
// ----------------------------------------------------------------------------------- WEATHER STATE ICON --------------- (110, 358)
it.printf(245, 335, id(font_mdi_large), color_black, TextAlign::TOP_CENTER, "%s", weather_icon_map[id(weather_condition_now).state.c_str()].c_str());
// ----------------------------------------------------------------------------------- HUMIDITY
if(id(weather_humidity).has_state ()) {
it.printf(100, 352, id(font_mdi_medium), color_black, TextAlign::BASELINE_RIGHT, "\U000F058E");
it.printf(145, 350, id(font_small_bold), color_black, TextAlign::BASELINE_LEFT, "%s", "%");
it.printf(140, 350, id(font_weekday), color_black, TextAlign::BASELINE_RIGHT, "%2.0f", id(weather_humidity).state);
}
// ----------------------------------------------------------------------------------- TEMPERATURE
if(id(weather_temperature).has_state ()) {
it.printf(100, 400, id(font_mdi_medium), color_black, TextAlign::BASELINE_RIGHT, "\U000F050F");
it.printf(145, 400, id(font_small_bold), color_black, TextAlign::BASELINE_LEFT, "%s", "°C");
it.printf(140, 400, id(font_weekday), color_black, TextAlign::BASELINE_RIGHT, "%2.0f", id(weather_temperature).state);
}
// ----------------------------------------------------------------------------------- UV INDEX
if(id(uv_index).has_state ()) {
it.printf(100, 454, id(font_mdi_medium), color_black, TextAlign::BASELINE_RIGHT, "\U000F0F37");
it.printf(140, 450, id(font_weekday), color_black, TextAlign::BASELINE_RIGHT, "%2.0f", id(uv_index).state);
it.printf(145, 450, id(font_small_bold), color_black, TextAlign::BASELINE_LEFT, "UVI");
}
// ----------------------------------------------------------------------------------- PRESSURE
if(id(weather_pressure).has_state ()) {
it.printf(330, 352, id(font_mdi_medium), color_black, TextAlign::BASELINE_CENTER, "\U000F029A");
it.printf(410, 350, id(font_weekday), color_black, TextAlign::BASELINE_RIGHT, "%2.0f", id(weather_pressure).state);
it.printf(415, 350, id(font_small_bold), color_black, TextAlign::BASELINE_LEFT, "hPa");
}
// ----------------------------------------------------------------------------------- WIND
if(id(wind_speed).has_state ()) {
it.printf(330, 400, id(font_mdi_medium), color_black, TextAlign::BASELINE_CENTER, "\U000F15FA");
it.printf(410, 400, id(font_weekday), color_black, TextAlign::BASELINE_RIGHT, "%2.0f", id(wind_speed).state);
it.printf(415, 400, id(font_small_bold), color_black, TextAlign::BASELINE_LEFT, "kmh");
}
// ----------------------------------------------------------------------------------- RAIN
if(id(rain).has_state ()) {
it.printf(330, 454, id(font_mdi_medium), color_black, TextAlign::BASELINE_CENTER, "\U000F054A");
it.printf(410, 450, id(font_weekday), color_black, TextAlign::BASELINE_RIGHT, "%2.0f", id(rain).state);
it.printf(415, 450, id(font_small_bold), color_black, TextAlign::BASELINE_LEFT, "mm");
}
// ----------------------------------------------------------------------------------- Print sunrise
if(id(sun_sunrise).has_state ()) {
it.printf(100, 235, id(font_mdi_medium), color_black, TextAlign::CENTER_RIGHT, "\U000F059C");
it.printf(105, 235, id(font_small_bold), color_black, TextAlign::CENTER_LEFT, "%s", id(sun_sunrise).state.c_str());
}
// ----------------------------------------------------------------------------------- Print sunset
if(id(sun_sunset).has_state ()) {
it.printf(455, 235, id(font_mdi_medium), color_black, TextAlign::CENTER_RIGHT, "\U000F059B");
it.printf(415, 235, id(font_small_bold), color_black, TextAlign::CENTER_RIGHT, "%s", id(sun_sunset).state.c_str());
}
captive_portal:
EDIT:
Il sensore creato su HA è questo:

Templatizzato così nello yaml di HA
template:
- sensor:
- name: "Weatherman Data"
state: "OK"
attributes:
weather_condition_now: >
{% set cond_now = states('weather.home') %}
{% if states('sun.sun') == 'below_horizon' %}
{% if cond_now == 'sunny' %} night {% elif cond_now == 'partlycloudy' %} night-partly-cloudy {% else %} {{ cond_now }} {% endif %}
{% else %}
{{ cond_now }}
{% endif %}
A parte le immagini del meteo (che sono statiche per prova) sono arrivato a questo punto
