esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
409 stars 26 forks source link

add support for weact eink (2.13 maybe 2.9) #2101

Open alinelena opened 1 year ago

alinelena commented 1 year ago

would be nice to add support for weact eink module... https://github.com/WeActStudio/WeActStudio.EpaperModule

I have already played with it and is almost working... with this

  57 spi:                                                                                                                                
  58   id: bus_a                                                                                                                         
  59   clk_pin: GPIO04                                                                                                                   
  60   mosi_pin: GPIO06                                                                                                                  
  61   miso_pin: GPIO05   

  71 display:                                                                                                                            
  72   - platform: waveshare_epaper                                                                                                      
  73     spi_id: bus_a                                                                                                                   
  74     model: "2.13in-ttgo-dke"                                                                                                        
  75     reset_pin: GPIO02                                                                                                               
  76     cs_pin: GPIO07                                                                                                                  
  77     dc_pin: GPIO01                                                                                                                  
  78     busy_pin: GPIO3                                                                                                                 
  79     rotation: 90                                                                                                                    
  80     full_update_every: 60                                                                                                           
  81     update_interval: 120s 

on an esp32-c3 also tested on a normal esp32 nodemcu

the only issue I noticed is the bottom row is full of noise.. I traced this to the fact the ram on x somehow is shifted. starts at 0x01 but shall start at 0x0 the size is correct...

alinelena commented 1 year ago

practically I had to change this

1513   this->command(0x44);                                                                                                              
1514   this->data(1);                                                                                                                    
1515   this->data(this->get_width_internal() / 8);

to

1513   this->command(0x44);                                                                                                              
1514   this->data(0);                                                                                                                    
1515   this->data(this->get_width_internal() -1/ 8); 
alinelena commented 1 year ago

IMG_20230204_222827

top is the fixed version... below the original one... ignore the extra line of text

phaedrus42a commented 1 year ago

I managed to get the WeAct Studio 2.9" 128x296 module working without much effort on a NodeMCU ESP32. Code:

spi:

mosi_pin: GPIO15 # aka SDA clk_pin: GPIO02 #aka SCL

display:

2-9-inch-weact

swiss01 commented 1 year ago

@phaedrus42a Fuck! You are Giniels :D

My display works more or less. I still have problems that the new data is not displayed cleanly and the old ones are still fading for a while. What can be the reason?

I work with an ESP 8266 mini. I connected them as follows.

spi:
  clk_pin: D1
  mosi_pin: D2

display:
  - platform: waveshare_epaper
    model: 2.90inV2
    cs_pin: RX
    busy_pin: D5
    reset_pin: D8
    dc_pin: D4
    rotation: 90
    full_update_every: 5
    update_interval: 60s

IMG_20230225_170049

swiss01 commented 1 year ago

ok found the problem. In other words, I know how to deal with it. I sent a little the wrong code above. Of course I have an update_interval of one second.

However, the display can refresh at most every three seconds, otherwise there are artifacts.

So I removed the seconds display and set the update_interval to 5s. That's how it works very well.

if anyone finds out how to update every second without artifacts, please report :)

Code for ESP8266

spi:
  clk_pin: D1
  mosi_pin: D2

display:
  - platform: waveshare_epaper
    model: 2.90inV2
    cs_pin: RX
    busy_pin: D5
    reset_pin: D8
    dc_pin: D4
    rotation: 90
    full_update_every: 14400
    update_interval: 5s
alinelena commented 1 year ago

looking in weact example and library they used i would say 15s is what you should use.

swiss01 commented 1 year ago

Ah ok. now I can see that on the product page on Aliexpress as well. only the translation into German is very bad. Black and white has about 3s and the tricolor about 19s

the seconds display flies out and the problem is solved 👍

alinelena commented 1 year ago

just a note: i got my hands on a 2.9 bw seems with 2.9inV2 accummulates artifacts very fast much faster than 2.13, hence the need of faster full refreshes... I will need to check that the settings are actually fine. @swiss01 can you share your update intervals, both partial and full

alinelena commented 1 year ago

ok looking through the code of the weact 2.9 example and the lib they use https://github.com/ZinggJM/GxEPD2/blob/master/src/epd/GxEPD2_290_BS.cpp i think is just a matter of luck 2.9inV2 works. https://esphome.io/api/waveshare__epaper_8cpp_source.html

swiss01 commented 1 year ago

I have now connected 3 displays to an ESP32. The main problem is the first time the display refreshes, there may be artifacts for a while before there isn't much data left to refresh. After about 1-2 minutes I no longer have any artefacts on the display and the minute display runs well. Does it work? Yes. Good? no! but it works ;)

I'm trying to replicate it and adapt it to my needs https://community.home-assistant.io/t/e-paper-display/138625/33

My Code.

esphome:
  name: esp-wetterstation
  friendly_name: ESP-Wetterstation

esp32:
  board: esp32-devkitlipo
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxxx"

ota:
  password: "xxxx"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp-Wetterstation"
    password: "lP5DXqBkjIfa"

captive_portal:

# Ab hier kopie von psp888

