TTGO T4 Display - get data from Home Assistant

Hi!

I sucessfully installed ESPhome on a ESP32-based TTGO T4 with a ili9341 display. I am also able to display static text, so the display works:

font: 
  - file: "fonts/consola.ttf"
    id: consola_big
    size: 24

spi:
  clk_pin: 18
  miso_pin: 12
  mosi_pin: 23

display:
  - platform: ili9341
    model: TFT_2.4
    cs_pin: 27
    dc_pin: 32
    led_pin: 04  ### see note below ###
    reset_pin: 05

    lambda: |-
      it.fill(COLOR_BLACK);
      it.print(0, 10, id(consola_big), COLOR_WHITE, "Hello World!");

So far so good! But I do not understand, how to display a entitys value from home assistant. I do have for example a shelly 1pm and want to display the current power. The entity-id in ha is “sensor.shelly_1pm_solar_power”. But how do I get this data to the ESPhome? I want to print it like this:

it.printf(0, 30, id(consola_big), "Solar Power: %s", id(sensor.shelly_1pm_solar_power).state.c_str());

Could you help me?

Best regards

Pascal

You need to import the sensor from Home Assistant to the ESP.

1 Like

An example Time & Temperature on OLED Display — ESPHome

1 Like

Thank you. I actually missed that sensor… And thank you for the example.