I started working on GUI component for ESPHome some time ago and I finally got it to state in which it can be shared Project is hosted on GitHub: https://github.com/lukasz-tuz/esphome-gui.
This component uses a slightly modified ESPHomeās Display component to enable LVGL as library that renders GUI widgets - instead of built-in rendering engine. No 3rd party SPI drivers are needed, everything should work on ESPHomeās own display components.
GUI is defined and configured in YAML. Hereās an example of simple clock built on LiliyGO T-Embed board:
Lvgl itself doesnāt implement communication with a display or its controller, it always needs a driver. Here, all of the drivers available in ESPHome should work. Iāve only used it with st77889v so far, though.
It should be easy enough to integrate it with TFT_eSPI library, like esphome-lvgl does.
Chicken/Egg Problem (i think you can reproduce the problem, if you clean the builds and delete the already downloaded component):
Step 0:
No lv_conf.h exists at all. (component was not downloaded yet)
Compiling with the include statement does not work.
compile it without an include statement, so that the component is downloaded.
In file included from /data/ha-touchscreen02/.piolibdeps/ha-touchscreen02/lvgl/src/misc/lv_log.h:16,
from /data/ha-touchscreen02/.piolibdeps/ha-touchscreen02/lvgl/lvgl.h:24,
from src/esphome/components/gui/gui_objects.h:4,
from src/esphome.h:22,
from src/esphome/components/gui/gui.h:3,
from src/esphome/components/gui/gui.cpp:1:
/data/ha-touchscreen02/.piolibdeps/ha-touchscreen02/lvgl/src/misc/../lv_conf_internal.h:35:42: fatal error: ../../../src/lv_conf.h: No such file or directory
#include __LV_TO_STR(LV_CONF_PATH)
^
compilation terminated.
*** [/data/ha-touchscreen02/.pioenvs/ha-touchscreen02/src/esphome/components/gui/gui.cpp.o] Error 1
In file included from /data/ha-touchscreen02/.piolibdeps/ha-touchscreen02/lvgl/src/misc/lv_log.h:16,
from /data/ha-touchscreen02/.piolibdeps/ha-touchscreen02/lvgl/lvgl.h:24,
from src/esphome/components/gui/gui.h:4,
from src/esphome.h:21,
from src/esphome/components/gui/gui_objects.h:3,
from src/esphome/components/gui/gui_objects.cpp:1:
/data/ha-touchscreen02/.piolibdeps/ha-touchscreen02/lvgl/src/misc/../lv_conf_internal.h:35:42: fatal error: ../../../src/lv_conf.h: No such file or directory
#include __LV_TO_STR(LV_CONF_PATH)
^
compilation terminated.
*** [/data/ha-touchscreen02/.pioenvs/ha-touchscreen02/src/esphome/components/gui/gui_objects.cpp.o] Error 1
Although I think I have deleted all the old downloads within HA, I still get the following error message.
Compiling /data/ha-touchscreen02/.pioenvs/ha-touchscreen02/src/esphome/components/gui/gui_objects.cpp.o
Compiling /data/ha-touchscreen02/.pioenvs/ha-touchscreen02/src/esphome/components/ili9xxx/ili9xxx_display.cpp.o
In file included from /data/ha-touchscreen02/.piolibdeps/ha-touchscreen02/lvgl/src/misc/lv_log.h:16,
from /data/ha-touchscreen02/.piolibdeps/ha-touchscreen02/lvgl/lvgl.h:24,
from src/esphome/components/gui/gui_objects.h:4,
from src/esphome.h:22,
from src/esphome/components/gui/gui.h:3,
from src/esphome/components/gui/gui.cpp:1:
/data/ha-touchscreen02/.piolibdeps/ha-touchscreen02/lvgl/src/misc/../lv_conf_internal.h:35:42: fatal error: ../../../src/lv_conf.h: No such file or directory
#include __LV_TO_STR(LV_CONF_PATH)
^
compilation terminated.
*** [/data/ha-touchscreen02/.pioenvs/ha-touchscreen02/src/esphome/components/gui/gui.cpp.o] Error 1
In file included from /data/ha-touchscreen02/.piolibdeps/ha-touchscreen02/lvgl/src/misc/lv_log.h:16,
from /data/ha-touchscreen02/.piolibdeps/ha-touchscreen02/lvgl/lvgl.h:24,
from src/esphome/components/gui/gui.h:4,
from src/esphome.h:21,
from src/esphome/components/gui/gui_objects.h:3,
from src/esphome/components/gui/gui_objects.cpp:1:
/data/ha-touchscreen02/.piolibdeps/ha-touchscreen02/lvgl/src/misc/../lv_conf_internal.h:35:42: fatal error: ../../../src/lv_conf.h: No such file or directory
#include __LV_TO_STR(LV_CONF_PATH)
^
compilation terminated.
*** [/data/ha-touchscreen02/.pioenvs/ha-touchscreen02/src/esphome/components/gui/gui_objects.cpp.o] Error 1
I have also tried it outside HA: esphome compile ha-touchscreen02.yaml
here I get the following error message:
Compiling .pioenvs/ha-touchscreen02/FrameworkArduino/wiring_shift.c.o
Archiving .pioenvs/ha-touchscreen02/libFrameworkArduino.a
Indexing .pioenvs/ha-touchscreen02/libFrameworkArduino.a
Linking .pioenvs/ha-touchscreen02/firmware.elf
/home/sven/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/ha-touchscreen02/src/esphome/components/ili9xxx/ili9xxx_display.cpp.o:(.rodata._ZTVN7esphome7ili9xxx13ILI9XXXST7796E[vtable for esphome::ili9xxx::ILI9XXXST7796]+0x6c): undefined reference to `esphome::display::DisplayBuffer::write_display_data()'
collect2: error: ld returned 1 exit status
*** [.pioenvs/ha-touchscreen02/firmware.elf] Error 1
Thanks for checking this!
Inside HA, I donāt get it. Something is wrong with paths and where files end up. Iām going to have to check it inside my HA setup.
Outside HA, problem is that implementation of individual display drivers is not consistent. While st7789v that Iāve been using for development implements write_display_data() method, Iām guessing that ili9xxx does not. Supporting more than one display device is something Iām definitely going to have to work on.
Hi, thank you for the hintā¦ Unfortunately esphome doesnāt support the display and also ArduinoGFX is not supported by esphome. It seems that you can add Arduino libraryās but this is something which I have never did. So in the end I will give up, due my small amount of time. Hopefully the display IC get esphome support soon.
Glad I found this! Two questions; one for @DerekSN : I have the same display but connected to an early ESP32 that has no param. Therefore the display buffer allocation always fails. Do you know if thereās a way to disable the buffer and write directly to the display?
And for @lukasz-tuz , you mentioned that LVGL requires a display driver ā when used with the esphome display driver, at what level does it hook up? Any way I can get around not having enough ram?
EDIT: I see that in the Component, LVGL operates on a buffer, so Iām not getting out of that.
I know the display has examples using LVGL and zero psram, so it must at least be possible. The only question is whether I can do it in esphome (which is really key for me.)
I just discovered that the new LVGL Graphics ā ESPHome component () has a buffer_size option specifically for this kind of situation, when there is little or no PSRAM. That might be my way out.
Following the use of the new esphome-lvgl component, I no longer get out-of-memory errors. However, ili9341 still doesnāt seem to respond.
I noticed that your config specifies cs_pin in addition to dc_pin. Do you know if thatās a requirement? I have this device, and I cannot for the life of me figure out what the dc_pin is.
Maybe itās not that, but itās odd that thereās no error AND no response from the screen, even though the LVGL logs show updates every second.
UPDATE: I found the CS pin on an obscure site, (pin 15), but the screen is still blank