font:
  - file: 'fonts/Roboto-Medium.ttf'
    id: size_85_font
    size: 85  
  - file: 'fonts/Roboto-Medium.ttf'
    id: size_75_font
    size: 75
  - file: 'fonts/Roboto-Medium.ttf'
    id: size_60_font
    size: 60
  - file: 'fonts/Roboto-Medium.ttf'
    id: size_50_font
    size: 50
  - file: 'fonts/Roboto-Light.ttf'
    id: size_12_font
    size: 12
  - file: 'fonts/Roboto-Medium.ttf'
    id: size_15_font
    size: 15
  - file: 'fonts/Roboto-Medium.ttf'
    id: size_14_font
    size: 14    
  - file: 'fonts/Roboto-Medium.ttf'
    id: size_20_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','å', 'Ä', 'ä', 'Ö', 'ö', 'Ü', 'ü', '/']    
    size: 20
  - file: 'fonts/Roboto-Medium.ttf'
    id: size_25_font
    size: 25
  - file: 'fonts/Roboto-Medium.ttf'
    id: size_30_font
    size: 30
  - file: 'fonts/materialdesignicons-webfont.ttf'
    id: weather_font
    size: 120
    glyphs: [
      # Weather
      "\U000F0599", # mdi-weather-sunny
      "\U000F0590", # mdi-weather-cloudy
      "\U000F0596", # mdi-weather-pouring
      "\U000F067F", # mdi-weather-snowy-rainy
      "\U000F0F36", # mdi-weather-snowy-heavy
      "\U000F059E", # mdi-weather-windy-variant
      "\U000F0591", # mdi-weather-fog
      "\U000F0F31", # mdi-weather-night-partly-cloudy
      "\U000F0595", # mdi-weather-partly-cloudy
      "\U000F0597", # mdi-weather-rainy
      "\U000F0598", # mdi-weather-snowy
      "\U000F0594", # mdi-weather-clear-night
      "\U000F199F", # unknown
      ]
  - file: 'fonts/materialdesignicons-webfont.ttf'
    id: weather_temp_icon_font
    size: 25
    glyphs: [
      "\U000F0E03", # mdi-down
      "\U000F0E02", # mdi-up
      "\U000F058C", # raindrop
      "\U000F059D", # wind
      ]
  - file: 'fonts/materialdesignicons-webfont.ttf'
    id: home_icon_font
    size: 20
    glyphs: [
      "\U000F0F48", # mdi-chair-rolling
      "\U000F02E3", # mdi-bed
      "\U000F04B9", # mdi-sofa
      "\U000F065A", # mdi-pot-steam
      ]
  - file: 'fonts/materialdesignicons-webfont.ttf'
    id: weather_font_45
    size: 45
    glyphs: [
      # Moon
      "\U000F0F64", # new_moon
      "\U000F0F67", # waxing_crecent
      "\U000F0F61", # first_quarter 
      "\U000F0F66", # waxing_gibbous
      "\U000F0F62", # full_moon
      "\U000F0F68", # waning_gibbous
      "\U000F0F63", # last_quarter
      "\U000F0F65", # waning_crescent
      "\U000F199F", # mdi-timer-sand-complete
      ]
  - file: 'fonts/materialdesignicons-webfont.ttf'
    id: sun_icon_font
    size: 20
    glyphs: [
      "\U000F059C", # sun rise
      "\U000F059B", # sun set
      ]      
  - file: 'fonts/materialdesignicons-webfont.ttf'
    id: wlan_icon_font
    size: 25
    glyphs: [
      "\U000F0920", # wifi-strength-1-alert
      "\U000F0922", # wifi-strenght-2
      "\U000F0925", # wifi-strenght-3
      "\U000F0928", # wifi-strenght-4    
      "\U000F092E", # wifi-strength-off-outline        
      ]    

spi:
  clk_pin: GPIO18
  mosi_pin: GPIO23

