E-ink Display Via ESP-Home

I have a displaying Problem with my E ink display. I got it running and it shows the values from HA that i want. But the displaying quality is wierd. the text is very grizzly and not really black. but on the other hand some lines are perfekt black.
And sometimes if i leave it unplugged for some time all is black in the beginning and will fade out suddenly after like a few refreshes.

I got this esp32 with display combo:Amazon.de

Maybe someone has a good advise on what to do

My Code:

esphome:
  name: "display"
  friendly_name: E-Paper Dashboard
  on_boot:
    then:
      - switch.turn_on: display_power
      - script.execute: update_screen
  on_shutdown:
    then:
      - switch.turn_off: display_power


esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "my password"
  encryption:
    key: "my key"

ota:
  - platform: esphome
    password: "my password"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Display Fallback Hotspot"
    password: "TvLUBQZ1sCut"

# ------------------------------------------------------------------------



switch:
  - platform: gpio
    pin: GPIO32 #display power enable pin
    id: display_power
    internal: true  



button:
  - platform: restart
    name: "Dashboard - Restart"
  - platform: template
    name: "Dashboard - Refresh Screen"
    entity_category: config
    on_press:
      - script.execute: update_screen
      

script:
  - id: update_screen
    then:
      - component.update: screen
      

# Include custom fonts
font:
  - file: 'fonts/GothamRnd-Book.ttf'
    id: font_small_book
    size: 18
  - file: 'fonts/GothamRnd-Bold.ttf'
    id: big
    size: 100
    # glyphs: [' ', '-', '°', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'C']
  - file: 'fonts/GothamRnd-Bold.ttf'
    id: medium
    size: 40
    # glyphs: ['W', 'E', 'A', 'T', 'H', 'R', 'L', 'I', 'N', ' ']
  - file: 'fonts/GothamRnd-Bold.ttf'
    id: small
    size: 30
    # glyphs: [' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'M', 'I', 'N']
  - file: 'fonts/GothamRnd-Bold.ttf'
    id: tiny
    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: 200
    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-clear-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
      - "\U000F10AF" # mdi-door-closed-lock
      - "\U000F081C" # mdi-door-open
      - "\U000F12A3" # mdi battery 100
      - "\U000F12A2" # mdi battery 60
      - "\U000F12A1" # mdi battery 30
      - "\U000F008E" # mdi battery 0
      - "\U000F1904" # mdi home-lightning-bolt-outline
      - "\U000F1A73" # mdi solar-power-variant
      - "\U000F192C" # mdi transmission-tower-import
      - "\U000F192D" # mdi transmission-tower-export
      - "\U000F0734" # mdi arrow right
      - "\U000F0731" # mdi arrow left
      - "\U000F0D3E" # mdi transmission
  - file: 'fonts/materialdesignicons-webfont.ttf'
    id: font_mdi_medium
    size: 85
    glyphs: *mdi-weather-glyphs


# ------------------------------------------------------------------------
# ------------------------------------------------------------------------

# Define colors
# This design is white on black so this is necessary.
color:
  - id: color_bg
    white: 0%
  - id: color_text
    white: 100%

# E paper Display
# Pins für Waveshare ePaper ESP Board
spi:
  clk_pin: GPIO13
  mosi_pin: GPIO14

