thomasloven / lovelace-template-entity-row

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

Is it possible to dynamically show an icon as the `state` value (right side)? #88

Closed nickdos closed 1 year ago

nickdos commented 1 year ago

I'm configuring an entity card where I want the state part to show an icon via a template expression. The icon value is coming from an entity attribute.

  - type: custom:template-entity-row
    state: >-
      {% if  state_attr('sensor.recycling_collection', 'days') < state_attr('sensor.green_waste_collection', 'days') %}
      {{ state_attr('sensor.recycling_collection', 'icon') }} {% else %} {{ state_attr('sensor.green_waste_collection', 'icon') }} {% endif %}
    name: Next waste collection
    icon: mdi:trash-can
    active: '{{ state_attr(''sensor.garbage_collection'', ''days'') < 2 }}'
image

This is just showing the text value for the icon and not the actual icon. Is there a way to display the icon itself?

ildar170975 commented 1 year ago

Not possible with this card. Use multiple-entity-row inside config-template-card

nickdos commented 1 year ago

OK, thanks for confirming 👍