display:
#Weater  
  - platform: waveshare_epaper
    model: 2.90inV2
    cs_pin: GPIO32
    busy_pin: GPIO0
    reset_pin: GPIO2
    dc_pin: GPIO4
    rotation: 180
    full_update_every: 14400
    update_interval: 10s
    lambda: |-
      if (id(forecast_condition).has_state()) {
        if (id(forecast_condition).state == "snowy-rainy") {
          it.printf(64, 98, id(weather_font), TextAlign::BASELINE_CENTER , "\U000F067F");
        } else if (id(forecast_condition).state == "snowy-heavy") {
          it.printf(64, 98, id(weather_font), TextAlign::BASELINE_CENTER , "\U000F067F");
        } else if (id(forecast_condition).state == "rainy") {
          it.printf(64, 98, id(weather_font), TextAlign::BASELINE_CENTER , "\U000F0597");
        } else if (id(forecast_condition).state == "pouring") {
          it.printf(64, 98, id(weather_font), TextAlign::BASELINE_CENTER , "\U000F0596");
        } else if (id(forecast_condition).state == "cloudy") {
          it.printf(64, 98, id(weather_font), TextAlign::BASELINE_CENTER , "\U000F0590");
        } else if (id(forecast_condition).state == "partlycloudy") {
          it.printf(64, 98, id(weather_font), TextAlign::BASELINE_CENTER , "\U000F0595");
        } else if (id(forecast_condition).state == "sunny") {
          it.printf(64, 98, id(weather_font), TextAlign::BASELINE_CENTER , "\U000F0598");
        } else if (id(forecast_condition).state == "windyvariant") {
          it.printf(64, 98, id(weather_font), TextAlign::BASELINE_CENTER , "\U000F059E");
        } else if (id(forecast_condition).state == "fog") {
          it.printf(64, 98, id(weather_font), TextAlign::BASELINE_CENTER , "\U000F0591");
        } else if (id(forecast_condition).state == "nightpartlycloudy") {
          it.printf(64, 98, id(weather_font), TextAlign::BASELINE_CENTER , "\U000F0F31");
        } else if (id(forecast_condition).state == "partlycloudy") {
          it.printf(64, 98, id(weather_font), TextAlign::BASELINE_CENTER , "\U000F0595");
        } else if (id(forecast_condition).state == "snowy") {
          it.printf(64, 98, id(weather_font), TextAlign::BASELINE_CENTER , "\U000F0598");
        } else if (id(forecast_condition).state == "clear-night") {
          it.printf(64, 98, id(weather_font), TextAlign::BASELINE_CENTER , "\U000F0594");
        } else {
          it.printf(64, 98, id(weather_font), TextAlign::BASELINE_CENTER , "\U000F199F");
        }
      }

      if (id(forecast_condition).has_state()) {
        if (id(forecast_condition).state == "snowy-rainy") {
          it.print(64, 122, id(size_20_font), TextAlign::BASELINE_CENTER , "Schneeregen");
        } else if (id(forecast_condition).state == "snowy-heavy") {
          it.print(64, 122, id(size_20_font), TextAlign::BASELINE_CENTER , "viel Schnee");
        } else if (id(forecast_condition).state == "rainy") {
          it.print(64, 122, id(size_20_font), TextAlign::BASELINE_CENTER , "Regen");
        } else if (id(forecast_condition).state == "pouring") {
          it.print(64, 122, id(size_20_font), TextAlign::BASELINE_CENTER , "Strömend");
        } else if (id(forecast_condition).state == "cloudy") {
          it.print(64, 122, id(size_20_font), TextAlign::BASELINE_CENTER , "Bewölkt");
        } else if (id(forecast_condition).state == "partlycloudy") {
          it.print(64, 122, id(size_20_font), TextAlign::BASELINE_CENTER , "Durchzogen");
        } else if (id(forecast_condition).state == "sunny") {
          it.print(64, 122, id(size_20_font), TextAlign::BASELINE_CENTER , "Sonnig");
        } else if (id(forecast_condition).state == "windyvariant") {
          it.print(64, 122, id(size_20_font), TextAlign::BASELINE_CENTER , "Windig");
        } else if (id(forecast_condition).state == "fog") {
          it.print(64, 122, id(size_20_font), TextAlign::BASELINE_CENTER , "Nebel");
        } else if (id(forecast_condition).state == "nightpartlycloudy") {
          it.print(64, 122, id(size_20_font), TextAlign::BASELINE_CENTER , "Durchzogen");
        } else if (id(forecast_condition).state == "partlycloudy") {
          it.print(64, 122, id(size_20_font), TextAlign::BASELINE_CENTER , "Durchzogen");
        } else if (id(forecast_condition).state == "snowy") {
          it.print(64, 122, id(size_20_font), TextAlign::BASELINE_CENTER , "Schnee");
        } else if (id(forecast_condition).state == "clear-night") {
          it.print(64, 122, id(size_20_font), TextAlign::BASELINE_CENTER , "klare Nacht");
        } else {
          it.print(64, 122, id(size_20_font), TextAlign::BASELINE_CENTER , "keine Ahnung");
        }
      }

      it.printf(24, 152, id(weather_temp_icon_font), TextAlign::BASELINE_CENTER , "\U000F0E03");
      if (id(forecast_temperature).has_state()) {
        it.printf(98, 154, id(size_30_font), TextAlign::BASELINE_RIGHT , "%.1f", id(forecast_temperature).state);
        it.printf(99, 148, id(size_20_font), TextAlign::BASELINE_LEFT , "°");
        it.printf(100, 154, id(size_20_font), TextAlign::BASELINE_LEFT , "C");
      }

      it.printf(24, 183, id(weather_temp_icon_font), TextAlign::BASELINE_CENTER , "\U000F0E02");
      if (id(forecast_temperature_low).has_state()) {
        it.printf(98, 185, id(size_30_font), TextAlign::BASELINE_RIGHT , "%.1f", id(forecast_temperature_low).state);
        it.printf(99, 179, id(size_20_font), TextAlign::BASELINE_LEFT , "°");
        it.printf(100, 185, id(size_20_font), TextAlign::BASELINE_LEFT , "C");
      }

      std::string str = id(forecast_precipitation).state;
      //ESP_LOGI("Weather", "%s", str.c_str());

      it.printf(19, 214, id(weather_temp_icon_font), TextAlign::BASELINE_CENTER , "\U000F058C");
      if (id(forecast_precipitation).has_state()) {
        if (str != "unknown") {
          it.printf(98, 216, id(size_30_font), TextAlign::BASELINE_RIGHT , "%s", id(forecast_precipitation).state.c_str());
          it.printf(99, 216, id(size_12_font), TextAlign::BASELINE_LEFT , "mm");
        }
        else {
          it.printf(98, 216, id(size_30_font), TextAlign::BASELINE_RIGHT , "0.0");
          it.printf(99, 216, id(size_12_font), TextAlign::BASELINE_LEFT , "mm");
        }
      }

      it.printf(19, 245, id(weather_temp_icon_font), TextAlign::BASELINE_CENTER , "\U000F059D");
      if (id(forecast_wind_speed).has_state()) {
        it.printf(98, 247, id(size_30_font), TextAlign::BASELINE_RIGHT , "%.1f", id(forecast_wind_speed).state * 2.237);
        it.printf(99, 247, id(size_12_font), TextAlign::BASELINE_LEFT , "km/h");
      }

      //line
      it.line(0, 254, 128, 254);

      //Wohnzimmer
      it.printf(1, 277, id(home_icon_font), TextAlign::BASELINE_LEFT , "\U000F04B9");
      it.printf(61, 275, id(size_20_font), TextAlign::BASELINE_RIGHT , "%.1f", id(living_room).state);

      //Büro
      it.printf(1, 294, id(home_icon_font), TextAlign::BASELINE_LEFT , "\U000F0F48");
      it.printf(61, 293, id(size_20_font), TextAlign::BASELINE_RIGHT , "%.1f", id(office).state);

      //Küche
      it.printf(65, 277, id(home_icon_font), TextAlign::BASELINE_LEFT , "\U000F065A");
      it.printf(127, 275, id(size_20_font), TextAlign::BASELINE_RIGHT , "%.1f", id(kitchen).state);

      //Schlafzimmer
      it.printf(65, 294, id(home_icon_font), TextAlign::BASELINE_LEFT , "\U000F02E3");
      it.printf(127, 293, id(size_20_font), TextAlign::BASELINE_RIGHT , "%.1f", id(bedroom).state);

