Entity last changed time on OLED display - wemos D1

Hi guys,
I am in process of building my own central heating system control device (cannot upgrade for newer installation as its rented house).
My goal is to use wemos D1 mini, OLED display (SSD1306) and few more components.
On the OLED display I would like to display current room temperature, which is passed into wemos from HA. This is fine as I can display and see it.
I would like to also display information, when was last changed time of the entity (in this case temperature sensor in HA) - (similar like you can see it on custom button card in HA), and this is the question: how in ESPhome I can get this value from HA, and then display it on OLED little display connected to wemos.
I am quite newbie in yaml or C++ but if I will get right direction, I hope I can get it done with little help.
Tried to find it through google, but with no success.

Thanks in advance for hinds and tips.

Create a template sensor in homeassistant.

The template will something like

{{ (states.sensor.room_temperature.last_changed) }}

Then use it via a homeassistant sensor in esphome, see

1 Like

Or create a sensor in ESPHome which does the same:

EDIT: As per @nickrout comment below - no you can’t (tested).

text_sensor:
  - platform: homeassistant
    entity_id: sensor.atmospheric_pressure_msl
    id: pressure

  - platform: homeassistant
    entity_id: sensor.atmospheric_pressure_msl
    id: pressure_lastchanged
    attribute: last_changed
`

Didn’t know you could get last_changed via esphome.

Actually it compiles but doesn’t populate. So maybe you can’t… :woozy_face: