Change icon in entity card configuration

Hi,

Please excuse the newbie question.

I have been trying to change the icon within an ‘Entity configuration card’ but do not seem to be able to find a way to do so.

What I would like to do is change the icon from ‘transmission power export’ to ‘transmission power import’ based on wheter I am importing or exporting energy.

Having looked online all the search results point to ‘custom buttons’ but this card is an entity not a button.

Am I trying to do something that is not possible, or a I going about it the wrong way?

If changing the icon is possible, if someone could point me in the right direction it would be apreciated.

Thanks,

Graham.
screenshot showing the icon I would like to change is attached.

Go into the entity settings and change it there

If I understand the OP right, it’s a dynamic icon change that’s required, according to the state of the entity.

One option is to create a template entity, based on your actual entity, and use a template to determine the icon. Here’s an example, that might give you an idea of how to do that. It goes in the configuration.yaml.

  - platform: template
    sensors:
      binlocation:
        friendly_name: Bin Location
        value_template: "{% if is_state('input_boolean.binout', 'on') %}Out{% else %}Not Out{% endif %}"
        icon_template: "{% if is_state('input_boolean.binout', 'on') %}mdi:thumb-up-outline{% else %}mdi:thumb-down-outline{% endif %}"

value_template sets the state and can just be set equal to the state of the original sensor, then a bit of logic in the icon_template to set the icon.

Template - Home Assistant (home-assistant.io)

Another option is to use a custom plugin like:
GitHub - iantrich/config-template-card: :memo: Templatable Lovelace Configurations

To add template capability to the icon option in the entity card.

Hi @eggman,

Thanks for the reply, sorry I haven’t replied to you earlier, I thought that I had set up notificiations on posts but obviously not. So it was only when I was looking for something else that I noticied yor reply.

This is exactly what I was looking for, a dynamic change of icon. I have managed it with a normal ‘card’ but shall now go back and look at the ‘entity card’ of my original post.

Once again thanks for the reply.

Graham.