Changed icon of a view based on a state

Hello everyone,

I am searching for a way to change the icon of a view based on a device state.

I tried this:

views:
  - title: Home
    icon: |
      {% if is_state('cover.WohnzimmerJalKueche', 'closed') %}
        mdi:home 
      {% else %} 
        mdi:home-account 
      {% endif %}

But unfortunately it is a blank space instead of an icon.

Can anybody help, please?

Templates cannot be used here.
The only way is using card-mod-theme.
Go to card-mo thread - 1st post - link at the bottom - “themes” section - customizing tabs on the toolbar.

1 Like