#In_Out
  - platform: waveshare_epaper
    model: 2.90inV2
    cs_pin: GPIO25
    busy_pin: GPIO0
    reset_pin: GPIO2
    dc_pin: GPIO4
    rotation: 90
    full_update_every: 14400
    update_interval: 10s
    lambda: |-
      it.print(0, 20, id(size_20_font), TextAlign::BASELINE_LEFT , "OUT");
      it.printf(190, 60, id(size_75_font), TextAlign::BASELINE_RIGHT , "%.1f", id(outside_temp).state);
      it.printf(190, 45, id(size_30_font), TextAlign::BASELINE_LEFT , "°");
      it.printf(191, 60, id(size_30_font), TextAlign::BASELINE_LEFT , "C");
      it.printf(280, 60, id(size_50_font), TextAlign::BASELINE_RIGHT , "%.0f", id(outside_humidity).state);
      it.printf(296, 60, id(size_20_font), TextAlign::BASELINE_RIGHT , "%%");

      //line
      it.line(0, 70, 296, 70);

      it.print(0, 95, id(size_20_font), TextAlign::BASELINE_LEFT , "IN");
      it.printf(190, 125, id(size_60_font), TextAlign::BASELINE_RIGHT , "%.1f", id(inside_temp).state);
      it.printf(190, 110, id(size_30_font), TextAlign::BASELINE_LEFT , "°");
      it.printf(191, 125, id(size_30_font), TextAlign::BASELINE_LEFT , "C");
      it.printf(280, 125, id(size_50_font), TextAlign::BASELINE_RIGHT , "%.0f", id(inside_humidity).state);
      it.printf(296, 125, id(size_20_font), TextAlign::BASELINE_RIGHT , "%%");

