Button with an icon of a switch

hello

i want to modify my yaml :slight_smile:
i have a button with an icon

but i want to change this icon according of the state of an other entity

this is my code , no errors but not working

type: entities
entities:
  - entity: button.x9c1t7_pressed
    icon: "{% if is_state('switch.bjx4ws_switch', 'on') %} mdi:lightbulb-on {% else %} mdi:lightbulb-off {% endif %}"

title: werkpl for 1 werkplaats tr cont scripted led


and when i test it : it seems to work as the text changes instead of the icon

thanks in advance

Core dashboard cards (with very few exceptions) do not support templates.

There are third party alternatives and plug-ins you can use. Like

  • card-mod
  • config-template-card
  • custom-button-card
  • mushroom-card
1 Like

… adding template entity row to the list from Tom in this use-case as well

BTW: Yes, I would like to be able/allowed to template every string as well. Would be so convenient. :sunglasses: