thomasloven / lovelace-template-entity-row

🔹 Display whatever you want in an entities card row.
MIT License
210 stars 16 forks source link

How to add "secondary_info: last-changed"? #113

Closed flipdream closed 4 months ago

flipdream commented 10 months ago

Any option to add "secondary_info: last-changed" for a entity in with this card?

ildar170975 commented 10 months ago
    secondary: >-
      {{relative_time(states[config.entity].last_changed)}} ago
flipdream commented 10 months ago

Perfect, thanks ildar170975

ildar170975 commented 10 months ago

Close the issue then if solved

bcutter commented 4 months ago
    secondary: >-
      {{relative_time(states[config.entity].last_changed)}} ago

Unfortunately depending on your local language that's a bit more difficult. Here's a working example for German:

        secondary: >
          Vor {{ relative_time(states[config.entity].last_changed) | replace ('seconds','Sekunden') | replace ('minutes','Minuten') |
          replace ('hours','Stunden') | replace ('hour','Stunde') | replace
          ('days','Tagen') | replace ('day','Tag') | replace
          ('weeks','Wochen') }}
ildar170975 commented 4 months ago

"Templates engine" is provided by HA, and German users must be happy to have at least SOME localizations, and other humans may not be so lucky: image