#Date_Time
  - platform: waveshare_epaper
    model: 2.90inV2
    cs_pin: GPIO21
    busy_pin: GPIO0
    reset_pin: GPIO2
    dc_pin: GPIO4
    rotation: 90
    full_update_every: 14400
    update_interval: 10s
    lambda: |-   
      /* Moon icon */
      int x, y;
      if (id(moon_icon).has_state()) {
        if (id(moon_icon).state == "new_moon") {
          it.printf(25, 42, id(weather_font_45), TextAlign::BASELINE_CENTER , "\U000F0F64");
        } else if (id(moon_icon).state == "waxing_crecent") {
          it.printf(25, 42, id(weather_font_45), TextAlign::BASELINE_CENTER , "\U000F0F67");
        } else if (id(moon_icon).state == "first_quarter") {
          it.printf(25, 42, id(weather_font_45), TextAlign::BASELINE_CENTER , "\U000F0F61");
        } else if (id(moon_icon).state == "waxing_gibbous") {
          it.printf(25, 42, id(weather_font_45), TextAlign::BASELINE_CENTER , "\U000F0F66");
        } else if (id(moon_icon).state == "full_moon") {
          it.printf(25, 42, id(weather_font_45), TextAlign::BASELINE_CENTER , "\U000F0F62");
        } else if (id(moon_icon).state == "waning_gibbous") {
          it.printf(25, 42, id(weather_font_45), TextAlign::BASELINE_CENTER , "\U000F0F68");
        } else if (id(moon_icon).state == "last_quarter") {
          it.printf(25, 42, id(weather_font_45), TextAlign::BASELINE_CENTER , "\U000F0F63");
        } else if (id(moon_icon).state == "waning_crescent") {
          it.printf(25, 42, id(weather_font_45), TextAlign::BASELINE_CENTER , "\U000F0F65");
        } else {
          it.printf(64, 98, id(weather_font_45), TextAlign::BASELINE_CENTER , "\U000F199F");
        }
      }     

      //sun set-rise
      it.printf(85, 22, id(sun_icon_font), TextAlign::BASELINE_RIGHT, "\U000F059C");
      it.printf(135, 22, id(size_20_font), TextAlign::BASELINE_RIGHT, "%s", id(sunset).state.c_str());
      it.printf(85, 44, id(sun_icon_font), TextAlign::BASELINE_RIGHT, "\U000F059B");
      it.printf(135, 44, id(size_20_font), TextAlign::BASELINE_RIGHT, "%s", id(sunrise).state.c_str());

      //date
      it.strftime(210, 43, id(size_50_font), TextAlign::BASELINE_RIGHT, "%d", id(sntp_time).now());
      it.printf(213, 43, id(size_14_font), TextAlign::BASELINE_LEFT, "D");
      it.strftime(280, 43, id(size_50_font), TextAlign::BASELINE_RIGHT, "%m", id(sntp_time).now());
      it.printf(283, 43, id(size_14_font), TextAlign::BASELINE_LEFT, "M");

      //line
      it.line(0, 54, 296, 54);

      //Time
      it.strftime(20, 45, id(size_85_font), "%H:%M", id(sntp_time).now());
      /* it.strftime(225, 68, id(size_60_font), "%S", id(sntp_time).now()); */

      it.strftime(250, 58, id(size_20_font), "%a", id(sntp_time).now());

      //wifi
      if (id(wifisignal).has_state()) {
        x = 265, y = 120;         
        if (id(wifisignal).state >= -50) {
          it.printf(x, y, id(wlan_icon_font), TextAlign::BASELINE_CENTER , "\U000F0928");
        } else if (id(wifisignal).state >= -60) {
          it.printf(x, y, id(wlan_icon_font), TextAlign::BASELINE_CENTER , "\U000F0925");
        } else if (id(wifisignal).state >= -67) {
          it.printf(x, y, id(wlan_icon_font), TextAlign::BASELINE_CENTER , "\U000F0922");
        } else if (id(wifisignal).state >= -70) {
          it.printf(x, y, id(wlan_icon_font), TextAlign::BASELINE_CENTER , "\U000F0920");                    
        } else {
          it.printf(x, y, id(wlan_icon_font), TextAlign::BASELINE_CENTER , "\U000F092E");            
        }
      }

text_sensor:
  - platform: homeassistant
    entity_id: sensor.openweathermap_forecast_condition
    id: forecast_condition
    internal: true
  - platform: homeassistant
    entity_id: sensor.openweathermap_forecast_precipitation
    id: forecast_precipitation
    internal: true
  - platform: homeassistant
    entity_id: sensor.moon_phase
    id: moon_icon
  - platform: homeassistant
    id: sunrise
    entity_id: sensor.sonnenaufgang
  - platform: homeassistant
    id: sunset
    entity_id: sensor.sonnenuntergang

time:
  - platform: sntp
    timezone: Europe/Zurich
    id: sntp_time 

sensor:
  - platform: homeassistant
    entity_id: sensor.openweathermap_forecast_temperature
    id: forecast_temperature
    internal: true
  - platform: homeassistant
    entity_id: sensor.zurich_kloten_dew_point
    id: forecast_temperature_low
    internal: true
  - platform: homeassistant
    entity_id: sensor.openweathermap_forecast_wind_speed
    id: forecast_wind_speed
    internal: true
  - platform: homeassistant
    entity_id: sensor.0xa4c13870d71f2d18_temperature
    id: bedroom
    internal: true
  - platform: homeassistant
    entity_id: sensor.0xa4c138e3fdf5f483_temperature
    id: office
    internal: true
  - platform: homeassistant
    entity_id: sensor.0xa4c1384a262efff1_temperature
    id: living_room
    internal: true
  - platform: homeassistant
    entity_id: sensor.0xa4c1382ae3bae706_temperature
    id: kitchen
    internal: true
  - platform: homeassistant
    entity_id: sensor.0xa4c138d4da5b73ad_temperature
    id: outside_temp
    internal: true
  - platform: homeassistant
    entity_id: sensor.durchschnitt_temp
    id: inside_temp
    internal: true
  - platform: homeassistant
    entity_id: sensor.0xa4c138d4da5b73ad_humidity
    id: outside_humidity
    internal: true
  - platform: homeassistant
    entity_id: sensor.0xa4c1382ae3bae706_humidity
    id: inside_humidity
    internal: true
  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    id: "wifisignal"
    update_interval: 15s    
