lovelace-card-mod: Cards Loading Slower in card-mod 3.4.1

My Home Assistant version:

2023.12.4 / 2024.1.2

My lovelace configuration method (GUI or yaml):

GUI

What I expected to happen:

how card used to load in Card-mod 3.4.0

What happened instead:

how cards are loading in Card-mod 3.4.1 same issue in android HA app and browser (tested chrome/ brave)

Minimal steps to reproduce:

yaml of the cards above:

Note: the slowness is only visible in a crowded page.

type: custom:stack-in-card
card_mod:
  style: |
    ha-card {
       {% if is_state('group.office_lights', 'on') %}
       background: rgba(255, 152, 0, 0.1);
       {% endif %}
      }
mode: vertical
keep:
  outer_padding: false
cards:
  - type: custom:mushroom-template-card
    card_mod:
      style:
        mushroom-shape-icon$: |
          @keyframes ping {
            0% { box-shadow: 0 0 1px 1px rgba(var(--rgb-{{ config.icon_color }}), 0.7); }
            100% { box-shadow: 0 0 5px 15px transparent; }
          }
        .: |
          mushroom-shape-icon {
            --icon-size: 76px;
            display: flex;
            margin: -20px 0px 0px -20px !important;
          }
          ha-card {
            clip-path: inset(0 0 0 0 round var(--ha-card-border-radius, 12px));
          }
    primary: Office
    secondary: ''
    icon: mdi:bed
    layout: horizontal
    entity: group.office_lights
    icon_color: |-
      {% if is_state('group.office_lights','on')%}
       amber
      {%endif%}
    tap_action:
      action: navigate
      navigation_path: office
    hold_action:
      action: toggle
    double_tap_action:
      action: none
    badge_color: ''
    badge_icon: ''
    fill_container: true
  - type: horizontal-stack
    cards:
      - type: custom:button-card
        tap_action:
          action: none
        state:
          - operator: default
            color: grey
          - value: 'on'
            color: orange
        icon: mdi:lightbulb-group
        entity: group.office_lights
        styles:
          icon:
            - width: 19px
          grid:
            - position: relative
          custom_fields:
            notification:
              - border-radius: 50%
              - position: absolute
              - left: 50%
              - top: 3%
              - height: 20px
              - width: 20px
              - font-size: 10px
              - line-height: 20px
              - font-weight: bold
          card:
            - border-radius: 50%
            - width: 40px
            - height: 40px
        custom_fields:
          notification: |
            [[[
               if (states['sensor.office_lights_of_count'].state == '0')
                return ' '
               return `${states['sensor.office_lights_of_count'].state}`
            ]]]
        name: ' '
      - type: custom:button-card
        state:
          - value: 'on'
        icon: mdi:thermometer
        entity: sensor.office_temperature
        styles:
          icon:
            - color: |
                [[[
                    return `${states['sensor.office_temp_color'].state}`
                ]]]
            - width: 15px
            - position: relative
            - top: 4px
            - right: 12px
          card:
            - border-radius: 80%
            - width: 40px
            - height: 40px
          name:
            - color: white
            - font-size: 10px
            - position: relative
            - bottom: 10px
            - left: 5px
            - font-weight: bold
        name: |
          [[[
            if (states['sensor.office_temperature'].state == 'unknown')
             return '-'
            return `${states['sensor.office_temperature'].state}°`
          ]]]

Error messages from the browser console:

none

About this issue

  • Original URL
  • State: open
  • Created 6 months ago
  • Reactions: 2
  • Comments: 26 (5 by maintainers)

Most upvoted comments

I experience the same with card-mod 3.4.1+ I can now see the style being applied. Before it was instant. I might be that the page loads faster now, but with 3.4.1+ I see some cards changing after the page loads.

I’m using card-mod with the minimalist theme/button-card.

Similar issues here.

card-mod 3.4.2 is significantly slower to load. On some older devices (Android eReader, iPad mini 4 and iPad Air 2), about 1/3 of mushroom cards do not load with formatting and the HA app (or browser) hangs for extended periods of time, making them unusable. Moving back to card-mod 3.4.0 helped significantly.

Occasional performance issues w/ 3.4.2 seen even on higher powered devices, e.g. iPad Pro M2, MacBookAir13" 2020 and iPhone 12 Pro Max.

Same issue here. I use mod-card to have a fixed height and background color of layout card (which doesn’t have card element itself, so need mod-card). I use it to create my own header card. It loads up and in a splitseconds I see it get the correct size. Definitely a noticeable downgrade and looks horrible when switching from tabs. I reverted back to 3.4.0, which works normal.

I hope this can get fixed.

Yes, of course. I was setting values in my theme yaml, for example, card-mod-card-yaml: | .: | ha-card._wrapped_.type-entities { border-radius: var(--x-border-radius); text-transform: uppercase; font-size: 16px; !important; } This seemed ideal to me (centralized control).

Now, instead, I set the constant values in my theme yaml, and use them in the card. I notice this is faster. Examples follow.

Tn the theme yaml file: x-header-line-height: 24px x-header-text-transform: uppercase In the card: - type: custom:button-card color_type: label-card show_icon: false show_name: true show_label: false name: '[[title]]' styles: card: - background: var(--x-header-background) - border-radius: var(--x-header-border-radius) - padding: var(--x-header-padding) - height: var(--**x-header-line-height)** - margin-bottom: var(--x-header-margin-bottom) name: - justify-self: flex-start - color: var(--x-header-color) - font-size: var(--x-header-font-size) - font-weight: var(--x-header-font-weight) - letter-spacing: var(--x-header-letter-spacing) - text-transform: var(--**x-header-text-transform)** I am using decluttering_templates. Therefore, it is a bit “clumsy” but still centralized.

Thank you,

Joe

Confirm, rolling back to 3.4.0 works as a workaround.


v.3.4.3 restored pre v3.4.1 performance levels.

Thanks for keep this amazing and unique project alive.

then everything is alright

unfortunately, could be not in general.