iantrich/list-card

Using templates

viktak opened this issue · 2 comments

Hi,
I was wondering if it is possible to use templates for the columns.

I have a date/time column and looks very ugly:
Screenshot 2021-02-10 135232

I don't need the whole time field, just the time. I tried to use a kinja2 template, but it didn't render anything:

{{ strptime("2021-02-10 08:37:59+02:00", "%X") }}

If templates are not usable, any other idea how to do it would be most welcome.

No, use configure-template-card for that

ok, thanks for letting me know about that card. But can it deal with lists, like this one? If yes, would you mind posting a small example?

I tried this:

  - type: custom:config-template-card
    entities:
      - sensor.earthquakes
    card:
      type: custom:list-card
      entity: sensor.earthquakes
      feed_attribute: earthquakes
      columns:
        - title: "Time"
          field: '${now()}'
        - title: "Magnitude"
          field: magnitude
        - title: "Distance"
          field: distance
          postfix: km
        - title: "Title"
          field: title
          add_link: link

If in place of field: '${now()}' I put field: time, it works exactly like the list-card.