alinelena commented 1 year ago

@swiss01 I had some go at it https://github.com/esphome/esphome/pull/4579

is not 100% finished I want to triple check some update modes but works much better than 2.9inV2 if you want to test my version use model

model: "2.90inBS"                                                                                                               
swiss01 commented 1 year ago

Oh great. Unfortunately it works worse than 2.9niV2 when updating, the display fades and then becomes sharp again. in general, there are fewer artifacts, but the update behavior is very annoying. Have attached a gif.

If you have a new version, I'll be happy to test it.

Unbenanntes Video – Mit Clipchamp erstellt

alinelena commented 1 year ago

your update rate is too high. increase it the fading is from the update i will need to check the exact params for update mode.

alinelena commented 1 year ago

just a note... esphome does not really support partial updates... it supports the mechanics of them... pushing the right instructions but the area which is updated is always the full screen. so having fast update rates is not healthy for the screen

alinelena commented 1 year ago

@swiss01 try the latest bc14ef04b8c9bdd7595752ac33581bed54d9e204 in my testing seem to behave properly... please note my note above

alinelena commented 1 year ago

pull request https://github.com/esphome/esphome/pull/4579 addressing the issue

swiss01 commented 1 year ago

I set the update rate to 10s.

I have now tested it extensively. I'm not sure where the error is buried but. with the use of an ESP8266 it works very well. when changing the whole display flickers very little. So the background is slightly darker for a moment.

I have more problems with my ESP32. I've attached 3 displays. The problems are very diverse. Partly I think it's because of the wiring, but then again because of my YAML file and then again because of the library.

The errors that appear.

For a long time I thought it was down to the planning. Then connect them all in series. Sometimes the last display has problems, sometimes the middle one, sometimes the first. IMG_20230319_172254 IMG_20230319_172014 IMG_20230319_173054

swiss01 commented 1 year ago

ok now i got the three display to work. I have divided the displays on two SPI buses. The library works well so far, except for the slight flickering when updating. But I don't know if this is normal or if there is still a bug in the library.

alinelena commented 1 year ago

i do not think daisy chaining is supported in esphome, using different cs pins and share the rest shall work. now the update change of intensity at a partial update i do not know if is normal or not I see it myself too... but is not annoying enough to look more into it.

alinelena commented 1 year ago

for reference this is my example code for 2.9 https://gitlab.com/48broadbent/broadbent/-/blob/develop/jupiter.yaml and this for 2.13 https://gitlab.com/48broadbent/broadbent/-/blob/develop/smallbedroom.yaml

swiss01 commented 1 year ago

i do not think daisy chaining is supported in esphome, using different cs pins and share the rest shall work. now the update change of intensity at a partial update i do not know if is normal or not I see it myself too... but is not annoying enough to look more into it.

I did that too. CS separately on the EPS and the other cables are bridged together. I simply used the two terminals on the Weact as a bridge. I had previously wired it through a breadboard. but wasn't better. and a pure cable salad. With two SPI it works fine.

swiss01 commented 1 year ago

how long do you think it's going to be in an official version?

deltamelter commented 5 months ago

Would it be too much to expect support for 3 colour 2.9" ? Or is this likely to just work once the weact panels are supported?

regystro commented 5 months ago

Would it be too much to expect support for 3 colour 2.9" ? Or is this likely to just work once the weact panels are supported?

There's a pull request already working. https://github.com/esphome/esphome/pull/6226 See an example: https://github.com/esphome/feature-requests/issues/2191#issuecomment-2006760975

deltamelter commented 5 months ago

There's a pull request already working. esphome/esphome#6226 See an example: #2191 (comment)

That's great news. what do I need to replace to try this out? I currently use esphome as a HA plugin.

regystro commented 5 months ago

That's great news. what do I need to replace to try this out? I currently use esphome as a HA plugin.

Just add:

external_components:
  - source: github://pr#6226
    components: [waveshare_epaper]
deltamelter commented 5 months ago

Thanks but I also need to add SPI, CS, DC, RESET an BUSY PINS? I tried to add the same pins as worked with arduino sample but it just boot loops. Any ideas? I threw this together from bit of information from these threads.

GxEPD2_DISPLAY_CLASS<GxEPD2_DRIVER_CLASS, MAX_HEIGHT(GxEPD2_DRIVER_CLASS)> display(GxEPD2_DRIVER_CLASS(/*CS=D8*/ EPD_CS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));
esp8266:
  board: esp_wroom_02

sensor:
  - platform: uptime
    name: Uptime Sensor  
    id: uptime_text
spi:
  clk_pin: GPIO14
  mosi_pin: GPIO13

external_components:
  - source: github://pr#6226
    components: [waveshare_epaper]
font:
  - file: 'Roboto-Regular.ttf'
    id: roboto
    size: 24    
color:
  - id: red
    hex: "FF0000"
  - id: black
    hex: "FFFFFF"
