thomasloven / lovelace-card-mod

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

Card mod configuration no appearing in card YAMLs but appear in dashboard YAML #375

Open idogrf opened 2 months ago

idogrf commented 2 months ago

My Home Assistant version: 2024.5.1

My lovelace configuration method (GUI or yaml): both

What I am doing: Trying to edit a card's card_mod settings through the card's YAML by opening "SHOW CODE EDITOR" I just updated to HA 2024.5.1 and the latest card_mod Didn't have the issue in previous versions

What I expected to happen: The opened YAML would contain the card_mod section

What happened instead: The card_mod section doesn't show up. It does show up if I edit the entire dashboard's yaml

This is how the card's YAML looks when opening only it -

type: custom:mushroom-climate-card
entity: climate.main_ac
fill_container: false
show_temperature_control: true
hvac_modes:
  - auto
  - heat
  - cool
  - 'off'
primary_info: state
secondary_info: last-changed
collapsible_controls: true
icon: mdi:fan

and this is how it looks inside the dashboard page's YAML -

views:
  - title: test
    path: test
    badges: []
    cards:
      - type: custom:mushroom-climate-card
        entity: climate.main_ac
        fill_container: false
        show_temperature_control: true
        hvac_modes:
          - auto
          - heat
          - cool
          - 'off'
        primary_info: state
        secondary_info: last-changed
        collapsible_controls: true
        icon: mdi:fan
        card_mod:
          style: |
            :host {
            --mush-icon-symbol-size: 1em;
            --mush-icon-size: 100px;
            {% if is_state("climate.main_ac", "off") %}

            }
            {% else %}
            # --mush-card-primary-font-size: 25px
            }
            ha-state-icon {
              animation: spin 5s linear infinite;
            }
            {% endif %}
            ha-card {
            {% if is_state("climate.main_ac", "cool") %}
                --ha-card-background: linear-gradient(-45deg, rgba(20, 80, 163,0.8) 0%, rgba(255,255,255,0.5) 75%);
            {% elif is_state("climate.main_ac", "heat") %}
                --ha-card-background: linear-gradient(-45deg, rgba(183, 4, 4,0.8) 25%, rgba(0,0,0,0.5) 100%);
            {% endif %} ;
            --control-height: 70px;
            }

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

ildar170975 commented 2 months ago

Duplicate of https://github.com/thomasloven/lovelace-card-mod/issues/337