display:
  - platform: waveshare_epaper
    id: screen
    cs_pin: GPIO15
    dc_pin: GPIO27
    busy_pin:
      number: GPIO25
      inverted: false
    reset_pin: GPIO26
    reset_duration: 500ms
    model: 7.50in-bv3
    update_interval: 60s
    rotation: 0°
    lambda: |-
      // Map weather states to MDI characters.
      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"},
          {"clear-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"},
        };
      // Map door states to MDI characters.
      std::map<std::string, std::string> door_map
        {
          {"locked", "\U000F10AF"},
          {"unlocked", "\U000F081C"},
        };

      it.line(400, 0, 400, 480);
      it.line(0,240,800,240);
      it.rectangle(0,0,330,150);
      it.rectangle(350,0,800, 140);




      //Date and Time
      it.strftime(165, 30, id(small), color_text,TextAlign::CENTER, "%d.%m.%Y", id(homeassistant_time).now());
      it.strftime(165, 100, id(big), color_text,TextAlign::CENTER, "%H:%M", id(homeassistant_time).now());



      //PV Anlage
      float ladezustand = id(battery_level).state;
      float netzbezug = id(solarnet_leistung_netzbezug).state;
      float netzeinspeisung = id(solarnet_leistung_netzeinspeisung).state;
      float pv_leistung = id(solarnet_pv_leistung).state;
      float verbrauch = id(solarnet_leistung_verbrauch).state;
      std::string icon = "";
      std::string icon_pv = "\U000F1A73";  // mdi-solar-power-variant
      std::string icon_netzeinspeisung = "\U000F192D";  // mdi-transmission-tower-export
      std::string icon_netzbezug = "\U000F192C";  // mdi-transmission-tower-import
      std::string icon_verbrauch = "\U000F1904";  // mdi-home-lightning-bolt-outline
      std::string icon_arrow_right = "\U000F0734";  // mdi arrow right
      std::string icon_arrow_left = "\U000F0731";  // mdi arrow left
      std::string icon_transmission = "\U000F0D3E";  // transmission

      // PV-Leistung
      it.printf(390, 45, id(font_mdi_medium),TextAlign::CENTER, "%s", icon_pv.c_str());
      if (pv_leistung <1000){
      it.printf(390, 120, id(small),TextAlign::CENTER, "%.0fW", pv_leistung);
      }else{
      pv_leistung=pv_leistung/1000;
      it.printf(390, 120, id(small),TextAlign::CENTER, "%.2fkW", pv_leistung);
      }

      // Verbrauch
      it.printf(510, 45, id(font_mdi_medium),TextAlign::CENTER, "%s", icon_verbrauch.c_str());
      if (verbrauch <1000){
      it.printf(510, 120, id(small),TextAlign::CENTER, "%.0fW", verbrauch);
      }else{
      verbrauch=verbrauch/1000;
      it.printf(510, 120, id(small),TextAlign::CENTER, "%.2fkW", verbrauch);
      }

      // Netzbezug/Netzeinspeisung
      it.printf(640, 45, id(font_mdi_medium),TextAlign::CENTER, "%s", icon_transmission.c_str());
      if ((netzbezug-netzeinspeisung)>0){
      it.printf(575, 45, id(font_mdi_medium),TextAlign::CENTER, "%s", icon_arrow_left.c_str());
        if(netzbezug<1000){
          it.printf(645, 120, id(small),TextAlign::CENTER, "%.0fW", netzbezug);
        }else{
          netzbezug = netzbezug /1000;
          it.printf(645, 120, id(small),TextAlign::CENTER, "%.2fkW", netzbezug);
        }
      }else{
      it.printf(575, 45, id(font_mdi_medium),TextAlign::CENTER, "%s", icon_arrow_right.c_str());
        if(netzeinspeisung<1000){
          it.printf(645, 120, id(small),TextAlign::CENTER, "%.0fW", netzeinspeisung);
        }else{
          netzeinspeisung = netzeinspeisung/1000;
          it.printf(645, 120, id(small),TextAlign::CENTER, "%.2fkW", netzeinspeisung);
        }
      }

      // Ladezustand prüfen und entsprechendes Icon setzen
      if (ladezustand > 75) {
        icon = "\U000F12A3";  // mdi battery 100
      } else if (ladezustand > 45) {
        icon = "\U000F12A2";  // mdi battery 60
      } else if (ladezustand > 20) {
        icon = "\U000F12A1";  // mdi battery 30
      } else {
        icon = "\U000F008E";  // mdi battery 0
      }

      // Akku-Symbol und Ladezustand
      it.printf(740, 40, id(font_mdi_medium), TextAlign::CENTER, "%s", icon.c_str());
      it.printf(757, 120, id(small), TextAlign::CENTER, "%.0f%%", ladezustand);






captive_portal:


time:
  - platform: homeassistant
    id: homeassistant_time

sensor:
  - platform: homeassistant
    id: battery_level
    entity_id: sensor.byd_battery_box_premium_hv_ladezustand

  - platform: homeassistant
    name: "Solarnet Netzbezug"
    entity_id: sensor.solarnet_leistung_netzbezug
    id: solarnet_leistung_netzbezug

  - platform: homeassistant
    name: "Solarnet Netzeinspeisung"
    entity_id: sensor.solarnet_leistung_netzeinspeisung
    id: solarnet_leistung_netzeinspeisung

  - platform: homeassistant
    name: "Solarnet PV Leistung"
    entity_id: sensor.solarnet_pv_leistung
    id: solarnet_pv_leistung

  - platform: homeassistant
    name: "Solarnet Verbrauch"
    entity_id: sensor.solarnet_leistung_verbrauch
    id: solarnet_leistung_verbrauch


I have the official Waveshare board, which has an A / B switch like this one. That needs to be in the right position for the type of screen you use. Check the documentation which setting is right for your combo.

Also, I seem to remember my display (a three color version) needs the busy pin inverted for it to properly power down between refreshes. You should also check the esp waveshare documentation for that. I believe there also is a test to see if the display powers down but I cannot remember where I saw that. If it does not power down, the display will deteriorate very fast over time, leading to very low contrast.

And last but not least: I think the display version you have in yaml is a three color board, while you seem to have bought the BW one?

1 Like

ps. You can use a three color display for BW only, but the two color display is a different screen alltogether. Its refresh cycle is totally different.

1 Like

Thanks A lot, switching the A/B Switch helped a lot, i am still a bit confused which version i got. because it is working finde with the 7.5inv2alt version. but with the 7.5inv2 version it it also running the text is just a bit more grizzly. But i dont want to use to wrong version to prevent display damage.

The picture is the v2alt version

The 3 color displays require a much longer refresh cycle, because they need to juggle the third color between the other two. The BW version only has two inks. As there is no mention of a third color in the ad, I’d expect you need the version numbers without a “b” in them (the b is not for bw, curiously enough). But I’d expect the version number to be on the box anyway.