How to format a timedate sensor for display in e-ink

Hi all,

I'm trying to format a timedate text_sensor which comes from Home assistant (the start time for low electricity price) to display in a lambda function in an e-ink display. I don't manage to format the string correctly. This is the sensor i have created that receives the right timedate object:

  • platform: homeassistant
    entity_id: sensor.nord_pool_se3_lowest_price
    id: lowestPriceStart
    attribute: "start"
    device_class: timestamp
    internal: true

and the value it receives looks like this:

'sensor.nord_pool_se3_lowest_price::start': Got attribute state '2026-06-25T12:00:00+00:00'

But then I am not able to format it correctly to just display the hours and minutes. This is what I was trying:

it.printf(x+75, y+75, id(update_font), "%s", id(lowestPriceStart).state("%H%M"));

I have, of coursem the definition of the update_font before and I use the font for other text_sensors. I know it must be something with how I should format the text_sensor, but I don't seem to get it right. Any hints?

Thanks for any help!
/Nacho

You need to parse the string into a time structure.
If you take your question and paste it into ChatGPT you will get a reasonable answer which will serve as a starting point (but may not be completely accurate in which case come back here and ask further.)