Issue to display time on display!

Hi

I retrieve from my HA these sensors to get them avalaible for display in esphome on a e-ink display:

text_sensor:
  - platform: homeassistant
    entity_id: sensor.ligne_1_depart
    id: ligne_1_depart
    internal: true

But when I tyr to use it for display it doesn’t compile:

it.printf(25, 440, id(helvetica_25), TextAlign::TOP_LEFT, "%.0f", id(ligne_1_depart).state);

Tried also that but not really more success :frowning:

it.printf(25, 440, id(helvetica_25), TextAlign::TOP_LEFT, "%H:%M", id(ligne_1_depart).state);

Any ideas what’s wrong ? Thanks

Vincèn

No idea without the log.

As it is a text sensor, the state is a string, you need to convert it.

id(ligne_1_depart).state.c_str()

Yes, for a quick test just try printf with “%s” as the format like so:

it.printf(25, 440, id(helvetica_25), TextAlign::TOP_LEFT, "%s", id(ligne_1_depart).state.c_str);

If that doesn’t compile please provide the error message of the compile run.