Getting Lovelace to display secondary_info: last-changed as absolute datetime

Hi Home Assistant Pros,

I hope this question has a simple answer, unfortuantely I couln’t find anything in the documentation or the forums…

I want to display the last-changed State for a Sensor in die Lovelace UI. But I don’t like relative time. Is there any way to display secondary-info as datetime?

Currently I have a entities tile with this configuaration

type: entities
entities:
[...]
  - entity: binary_sensor.sensor_test_door_contact
    secondary_info: last-changed

here is the output:
image

I don’t like the “Vor 20 Stunden” (20hours ago) part. Would like to see a absoulte date e.g. 2021-09-14 08:24 .

1 Like

Did you ever found a solution to this?
I have the same question, but haven’t found a fix yet.

Two options:

  1. multiple-entity-row:
  - type: custom:multiple-entity-row
    entity: zone.home
    secondary_info:
      attribute: last-changed
      format: datetime

Bit this does not work now (bug).

  1. template-entity-row:
  - type: custom:template-entity-row
    entity: zone.home
    secondary: >-
      {{states[config.entity].last_changed}}
    state: >-
      {{ states(config.entity) }}

which gives this:
изображение
So, you need to convert this presentation into your desired format using jinjia.

Thats what I did… With a little fixing of multiple-entity-row…

Maybe I should make a PR for it. Its rather easy to also “look” into an entities “metadata” when resolving the value for secondary_info.
But unfortunately there were some changes in multiple-entity-row since Sept 2021. I’ll try to incorporate my changes into the latest version and check if it still works

Problems with formats for last-changed / last-updated in “multiple-entity-row” are very old.
It would be great if someone fixes it…

Thanks for the info.
Just started with Home Assistant (using Domoticz now), this is too ambitious for me for now.
Got a lot of tutorial reading to do.

I submitted a PR:

The changes are very simple, lets see if the maintainers accept it.

If you want to try it:
Save https://raw.githubusercontent.com/BenniG82/lovelace-multiple-entity-row/%23221_Possible_solution/multiple-entity-row.js as multiple-entity-row.js and override the original one.

Unfortunately I don’t have any experience with hacs, since I use HA in a docker container. So I don’t know if overriding the file is a problem or not with hacs.

I use the manual configuration via Settings → Dashboards → “…” → Resources.

This works fine and displays for example this output:
image

for this config

entity: binary_sensor.my_sensor
name: Main Door
type: custom:multiple-entity-row
secondary_info:
  attribute: last_changed
  format: datetime

Cheers Benjamin

Using HA in container too, installed HACS as an integration.

As far as I remember, Ben Tomlin added displaying "last-changed / last-updated" - but only formatting them does not work…