thomasloven / lovelace-card-mod

🔹 Add CSS styles to (almost) any lovelace card
MIT License
1.04k stars 169 forks source link

—card-mod-icon no realtime update #335

Closed Maddin1684 closed 6 months ago

Maddin1684 commented 6 months ago

My Home Assistant version: 2013.12.3

My lovelace configuration method (GUI or yaml): yaml

What I am doing: using —card-mod-icon to change icon with different states of entities

What I expected to happen: realtime update of the icon

What happened instead: icons doesn’t update in realtime. This works fine with the previous version of card_mod

Minimal steps to reproduce:

  - entity: binary_sensor.garagentur
     icon: mdi:garage-variant
    secondary_info: last-changed
    card_mod:
      style:
        hui-generic-entity-row:
          $: |
            .text-content:not(.info) {
               color:
                  {% if is_state(config.entity, 'off') %}
                   white
                   {% else %}
                   #ff4040
                 {% endif %}
                 ;
             }
            :host {
            {% if is_state(config.entity, 'off') %}
             --paper-item-icon-color: white;
             --card-mod-icon: mdi:garage-variant;
              {% else %}
             --paper-item-icon-color: #ff4040;
             --card-mod-icon: mdi:garage-open-variant;
                  {% endif %}
                  ;  
                  }

Error messages from the browser console:


By putting an X in the boxes ([]) below, I indicate that I:

thomasloven commented 6 months ago

Still a duplicate of #333.