Use ESP32 Cheap Yellow Display for home assistant data

I have one of the cheap 2.8inch LCD’s to “play” with.

Looking at the documentation, this appears to be supported, however, whilst I can see there are functions to display lines, and shapes, I’m looking to display simple gauges & bar graphs in the same way as you can do with the built in functions in Home Assistant.

Before I start fiddling with some code to draw images onto the screen to manually create a display, I was wondering if there are existing demos / libraries that can be added to ESP Home to do this for me, I have searched, but not found anything (no point in re-inventing the wheel)

Initially I’m only looking to do some basic things like showing the solar battery charge state, house load and PV generation.

One word: openhasp.

Obviously need to change the component to fit your display… And maybe you can then even do color…

The docs got you covered

The new LVGL code is great for stuff like this and super easy to use. It much more advanced then the older version of LVGL they are using at openHASP.

@andrew_NH lol we are chasing each other round the forum.

Thanks for the feedback, I tried OpenHASP, I can get some of what I want, but will still have to revert to drawing stuff, so I’ll give the LVGL 8 on ESPHome a bash as it seems easier than HASP (to me anyway - not wanting to start a flame war!)

I’ve bought one of these, a newer variant with 2 usb ports (a mini and usb c).

It works fine, and the example code here got me started:-

In particular, the esphome examples.

I do have one issue though. The display says its resolution is 320 x 240, and when laying out UI components on the screen, those coords seem to make sense, such as:-

it.strftime(50, 140, id(arimo96), "%H:%M", id(ha_time).now());

However, if I touch the corners of the screen, the esphome logs show coords that are much much higher, like 400 x 3500 for example.

What config do I need to make the coords match with the display coords. This is my touchscreen config:-

touchscreen:
  platform: xpt2046
  id: esp_touchscreen
  spi_id: spi_touch
  cs_pin: GPIO33
  interrupt_pin: GPIO36
  update_interval: 50ms
  threshold: 400
  calibration:
    x_min: 3860
    x_max: 280
    y_min: 340
    y_max: 3860
  transform:
    swap_xy: false

Which i copied from one of the esphome examples.
If it matters, I have my screen in landscape mode, with the display rotated 270:-

display:
  - platform: ili9xxx
    update_interval: 60s
    invert_colors: false
    id: esp_display
    # In some boards the model might be ILI9342 so change this if your board has two USB ports
    model: ILI9341
    spi_id: spi_tft
    cs_pin: GPIO15
    dc_pin: GPIO2
    # Remove rotation if your board used the ILI9341 LCD
    rotation: 270

Did you read the ESPHome documentation on touchscreens, in particular the calibration section?

Total esphome noob, and those instructions look exactly like what I need.