display:
  - id: screen
    platform: waveshare_epaper
    model: 2.90in3c
    cs_pin: GPIO15
    dc_pin: GPIO00
    reset_pin: GPIO02
    reset_duration: 2ms
    busy_pin: GPIO04
    rotation: 90
    update_interval: 300s # 5m    
    lambda: !lambda |-
      it.print(0, 4, id(roboto), id(red), "ESPHome ePaper");
      it.print(220, 1, id(roboto), id(red), "E");
      it.print(235, 0, id(roboto), id(black), "E");
      it.printf(10, 60, id(roboto), "uptime: %d",id(uptime_text).state);
regystro commented 5 months ago

Yep, you'll need those too. This is my working YAML, but I'm using a different board: esp32dev

spi:
  clk_pin: GPIO18   # aka SCL
  mosi_pin: GPIO23  # aka SDA

display:
  - platform: waveshare_epaper
    model: 2.90in3c
    cs_pin: GPIO17
    dc_pin: GPIO22
    reset_pin: GPIO19
    busy_pin: GPIO21

I suggest you double check the pins are the right ones based on your board, enable ESPHome debug level and have a look at some ESPHome tutorials and FAQs for troubleshooting.

alinelena commented 4 months ago

have a look in here https://github.com/esphome/feature-requests/issues/2191 also check the pr number....

deltamelter commented 4 months ago

PIN config looks correct (same as working arduino pin config) Screenshot 2024-03-25 183935 The log shows the following boot loop exception:

[I][logger:034]: Log initialized
[C][ota:483]: There have been 9 suspected unsuccessful boot attempts.
[I][app:029]: Running through setup()...
[D][spi:039]: Setting up SPI bus...
[D][spi_device:379]: mode 0, data_rate 2000kHz

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Exception (9):
epc1=0x40229002 epc2=0000000 epc3=0x00000000 excvaddr=0x3ffe8eba depc=0x00000000

>>>stack>>>

ctx: cont
sp: 3ffffd80 end: 3fffffd0 offset: 0190
3fffff10:  3ffe8eb9 3fff2250 3fff21fc 402307c5
3fffff20:  001e8401 00000001 00000000 00000004
3fffff30:  3ffe8eb9 3fff2250 3fff21fc 402173a4
3fffff40:  402172e5 3fff21 3ff21fc 3fff2028
3fffff50:  3fff21fc 00000004 3fff21fc 40217731
3fffff60:  00000000 3fff2328 3fff21fc 4021d03a
3fffff70:  3fff2094 00000003 3fff0224 4021c9d9
3fffff0:  0000000b 0000000b 3fff22cc feefeffe
3fffff90: 00▒▒▒▒2▒▒21c 00000001 feefeffe
3fffffa0:  feefeffe feefeffe feefeffe 3fff062c
3fffffb0:  3fffdad0 00000000 3fff0618 4022ce38
3fffffc0:  feefeffe feefeffe 3ffe8610 40100459
<<<stack<<<

--------------- CTERE FOR EXCEPTION DECODER ---------------

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3460, room 16
tail 4
chksum 0xcc
load 0x3fff20b8, len 40, room 4
tail 4
chksum 0xc9
csum 0xc9
v0007df90
~ld
[I][logger:034]: Log initialized
[C][ota:483]: There have been 10 suspected unsuccessful boot attempts.
[E][ota:490]: Boot loop detected. Proceeding to safe mode.
[E][ota:159]: Error set: unspecified
[I][app:029]: Running through setup()...
[C][wifi:038]: Setting up WiFi...
[C][wifi:051]: Starting WiFi...

Re-compiled the original arduino sample and it still works using the same pins and config.

#define PIN_SPI_SS   (15)     /*CS=D8*/ EPD_CS
#define PIN_SPI_MOSI (13)
#define PIN_SPI_SCK  (14)
/*DC=D3*/ 0
/*RST=D4*/ 2
/*BUSY=D2*/ 4

esphome version: 2024.3.0

alinelena commented 4 months ago

can you remove this.

    reset_duration: 2ms
deltamelter commented 4 months ago

Same result, goes straight into boot loop...

Showing logs:
[22:04:57][I][logger:034]: Log initialized
[22:04:57][C][ota:483]: There have been 0 suspected unsuccessful boot attempts.
[22:04:57][I][app:029]: Running through setup()...
[22:04:57][D][spi:039]: Setting up SPI bus...
[22:04:57][D][spi_device:379]: mode 0, data_rate 2000kHz
[22:04:58]
[22:04:58]-------------- CUT HERE FOR ECEPTION DECODER ---------------
[22:04:58]
[22:04:58]Exception (9):
[22:04:58]epc1=0x40228ffa epc2=0x00000000 epc3=0x00000000 excvaddr=0x3ffe8eba depc=0x00000000
[22:04:58]
[22:04:58]>>>stack>>>
[22:04:58]
[22:04:58]ctx: cont
[22:04:58]sp: 3ffffd80 end: 3fffffd0 offset: 0190
[22:04:58]3fffff10:  3ffe8eb9 3fff2250 3fff21fc 40207bd  
[22:04:58]3fffff20:  001e8401 00000001 00000000 00000004  
[22:04:58]3fffff30:  3ffe8eb9 3fff2250 3fff21fc 402173a4  
[22:04:58]3fffff40:  402172e5 3fff21fc 3fff21fc 3fff2028  
[22:04:58]3fffff50:  3fff21fc 00000004 3fff21fc 40217731  
[22:04:58]3fffff60:  00000000 3fff2328 3fff21fc 4021d03a  
[22:04:58]3fffff70:  3fff2094 00000003 3fff0224 4021c9d9  
[22:04:58]3fffff80:  0000000b 0000000b 3fff22cc feefeffe  
[22:04:58]3fffff90:  00000014 3fff21fc 00000001 feefeffe  
[22:04:58]3ffffa0:  feefeffe feefeffe feefeffe 3fff062c  
[22:04:58]3fffffb0:  3fffdd0 00000000 3fff0618 4022ce30  
[22:04:58]3ffffc0:  feefeffe feefeffe 3ffe8610 40100459  
[22:04:58]<<<stack<<<
[22:04:58]
deltamelter commented 4 months ago

