How to access last_changed and show on display

In HA I have a state machine based on energy consumption. In HA I get the states, and can even see when they changed.
grafik

On my ESP I have a diaplay, that currently shows just the text of the state (like job_ongoing) how do I get the last_changed or _updated value into a text sensor? I want to know how long the current state lasts.

I played with it two days now, with no success and no usefull google results,…

Thanks for any help!

text_sensor:
  - platform: homeassistant
    id: waschmasch_text
    entity_id: input_select.washing_machine_state_machine
    internal: true
  - platform: homeassistant
    id: waschmasch_state
    entity_id: input_boolean.washing_machine_job_cycle
    attribute: last_changed
    internal: true

Your waschmasch_state approach and config is how I would have tried it.

How do the logs look for this?

Did you try creating a dedicated sensor for last changed in home assistant and then importing that?

Hi,

did explicit change the status to see if anyting arrives in the logs, but only the state attribute gets the update.

I also removed and added the device from esphome just to ensure it gets updated. no change.

Will try with creating a dedicated sensor for the attribute in HA and see what it gets.

[13:40:35][D][homeassistant.text_sensor:017]: 'input_boolean.washing_machine_job_cycle': Got state 'on'
[13:40:35][D][text_sensor:064]: 'waschmasch_text': Sending state 'on'
[13:40:57][D][homeassistant.text_sensor:017]: 'input_boolean.trockner_job_cycle': Got state 'off'
[13:40:57][D][text_sensor:064]: 'trockner_state': Sending state 'off'

[13:41:05][D][homeassistant.text_sensor:017]: 'input_boolean.trockner_job_cycle': Got state 'on'
[13:41:05][D][text_sensor:064]: 'trockner_state': Sending state 'on'

1 Like