thomasloven / lovelace-card-mod

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

Icons in Tile cards no longer change color based on the state of another entity, after Update 3.4.0 - 3.4.1 #347

Closed Fullmetal11 closed 5 months ago

Fullmetal11 commented 5 months ago

My Home Assistant version: 2024.1.2

My lovelace configuration method (GUI or yaml):

What I am doing: change the color of the icon of a tile card based on the state of another entity

What I expected to happen: when i pressed the tile card, i expect to change the color of the tile card like this: red if the input boolean "example" is on, white if it is off.

What happened instead: nothing

Before the update to 3.4.0 it worked great :( I have lots of tiles card that change the color of their icons based on the value of another entity... they're all screwed up now..

Minimal steps to reproduce:


type: tile
entity: sensor.any_sensor_you_want
icon_tap_action:
  action: call-service
  service: input_boolean.toggle
  target:
    entity_id: input_boolean.example
  data: {}
card_mod:
  style: |
    .tile {
      {% if is_state("input_boolean.example", "on") %}
        --tile-color:red;
      {% else %}  
        white;
      {% endif %}  
    }

# End of code

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

ildar170975 commented 5 months ago

Before the update to 3.4.0 it worked great :(

card_mod:
style: |
.tile {

Wrong. This is NOT related to the recent card-mod changes, the Tile card was changed itself at about 2023.12. Suggest to go to the main card-mod Community thread. Or you can use "search" for your missing ".tile" element in Community.

Fullmetal11 commented 5 months ago

In fact, I having been away from home in december, I updated directly to 2023.12.4 and immediately afterwards updated all the integration from HACS, including card mod. So I didn't realize that the problem could be caused by updating the tile cards by home assistant itself. I'll do some research on the main forum to see if I can fix the problem. Thank you very much

ildar170975 commented 5 months ago
  1. Consider closing the issue since it is merely about using card-mod, not a bug report.
  2. If you need to style the Tile card itself, you may follow this: main HA Community card-mod thread - > 1st post -> link at the bottom -> styling Tile card -> link to the post about exactly what you seem to need.
Fullmetal11 commented 5 months ago

Thank you very much, that was exactly what I was looking for.