I am something of a newb in the world of Home Assistant, ESPHome and ePaper displays. I thought it might be useful to share my experiences, since my project is now running nicely and doing what I wanted it to do.
The display in question is the LILYGO® TTGO T5 V2.2 ESP32 2.9" EPaper. There is information about the exact model at http://www.lilygo.cn/prod_view.aspx?TypeId=50031&Id=1146 which is of some use, but please note that the Pin Reference Description seems to be largely erroneous. If you are thinking of using the ESP 32 on board for an additional purpose, such as a temperature sensor, and need to know the GPIO pin numbers, you would be advised to consult the schematic at https://github.com/lewisxhe/TTGO-EPaper-Series/blob/3dcb6469715021d1a3c168ad67025b8128af692d/schematic/T5_V2.2.pdf
My starting point was the very helpful description of the Waveshare epaper display at https://esphome.io/components/display/waveshare_epaper.html. As a newb I was puzzled by the mention of 4-wire SPI, and I spent some time trying to find out whether the GPIO pins on my model were the same. It could be that this does not matter, because the pins are assigned by the code, but I inferred that on my device the CLK pin was 18 and the MOSI 23. This seems to work perfectly well for me.
The next question was which ESP32 borad to select when setting up the ESPHome yaml. I have tried both the esp32dev and the ttgo-t1 and they both worked perfectly well.
I set up the yaml with a basic display, with a lot of excellent help from https://esphome.io/components/display/index.html, uploaded it, and had a good OTA set-up. The main challenge for me was to use states from Home Assistant which were strings rather than values. Initially I went down the MQTT route (see https://esphome.io/components/text_sensor/mqtt_subscribe.html), and created an automation in Home Asssistant to publish to MQTT. This worked, but it was laborious and seemed to work against the principles of ESPHome! My son pointed out that in fact it is simple: use the Home Assistant API and then platform: homeassistant within the relevant text sensor statement. This is much cleaner and neater.
My project was to build a display which would give basic weather data plus indoor temperature. My ESPHome code is as follows:
esphome: name: epaper2 platform: ESP32 board: esp32dev wifi: ssid: "MY_SSID" password: "MY PASSWORD" # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "Epaper2 Fallback Hotspot" password: "xxxxxxxxxx" captive_portal: # Enable logging logger: # Enable Home Assistant API api: password: "PASSWORD" ota: password: "PASSWORD" spi: clk_pin: 18 mosi_pin: 23 font: - file: "Ldfcomicsans-jj7l.ttf" id: font_cs size: 20 - file: "arial_th.ttf" id: font_arth size: 16 sensor: - platform: homeassistant entity_id: sensor.sn1_temperature id: kit_temp - platform: homeassistant entity_id: sensor.weathermet_temperature id: out_temp - platform: homeassistant entity_id: sensor.weathermet_feels_like_temperature id: feels_like - platform: homeassistant entity_id: sensor.weathermet_wind_speed id: wind_speed - platform: homeassistant entity_id: sensor.weathermet_wind_gust id: wind_gust - platform: dht pin: 26 model: "DHT22" temperature: name: "ePaper Temperature" id: eptem humidity: name: "ePaper Humidity" id: ephu update_interval: 60s text_sensor: - platform: homeassistant entity_id: sensor.weathermet_wind_direction id: wind_dir display: - platform: waveshare_epaper cs_pin: 5 dc_pin: 19 busy_pin: 4 reset_pin: 12 model: 2.90in full_update_every: 180 rotation: 270 lambda: |- it.print(0, 0, id(font_cs), "Conditions:"); it.printf(0, 42, id(font_arth), "Inside:"); it.printf(55, 40, id(font_cs), "%.1fc", id(eptem).state); it.printf(120, 42, id(font_arth), "Outside:"); it.printf(170, 40, id(font_cs), "%.1fc", id(out_temp).state); it.printf(120, 68, id(font_arth), "feels like:"); it.printf(178, 68, id(font_arth), "%.1fc", id(feels_like).state); it.printf(0, 102, id(font_arth), "Wind kph:"); it.printf(75, 100, id(font_cs), "%.1f", id(wind_speed).state); it.printf(105, 100, id(font_arth), " - "); it.printf(118, 102, id(font_arth), "%.1f", id(wind_gust).state); it.printf(165, 100, id(font_cs), "%s", id(wind_dir).state.c_str());
You will see that I have also included a local temperature/humidity sensor, using the ESP 32. This is a simple DHT22 sensor, using pin 26 (which shows on the manufacturer’s description as IO13 for some reason).
Finally, I housed the display in a freeform stand which I made from thermoplastic and four screws. My only tip to pass on here is that I have found that it helps to put the thermosplastic in the freezer for 15 minutes or so before drilling holes. The drill bit works more cleanly if the material is as rigid as possible.
That’s it. I hope this can help other newbs like myself, and of course I am more than happy to listen to any suggestions for improvements.