iantrich / config-template-card

📝 Templatable Lovelace Configurations
MIT License
434 stars 56 forks source link

Support templated icon element inside picture-elements card #70

Closed marrobHD closed 3 years ago

marrobHD commented 3 years ago

Is your feature request related to a problem? Please describe. I would like to have an icon which could change its icon based on a sensor inside an picture-elements card.

Describe the solution you'd like A way to implement the card working with elements inside picture-elements card.

Describe alternatives you've considered /

Additional context Add any other context or screenshots about the feature request here.

A configuration should look somehow like this:

type: picture-elements
image: /local/images/coronavirus_transparent_full.png
elements:
  - type: custom:config-template-card
    element:
      type: picture-elements-icon
      icon: >-
         ${if (states['binary_sensor.virus._weekincidence_rising'].state === 'on')
          'mdi:virus';else 'mdi:virus-outline'}
    style:
      top: 8%
      left: 10%
      color: var(--ha-card-header-color)
marrobHD commented 3 years ago

Oups, it's possible when using state-iconinstead of iconand adding an entity. https://www.home-assistant.io/lovelace/picture-elements/#state-icon