esphome / feature-requests

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

Component Request for Watchy eink display - Good Display GDEH0154D67 #2377

Open rspilk opened 10 months ago

rspilk commented 10 months ago

Describe the problem you have/What new integration you would like

I would like to be able to use the GDEH0154D67 eink display (here and here) with esphome in order to add esphome functionality to the Watchy project.

Please describe your use case for this integration and alternatives you've tried:

There is support in the waveshare epaper component for the Good Display gdew0154m09 https://esphome.io/components/display/waveshare_epaper.html

This module does not display correctly on the watchy. It will load and the display will not update. Attempting to use:

display:
  - platform: waveshare_epaper
    cs_pin: GPIO5
    dc_pin: GPIO10
    busy_pin: GPIO19
    reset_pin: GPIO9
    model: 1.54in-m5coreink-m09
    #full_update_every: 30
    lambda: |-
      it.print(0, 0, id(font1), "Hello World!");

(GPIO Pins are from the watchy Hardware doc and work with the sample code for the GDEH0154D67 from Good Display)

Logs will return on repeat with no update to the screen: [15:21:09][E][waveshare_epaper:120]: Timeout while displaying image! [15:21:11][E][waveshare_epaper:120]: Timeout while displaying image! [15:21:12][E][waveshare_epaper:120]: Timeout while displaying image! [15:21:13][W][component:204]: Component waveshare_epaper.display took a long time for an operation (4.36 s). [15:21:13][W][component:205]: Components should block for at most 20-30ms.

Additional context

This component has support with the sample code for ESP32 Here and displays a sample image correctly on the Watchy.

The library GxEPD also has support for both displays (and many others)

robin-thoni commented 6 months ago

I'm also trying to run esphome on the Watchy. The 1.54inv2 model works for the Watchy display too :)

20240101_145415

Here's a very basic version:

web_server:

spi:
  clk_pin: GPIO18
  mosi_pin: GPIO23

binary_sensor:
  - platform: gpio
    id: btn1
    name: BTN 1
    pin: GPIO26
  - platform: gpio
    id: btn2
    name: BTN 2
    pin: GPIO25
  - platform: gpio
    id: btn3
    name: BTN 3
    pin: GPIO35
  - platform: gpio
    id: btn4
    name: BTN 4
    pin: GPIO4

sensor:
  - platform: adc
    id: battery_raw
    name: "Battery Voltage"
    pin: GPIO34
    attenuation: auto
    update_interval: 5s
    device_class: VOLTAGE
    accuracy_decimals: 2
    filters:
      - multiply: 2.0 # From Watchy.cpp:687 Battery voltage goes through a 1/2 divider.
    on_value: 
      then:
        - component.update: battery_percentage
  - platform: template
    id: battery_percentage
    name: "Battery Percentage"
    lambda: |-
      const int battery_max_voltage = 410; // Fully charged battery is read as ~4.10 V
      const int esp_min_voltage = 330; // Minimum voltage for the Watchy to run is 3.3 V (guessed value, to be checked?)
      return max(0, min(int((int(id(battery_raw).state * 100) - esp_min_voltage) * 100 / (battery_max_voltage - esp_min_voltage)), 100));
    update_interval: never
    device_class: BATTERY
    accuracy_decimals: 0

font:
  - file: 'fonts/DejaVuSans.ttf'
    id: font1
    size: 25

display:
  - platform: waveshare_epaper
    cs_pin: GPIO5
    reset_pin: GPIO9
    dc_pin: GPIO10
    busy_pin: GPIO19
    model: 1.54inv2
    full_update_every: 30
    update_interval: 30s
    lambda: |-
      it.print(10, 60, id(font1), "Hello World!");
      it.print(10, 100, id(font1), "From ESPHome!");