What is the clk_pin defaulting to? I looking in the files changed for the pull and it mentions setting all of the pins from provided config except for clk, so wondered if that was "hardcoded" to something that others just happen to be using? any other ideas what might cause the boot loop?

alinelena commented 4 months ago

can you check the size of the firmware vs whatever is available on the mcu... unfortunately I do not have access to wroom_2

deltamelter commented 4 months ago

The firmware is smaller than one that I successfully wrote to the same device, same config, except the EPD config. Tried as regular ESP8266 and same issue.

[14:12:34][C][logger:166]: Logger:
[14:12:34][C][logger:167]:   Level: DEBUG
[14:12:34][C][logger:169]:   Log Baud Rate: 115200
[14:12:34][C][logger:170]:   Hardware UART: UART0
[14:12:34][C][spi:068]: SPI bus:
[14:12:34][C][spi:069]:   CLK Pin: GPIO14
[14:12:34][C][spi:070]:   SDI Pin: 
[14:12:34][C][spi:071]:   SDO Pin: GPIO13
[14:12:34][C][spi:076]:   Using HW SPI: SPI
[14:12:34][C][uptime.sensor:031]: Uptime Sensor 'Uptime Sensor'
[14:12:34][C][uptime.sensor:031]:   Device Class: 'duration'
[14:12:34][C][uptime.sensor:031]:   State Class: 'total_increasing'
[14:12:34][C][uptime.sensor:031]:   Unit of Measurement: 's'
[14:12:34][C][uptime.sensor:031]:   Accuracy Decimals: 0
[14:12:34][C][uptime.sensor:031]:   Icon: 'mdi:timer-outline'

no issue with this, except obviously no display....

The device doesn't have an SDcard or anything so don't think there is an issue with sharing pins like I read about here.

alinelena commented 4 months ago

add the miso pin even if not used...

alinelena commented 4 months ago

ESP8266 I am sure will not have enough memory do you have by any chance an esp32 or something else to try?

deltamelter commented 4 months ago

ESP8266 I am sure will not have enough memory do you have by any chance an esp32 or something else to try?

only some esp32-cam modules with sdcard and camera, will need to work out which pins are free.
They use a lot of power and run hot even when idle but does seem to run without the EPD connected.

I'm waiting on some esp32 versions of these battery boards, the idea is to use them as deep-sleeping devices that only update the panel once or twice a day.

alinelena commented 4 months ago

it is just for a test, so shall not matter. personally I am using this https://www.aliexpress.com/item/1005004960064227.html but I am not using batteries... https://gitlab.com/m-lego/sensor rev1 working on rev2

deltamelter commented 4 months ago

Not many free pins on the esp32-cam and with the camera "flash" led tied to gpio04, the room lit up every time the panel was update, but it updated without problems. I only had to change 1 pin (DC->gpio00 to gpio12) I think the esp-wroom-02 must be conflicting pin usage, I will try to find an alternative while I wait for ESP32 boards. The GPIO16 is soldered/connected to GND for deep sleep to be able to wake. I wonder if this might cause some problems?

btw, is there already something to work with model: 2.13in3c?

alinelena commented 4 months ago

btw, is there already something to work with model: 2.13in3c?

yes, unfortunately there is mess in the sense someone opened another similar feature request #2191 and info is scattered now...

now I will try to summarise, for the 3 sizes we act has and colour i have.:

   221 display:                                                                                                                            
   222   - platform: waveshare_epaper                                                                                                      
...
   225     model: "2.13inv3" 

[1]image

[2] image

[3] image

[4] image

[5] image

[6] image

deltamelter commented 4 months ago

Is it specific to this panel that it pushes an update as soon as the display initialises? Always starts up before the other sensors have been set leaving nan and "placeholder" values, then after first subsequent update, the panel shows actual data. I don't want to waste this cycle. How can the initial update be triggered only when data is present?

alinelena commented 4 months ago

Is it specific to this panel that it pushes an update as soon as the display initialises? Always starts up before the other sensors have been set leaving nan and "placeholder" values, then after first subsequent update, the panel shows actual data. I don't want to waste this cycle. How can the initial update be triggered only when data is present?

depends. always you can use some interval, i sugges to join esphome discord and ask for help in there about this.