Mushroom Cards - Build a beautiful dashboard easily 🍄 (Part 1)

type: custom:mushroom-template-card
icon: mdi:truck-cargo-container
icon_color: red
primary: Vroom
secondary: ''
card_mod:
  style: |
    ha-state-icon {
      animation: vroom 2s ease-in-out infinite;
      }
      .shape {
      clip-path: inset(55% 55% 55% 55%);
      }
      @keyframes vroom {
        49% { opacity: 1;}
        50% { transform: translate(32px); opacity: 0; }
        51% { transform: translate(-30px); opacity: 0; }
        52% { opacity: 1; }
      }  

Works nicely, except the truck “leaves” the icon and enters from outside of the icon. Can’t figure out, how to fix that, in the demo at the top of the page, it worked just fine. The truck should stay within the bounds of the icon (red circle)!

Thanks a lot some days we need an outside perspective

Nice popup! :+1: Mind sharing the code? :slight_smile:

Anyway, if nothing else or simpler comes up, you could try it via a script. Set the tap_action to call a script, where you can have as many actions/service calls as you want. Would be in this case the action you want to call by pushing the button, and afterwards you can call the browser_mod.close_popup service to, yeah, close the popup. :slight_smile:

Great Idea! Thank you. I will try it.

Here is my Popup Code:

type: custom:popup-card
entity: input_boolean.menu
card:
  type: vertical-stack
  cards:
    - type: custom:button-card
      show_icon: false
      show_state: true
      show_name: true
      tap_action:
        action: none
      name: RÄUME
      styles:
        card:
          - background-color: transparent
        name:
          - font-size: 30px
          - color: var(--primary-color)
          - font-weight: lighter
      card_mod:
        style: |
          ha-card { border-radius: 50px;
          background: transparent;
          box-shadow: none;
    - type: horizontal-stack
      cards:
        - type: custom:stack-in-card
          cards:
            - type: custom:mushroom-template-card
              primary: Badezimmer
              entity_id: climate.heizung_ankleidezimmer
              secondary: >-
                {{ state_attr('climate.heizung_badezimmer',
                'current_temperature') }} °C
              icon: mdi:shower
              entity: group.badezimmer_licht
              tap_action:
                action: navigate
                navigation_path: badezimmer
              hold_action:
                action: toggle
              icon_color: '{{ ''orange'' if is_state(entity, ''on'') else ''disabled'' }}'
              fill_container: true
              layout: horizontal
              multiline_secondary: false
            - type: custom:mushroom-chips-card
              chips:
                - type: conditional
                  conditions:
                    - entity: group.badezimmer_licht
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:lightbulb
                - type: conditional
                  conditions:
                    - entity: switch.tasmota2
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:fan
                    card_mod:
                      style: |
                        @keyframes rotation {
                          0% {
                            transform: rotate(0deg);
                          }
                          100% {
                            transform: rotate(360deg);
                          }
                        }
                        ha-card {
                          animation: rotation 2s linear infinite;
                        }
              alignment: end
              card_mod:
                style: |
                  ha-card {
                    --chip-box-shadow: none;
                    --chip-background: none;
                    --chip-spacing: 0;
                    top: -36px;
                  } 
          card_mod:
            style: |
              ha-card {
                height: 66px;
                {% if is_state('group.badezimmer_licht', 'on') %}
                   background: rgba(255, 152, 0, 0.1);
                {% endif %}
              }
        - type: custom:stack-in-card
          cards:
            - type: custom:mushroom-template-card
              primary: Schlafzimmer
              icon: mdi:bed
              entity: group.schlafzimmer_licht
              tap_action:
                action: navigate
                navigation_path: schlafzimmer
              hold_action:
                action: toggle
              icon_color: '{{ ''orange'' if is_state(entity, ''on'') else ''disabled'' }}'
              fill_container: true
              layout: horizontal
              multiline_secondary: false
            - type: custom:mushroom-chips-card
              chips:
                - type: conditional
                  conditions:
                    - entity: group.schlafzimmer_licht
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:lightbulb
                - type: conditional
                  conditions:
                    - entity: binary_sensor.fenstersensor_schlafzimmer_contact
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:window-open-variant
              alignment: end
              card_mod:
                style: |
                  ha-card {
                    --chip-box-shadow: none;
                    --chip-background: none;
                    --chip-spacing: 0;
                    top: -36px;
                  } 
          card_mod:
            style: |
              ha-card {
                height: 66px;
                {% if is_state('group.schlafzimmer_licht', 'on') %}
                   background: rgba(255, 152, 0, 0.1);
                {% endif %}
              }
    - type: horizontal-stack
      cards:
        - type: custom:stack-in-card
          cards:
            - type: custom:mushroom-template-card
              primary: Kinderzimmer
              secondary: >-
                {{ state_attr('climate.heizung_kinderzimmer',
                'current_temperature') }} °C
              icon: mdi:teddy-bear
              entity: group.kinderzimmer_licht
              tap_action:
                action: navigate
                navigation_path: kinderzimmer
              hold_action:
                action: toggle
              icon_color: '{{ ''orange'' if is_state(entity, ''on'') else ''disabled'' }}'
              fill_container: true
              layout: horizontal
              multiline_secondary: false
            - type: custom:mushroom-chips-card
              chips:
                - type: conditional
                  conditions:
                    - entity: group.kinderzimmer_licht
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:lightbulb
                - type: conditional
                  conditions:
                    - entity: group.kinderzimmer_fenster
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:window-open-variant
              alignment: end
              card_mod:
                style: |
                  ha-card {
                    --chip-box-shadow: none;
                    --chip-background: none;
                    --chip-spacing: 0;
                    top: -36px;
                  } 
          card_mod:
            style: |
              ha-card {
                height: 66px;
                {% if is_state('group.kinderzimmer_licht', 'on') %}
                   background: rgba(255, 152, 0, 0.1);
                {% endif %}
              }
        - type: custom:stack-in-card
          cards:
            - type: custom:mushroom-template-card
              primary: Ankleidezimmer
              secondary: >-
                {{ state_attr('climate.heizung_ankleidezimmer',
                'current_temperature') }} °C
              icon: mdi:wardrobe
              entity: ankleidezimmer_licht
              tap_action:
                action: navigate
                navigation_path: ankleidezimmer
              hold_action:
                action: toggle
              icon_color: '{{ ''orange'' if is_state(entity, ''on'') else ''disabled'' }}'
              fill_container: true
              layout: horizontal
              multiline_secondary: false
            - type: custom:mushroom-chips-card
              chips:
                - type: conditional
                  conditions:
                    - entity: group.ankleidezimmer_licht
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:lightbulb
                - type: conditional
                  conditions:
                    - entity: binary_sensor.fenstersensor_ankleidezimmer_contact
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:window-open-variant
                - type: conditional
                  conditions:
                    - entity: binary_sensor.presence_ankleiderzimmer_presence
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:motion-sensor
              alignment: end
              card_mod:
                style: |
                  ha-card {
                    --chip-box-shadow: none;
                    --chip-background: none;
                    --chip-spacing: 0;
                    top: -36px;
                  } 
          card_mod:
            style: |
              ha-card {
                height: 66px;
                {% if is_state('group.ankleidezimmer_licht', 'on') %}
                   background: rgba(255, 152, 0, 0.1);
                {% endif %}
              }
    - type: horizontal-stack
      cards:
        - type: custom:stack-in-card
          cards:
            - type: custom:mushroom-template-card
              primary: Wohnzimmer
              secondary: >-
                {{ state_attr('climate.heizung_wohnzimmer',
                'current_temperature') }} °C
              icon: mdi:television
              entity: group.wohnzimmer_licht
              tap_action:
                action: navigate
                navigation_path: wohnzimmer
              hold_action:
                action: toggle
              icon_color: '{{ ''orange'' if is_state(entity, ''on'') else ''disabled'' }}'
              fill_container: true
              layout: horizontal
              multiline_secondary: false
            - type: custom:mushroom-chips-card
              chips:
                - type: conditional
                  conditions:
                    - entity: group.wohnzimmer_licht
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:lightbulb
                - type: conditional
                  conditions:
                    - entity: binary_sensor.terrassentursensor_contact
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:window-open-variant
                - type: conditional
                  conditions:
                    - entity: binary_sensor.presence_wohnzimmer
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:motion-sensor
              alignment: end
              card_mod:
                style: |
                  ha-card {
                    --chip-box-shadow: none;
                    --chip-background: none;
                    --chip-spacing: 0;
                    top: -36px;
                  } 
          card_mod:
            style: |
              ha-card {
                height: 66px;
                {% if is_state('group.wohnzimmer_licht', 'on') %}
                   background: rgba(255, 152, 0, 0.1);
                {% endif %}
              }
        - type: custom:stack-in-card
          cards:
            - type: custom:mushroom-template-card
              primary: Essbereich
              secondary: null
              icon: mdi:table-chair
              entity: light.shelly_kuche_essbereich_channel_2
              tap_action:
                action: navigate
                navigation_path: essbereich
              hold_action:
                action: toggle
              icon_color: '{{ ''orange'' if is_state(entity, ''on'') else ''disabled'' }}'
              fill_container: true
              layout: horizontal
              multiline_secondary: false
            - type: custom:mushroom-chips-card
              chips:
                - type: conditional
                  conditions:
                    - entity: light.shelly_kuche_essbereich_channel_2
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:lightbulb
                - type: conditional
                  conditions:
                    - entity: sensor.rolladen_essbereich_level
                      state: closed
              alignment: end
              card_mod:
                style: |
                  ha-card {
                    --chip-box-shadow: none;
                    --chip-background: none;
                    --chip-spacing: 0;
                    top: -36px;
                  } 
          card_mod:
            style: |
              ha-card {
                height: 66px;
                {% if is_state('light.shelly_kuche_essbereich_channel_2', 'on') %}
                   background: rgba(255, 152, 0, 0.1);
                {% endif %}
              }
    - type: horizontal-stack
      cards:
        - type: custom:stack-in-card
          cards:
            - type: custom:mushroom-template-card
              primary: Küche
              secondary: null
              icon: mdi:countertop
              entity: group.kuche_licht
              tap_action:
                action: navigate
                navigation_path: kuche
              hold_action:
                action: toggle
              icon_color: '{{ ''orange'' if is_state(entity, ''on'') else ''disabled'' }}'
              fill_container: true
              layout: horizontal
              multiline_secondary: false
            - type: custom:mushroom-chips-card
              chips:
                - type: conditional
                  conditions:
                    - entity: group.kuche_licht
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:lightbulb
                - type: conditional
                  conditions:
                    - entity: group.kuche_fenster
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:window-open-variant
                - type: conditional
                  conditions:
                    - entity: binary_sensor.presence_kuche_presence
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:motion-sensor
              alignment: end
              card_mod:
                style: |
                  ha-card {
                    --chip-box-shadow: none;
                    --chip-background: none;
                    --chip-spacing: 0;
                    top: -36px;
                  } 
          card_mod:
            style: |
              ha-card {
                height: 66px;
                {% if is_state('group.kuche_licht', 'on') %}
                   background: rgba(255, 152, 0, 0.1);
                {% endif %}
              }
        - type: custom:stack-in-card
          cards:
            - type: custom:mushroom-template-card
              primary: Arbeitzimmer
              icon: mdi:chair-rolling
              entity: group.arbeitszimmer_licht
              tap_action:
                action: navigate
                navigation_path: arbeitszimmer
              hold_action:
                action: toggle
              icon_color: '{{ ''orange'' if is_state(entity, ''on'') else ''disabled'' }}'
              fill_container: true
              layout: horizontal
              multiline_secondary: false
            - type: custom:mushroom-chips-card
              chips:
                - type: conditional
                  conditions:
                    - entity: group.arbeitszimmer_licht
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:lightbulb
                - type: conditional
                  conditions:
                    - entity: binary_sensor.fenstersensor_arbeitszimmer_contact
                      state: open
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:window-open-variant
                - type: conditional
                  conditions:
                    - entity: binary_sensor.presence_az_presence
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:motion-sensor
              alignment: end
              card_mod:
                style: |
                  ha-card {
                    --chip-box-shadow: none;
                    --chip-background: none;
                    --chip-spacing: 0;
                    top: -36px;
                  } 
          card_mod:
            style: |
              ha-card {
                height: 66px;
                {% if is_state('group.arbeitszimmer_licht', 'on') %}
                   background: rgba(255, 152, 0, 0.1);
                {% endif %}
              }
    - type: horizontal-stack
      cards:
        - type: custom:stack-in-card
          cards:
            - type: custom:mushroom-template-card
              primary: Atelier
              secondary: >-
                {{ state_attr('climate.heizung_atelier', 'current_temperature')
                }} °C
              icon: mdi:face-woman-shimmer
              entity: climate.heizung_atelier
              tap_action:
                action: navigate
                navigation_path: atelier
              hold_action:
                action: toggle
              icon_color: '{{ ''orange'' if is_state(entity, ''on'') else ''disabled'' }}'
              fill_container: true
              layout: horizontal
              multiline_secondary: false
            - type: custom:mushroom-chips-card
              chips:
                - type: conditional
                  conditions:
                    - entity: binary_sensor.fenstersensor_atelier_contact
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:window-open-variant
              alignment: end
              card_mod:
                style: |
                  ha-card {
                    --chip-box-shadow: none;
                    --chip-background: none;
                    --chip-spacing: 0;
                    top: -36px;
                  } 
          card_mod:
            style: |
              ha-card {
                height: 66px;
                {% if is_state('group.atelier_licht', 'on') %}
                   background: rgba(255, 152, 0, 0.1);
                {% endif %}
              }
        - type: custom:stack-in-card
          cards:
            - type: custom:mushroom-template-card
              primary: Waschraum
              secondary: >-
                {{ states('sensor.feuchtigkeitssensor_waschraum_temperature') |
                round(0) }} °C
              icon: mdi:washing-machine
              entity: light.2_deckenlicht_luftung_wasc_channel_1
              tap_action:
                action: navigate
                navigation_path: waschraum
              hold_action:
                action: toggle
              icon_color: '{{ ''orange'' if is_state(entity, ''on'') else ''disabled'' }}'
              fill_container: true
              layout: horizontal
              multiline_secondary: false
            - type: custom:mushroom-chips-card
              chips:
                - type: conditional
                  conditions:
                    - entity: light.2_deckenlicht_luftung_wasc_channel_1
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:lightbulb
                - type: conditional
                  conditions:
                    - entity: light.2_deckenlicht_luftung_wasc_channel_2
                      state: 'on'
                  chip:
                    type: template
                    icon_color: disabled
                    icon: mdi:fan
                    card_mod:
                      style: |
                        @keyframes rotation {
                          0% {
                            transform: rotate(0deg);
                          }
                          100% {
                            transform: rotate(360deg);
                          }
                        }
                        ha-card {
                          animation: rotation 2s linear infinite;
                        }
              alignment: end
              card_mod:
                style: |
                  ha-card {
                    --chip-box-shadow: none;
                    --chip-background: none;
                    --chip-spacing: 0;
                    top: -36px;
                  } 
          card_mod:
            style: |
              ha-card {
                height: 66px;
                {% if is_state('light.2_deckenlicht_luftung_wasc_channel_1', 'on') %}
                   background: rgba(255, 152, 0, 0.1);
                {% endif %}
              }
    - type: custom:stack-in-card
      cards:
        - type: custom:mushroom-template-card
          primary: Garten
          icon: mdi:tree
          entity: sensor.garten_licht
          tap_action:
            action: navigate
            navigation_path: garten
          hold_action:
            action: toggle
          icon_color: '{{ ''orange'' if is_state(entity, ''on'') else ''disabled'' }}'
          fill_container: true
          layout: horizontal
          multiline_secondary: false
        - type: custom:mushroom-chips-card
          chips:
            - type: conditional
              conditions:
                - entity: sensor.garten_licht
                  state: 'on'
              chip:
                type: template
                icon_color: disabled
                icon: mdi:lightbulb
            - type: conditional
              conditions:
                - entity: sensor.garten_steckdosen
                  state: 'on'
              chip:
                type: template
                icon_color: disabled
                icon: mdi:power-socket-eu
            - type: conditional
              conditions:
                - entity: sensor.garten_bewasserung
                  state: 'on'
              chip:
                type: template
                icon_color: disabled
                icon: mdi:sprinkler
          alignment: end
          card_mod:
            style: |
              ha-card {
                --chip-box-shadow: none;
                --chip-background: none;
                --chip-spacing: 0;
                top: -36px;
              } 
      card_mod:
        style: |
          ha-card {
            height: 66px;
            {% if is_state('light.2_deckenlicht_luftung_wasc_channel_1', 'on') %}
               background: rgba(255, 152, 0, 0.1);
            {% endif %}
          }

1 Like

Hello
for some reason the animation does not work with any of the template cards


however, it is perfect with the climate card

type: custom:mushroom-climate-card
entity: climate.c6c489b1
hvac_modes:
  - heat_cool
  - heat
  - cool
  - fan_only
  - dry
show_temperature_control: true
collapsible_controls: false
name: Air Conditioner
card_mod:
  style: |
    mushroom-shape-icon {
      {% if is_state(config.entity, 'heat_cool') %}
        --card-mod-icon: mdi:autorenew;
        animation: spin 3s ease-in-out infinite alternate;
      {% elif is_state(config.entity, 'heat') %}
        --card-mod-icon: mdi:fire;
        animation: heat 2s infinite;
      {% elif is_state(config.entity, 'cool') %}
        --card-mod-icon: mdi:snowflake;
        animation: cool 6s ease-in-out infinite;
      {% elif is_state(config.entity, 'dry') %}
        --card-mod-icon: mdi:water-percent;
        animation: dry 1.5s linear infinite;
      {% elif is_state(config.entity, 'fan_only') %}
        --card-mod-icon: mdi:fan;
        animation: spin 1s linear infinite;
      {% else %}
        --card-mod-icon: mdi:air-conditioner; 
      {% endif %}
      display: flex;
    }
    @keyframes cool {
      0%, 100% { transform: rotate(25deg); }
      25% { transform: rotate(-25deg); }
      50% { transform: rotate(50deg); }
      75% { transform: rotate(-50deg); }
    }
    @keyframes heat {
      0%, 100% { --icon-color: rgba(var(--rgb-red), 1); }
      10%, 90% { --icon-color: rgba(var(--rgb-red), 0.8); }
      20%, 80% { --icon-color: rgba(var(--rgb-red), 0.6); }
      30%, 70% { --icon-color: rgba(var(--rgb-red), 0.4); }
      40%, 60% { --icon-color: rgba(var(--rgb-red), 0.2); }
      50% { --icon-color: rgba(var(--rgb-red), 0); }
    }
    @keyframes dry {
      0%, 100% { --icon-symbol-size: 21px; }
      10%, 90% { --icon-symbol-size: 22px; }
      20%, 80% { --icon-symbol-size: 23px; }
      30%, 70% { --icon-symbol-size: 24px; }
      40%, 60% { --icon-symbol-size: 25px; }
      50% { --icon-symbol-size: 26px; }
    }

type: custom:mushroom-template-card
primary: Spin
icon: mdi:fan
icon_color: teal
card_mod:
  style:
    mushroom-shape-icon$: |
      ha-icon {
        --icon-animation: spin 1s linear infinite;
      }

I copied both from here, the card mod is installed

There was a breaking change effecting some animations. The following works.

type: custom:mushroom-template-card
primary: Spin
icon: mdi:fan
icon_color: teal
card_mod:
  style: |
      ha-state-icon {
        animation: spin 1s linear infinite;
      }

In general:

style:
    mushroom-shape-icon$: |

becomes:

style: |

ha-icon

becomes:

ha-state-icon

and

--icon-animation: ...

becomes:

animation: ...

Clear as mud. :sweat_smile:

MrGrey.

6 Likes

@rhysb Im following you’re great animations guide that you made and am trying to use it to apply a lightbulb animation when the light is toggled on, problem I’m facing is the toggle is obviously fast so its not enough time for it to play the animation.

Any way around this? I tried speeding it up a little but didn’t work.

type: custom:mushroom-light-card
entity: light.huego
show_brightness_control: true
icon: mdi:lightbulb
hold_action:
  action: toggle
card_mod:
  style: |
    ha-card:active ha-state-icon {
      animation: eureka 2.8s infinite;
    }
    @keyframes eureka {
      0%, 45%, 55%, 100% { transform: translateY(0) scale(1); clip-path: polygon(20% 100%, 21% 38%, 36% 22%, 62% 21%, 79% 37%, 80% 100%, 53% 100%, 55% 67%, 62% 62%, 66% 55%, 67% 46%, 62% 38%, 55% 34%, 47% 34%, 39% 37%, 34% 44%, 33% 53%, 36% 60%, 41% 64%, 45% 66%, 45% 76%, 56% 76%, 54% 100%); }
      10%, 40% { transform: translateY(-5px) scale(1.12); clip-path: inset(0 0 0 0); }
      50% { transform: translateY(-2px) }
    }
1 Like

The following works as a Template Card but I can’t get it working as a Chip Card, any ideas?


type: custom:mushroom-chips-card
chips:
  - type: entity
    entity: switch.shellyplus1_441793a43af8_switch_0
    name: Fan
    icon: mdi:fan
    tap_action:
      action: toggle
card_mod:
  style: |
    ha-state-icon {
      {% if is_state('switch.shellyplus1_441793a43af8_switch_0', 'on') %}
        animation: spin 1s linear infinite;
        {% else %}
        
        {% endif %}
      }

Thank you very much. It worked.

Currently I have copied the popup card into each tab (kitchen, bathroom, living room). Can I store the irngedwo centrally and access it from any page?

how did you realize this pop-up menu behind plugs? can you show me the code of it?

I think this are this card:

2 Likes

I can’t set up rotation animation. help me please

    card_mod:
      style: |
        ha-state-icon {    
          @keyframes rotation 
            0% {
              transform: rotate(0deg);
            }
            100% {
              transform: rotate(360deg);
            }
        }  
        ha-state-icon {
          box-shadow: 0px 0px;
          animation: rotation linear infinite !important;
          {% set motor_speed = states('sensor.zhimi_airpurifier_ma2_motor_speed') | float %}
          {% if motor_speed > 100 and motor_speed < 400 %}
            animation-duration: 4s !important;
          {% elif motor_speed > 401 and motor_speed < 700 %}
            animation-duration: 3s !important; 
          {% elif motor_speed > 701 and motor_speed < 900 %}
            animation-duration: 1.5s !important;
          {% elif motor_speed > 901 and motor_speed < 2000 %}
            animation-duration: 1.0s !important;
          {%- else -%}
          animation-duration: ;
          {%- endif %}       
        }

You’ve got ha-state-icon twice.

Thank you very much

And what about chip cards?
they don’t work there at all

type: custom:mushroom-chips-card
chips:
  - type: template
    icon: mdi:mushroom
    icon_color: red
  - type: template
    icon: mdi:snail
    icon_color: brown
  - type: template
    icon: mdi:flower
    icon_color: amber
  - type: template
    icon: mdi:butterfly
    icon_color: cyan
card_mod:
  style:
    mushroom-template-chip:nth-child(1)$: |
      ha-icon {
        animation: bump 10s infinite;
        transform-origin: 50% 100%;
      }
      @keyframes bump {
        0% { transform: translateX(0); }
        1% { transform: translateX(-0.6px) rotate(-9deg); }
        2% { transform: translateX(0.5px) rotate(7deg); }
        3% { transform: translateX(-0.3px) rotate(-5deg); }
        4% { transform: translateX(0.2px) rotate(3deg); }
        5% { transform: translateX(0); }
      }
    mushroom-template-chip:nth-child(2)$: |
      ha-icon {
        animation: slip 0.5s linear infinite alternate;
        transform-origin: 100% 100%;
      }
      @keyframes slip {
        from { transform: scale(1.05, 0.9);}
        to { transform: scale(0.9, 1.05); }
      }
    mushroom-template-chip:nth-child(3)$: |
      ha-icon {
        animation: bump 10s infinite;
        transform-origin: 50% 100%;
      }
      @keyframes bump {
        50% { transform: translateX(0); }
        51% { transform: translateX(-0.6px) rotate(-9deg); }
        52% { transform: translateX(0.5px) rotate(7deg); }
        53% { transform: translateX(-0.3px) rotate(-5deg); }
        54% { transform: translateX(0.2px) rotate(3deg); }
        55% { transform: translateX(0); }
      }
    mushroom-template-chip:nth-child(4)$: |
      ha-icon {
        animation: flutter 5s infinite alternate;
      }
      @keyframes flutter {
        0% { transform: translate({{ range(-20, 20) | random / 10 }}px, {{ range(-20, 20) | random / 10 }}px) rotate({{ range(-15, 15) | random }}deg); }
        10% { transform: translate({{ range(-20, 20) | random / 10 }}px, {{ range(-20, 20) | random / 10 }}px) rotate({{ range(-15, 15) | random }}deg) scalex({{ range(3, 7) | random / 10 }}); }
        20% { transform: translate({{ range(-20, 20) | random / 10 }}px, {{ range(-20, 20) | random / 10 }}px) rotate({{ range(-15, 15) | random }}deg); }
        30% { transform: translate({{ range(-20, 20) | random / 10 }}px, {{ range(-20, 20) | random / 10 }}px) rotate({{ range(-15, 15) | random }}deg) scalex({{ range(3, 7) | random / 10 }}); }
        40% { transform: translate({{ range(-20, 20) | random / 10 }}px, {{ range(-20, 20) | random / 10 }}px) rotate({{ range(-15, 15) | random }}deg); }
        50% { transform: translate({{ range(-20, 20) | random / 10 }}px, {{ range(-20, 20) | random / 10 }}px) rotate({{ range(-15, 15) | random }}deg) scalex({{ range(3, 7) | random / 10 }}); }
        60% { transform: translate({{ range(-20, 20) | random / 10 }}px, {{ range(-20, 20) | random / 10 }}px) rotate({{ range(-15, 15) | random }}deg); }
        70% { transform: translate({{ range(-20, 20) | random / 10 }}px, {{ range(-20, 20) | random / 10 }}px) rotate({{ range(-15, 15) | random }}deg) scalex({{ range(3, 7) | random / 10 }}); }
        80% { transform: translate({{ range(-20, 20) | random / 10 }}px, {{ range(-20, 20) | random / 10 }}px) rotate({{ range(-15, 15) | random }}deg); }
        90% { transform: translate({{ range(-20, 20) | random / 10 }}px, {{ range(-20, 20) | random / 10 }}px) rotate({{ range(-15, 15) | random }}deg) scalex({{ range(3, 7) | random / 10 }}); }
        100% { transform: translate({{ range(-20, 20) | random / 10 }}px, {{ range(-20, 20) | random / 10 }}px) rotate({{ range(-15, 15) | random }}deg); }
      }
    .: |
      .chip-container {
        background: radial-gradient(circle, rgba(var(--rgb-light-blue), 0.1) 0%, transparent 100%);
        border-bottom: 3px dotted rgba(var(--rgb-green));
        border-radius: 20%;
        box-shadow: 0 5px 1px 0.1px rgba(var(--rgb-green), 0.2)
      }
      mushroom-template-chip:nth-child(2) {
        animation: slide 10s ease-in-out infinite;
      }
      @keyframes slide {
        0% { transform: translate(0px, 0px) rotateY(0deg); }
        50% { transform: translate(100px, 0px) rotateY(0deg); }
        50.1% { transform: translate(100px, 0px) rotateY(180deg); }
        100% { transform: translate(0px, 0px) rotateY(180deg); }
      }
      mushroom-template-chip:nth-child(3) {
          transform: translate(100px);
      }
      mushroom-template-chip:nth-child(4) {
          animation: by {{ range(5, 15) | random }}s ease infinite;
      }
      @keyframes by {
        0% { transform: translate(100px, 0px); }
        50% { transform: translate({{ range(110, 150) | random }}px, 0px); }
        100% { transform: translate(100px, 0px); }
      }

You need to still change ha-icon to ha-state-icon

I know everyone is posting about this, and previous edit of my cardmod animations seemed to work based on suggestions here. But now not anymore and there are so many posts I cannot figure it out anymore.
Perhaps someone can help me directly. I have a LOT of not working animations. Neither on browser or in the iOS app since Mushroom’s update. All are formatted the same so if someone can suggest something to fix mine I can prob. apply them to all.

type: custom:mushroom-template-card
primary: Was
secondary: ''
card_mod: null
style: |
    {% if is_state('sensor.wasmachine','on') %}
      mushroom-shape-icon {
      --icon-animation: shake 400ms ease-in-out infinite, drum 2s ease infinite;
      transform-origin: 50% 110%;
      }
      @keyframes shake {
        0%, 100% { transform: translate(0, 0) rotate(0); }
        20%  { transform: translate(0.4px, -0.4px) rotate(-4deg); }
        40%  { transform: translate(-0.4px, 0.4px) rotate(4deg); }
        60%  { transform: translate(0.4px, 0.4px) rotate(-4deg); }
        80%  { transform: translate(-0.4px, -0.4px) rotate(4deg); }
      }
      @keyframes drum {
        50%  { clip-path: polygon(0 0, 0 100%, 35% 100%, 34% 68%, 60% 41%, 71% 56%, 65% 74%, 47% 79%, 32% 69%, 35% 100%, 100% 100%, 100% 0); }
      }
    {% else %}

    {% endif %}
  }
icon: |-
  {% if is_state('sensor.wasmachine', 'on') %}
    mdi:washing-machine
  {% else %}
    mdi:washing-machine-off
  {% endif %}
layout: vertical
icon_color: |-
  {% if is_state('sensor.wasmachine', 'on') %}
    orange 
  {% else %}
    blue-grey
  {% endif %}
tap_action:
  action: navigate
  navigation_path: wasmachine

Hope this doesn’t sound bad, but is it worth revering the change in Mushroom for whom mainaints it? As I just see endless posts of people now stuck who use Cardmod for animations. Just an open question without any mall-content or anything ment by it.

Replace your --icon-animation with just animation.

Replace mushroom-shape-icon with ha-state-icon

All should then be fixed for you.

The changes made that affect card mod users are honestly minor.

Card mod was also never supported for mushroom. But everything still seems to work as long as you change a few entries :slight_smile:

1 Like
type: custom:stack-in-card
cards:
  - type: custom:mushroom-template-card
    primary: Serratura Ingresso
    secondary: >-
      {% if is_state('lock.serratura_ingresso','unlocked')%}
        Aperta
      {% else %}
        Chiusa
      {% endif%}
    icon: >-
      {% if is_state('lock.serratura_ingresso','unlocked') %}
        mdi:lock-open
      {% else %}
        mdi:lock
      {% endif%}
    layout: horizontal
    icon_color: >-
      {% if is_state('lock.serratura_ingresso','locked') %}
        red
      {% else %}
        green
      {% endif%}
    badge_icon: >
      {% set battery_level = (states(entity) | int / 10) | round(0) | int * 10
      %}

      {% if battery_level == 100 %}
        mdi:battery
      {% elif battery_level > 0 %}
        mdi:battery-{{ battery_level }}
      {% else %}
        mdi:battery-alert-variant-outline
      {% endif %}
    badge_color: |-
      {% set battery_level = states(entity) | int %}
      {% if battery_level > 90 %} 
        green
      {% elif battery_level > 60 %}
        light-green
      {% elif battery_level > 50 %}
        lime
      {% elif battery_level > 40 %}
        yellow
      {% elif battery_level > 30 %}
        amber
      {% elif battery_level > 20 %}
        orange
      {% elif battery_level > 10 %}
        deep-orange
      {% else %}
        red
      {% endif %} 
    tap_action:
      action: more-info
    entity: sensor.serratura_ingresso_battery_level
  - type: custom:mushroom-lock-card
    entity: lock.serratura_ingresso
    name: Serratura Ingresso
    primary_info: none
    secondary_info: none
    icon_type: none
    layout: vertical
card_mod:
  style: |
    ha-card {
      {% if is_state('lock.serratura_ingresso','unlocked') %}
          background: rgba(101,170,91,0.2);
      {% else %}
          background: rgba(226,84,66,0.2);
      {% endif %}
    }

someone can help me to remove this line??

Screenshot 2023-07-22 alle 05.48.28

Thank you! That did the trick! Can I ask you for one more? I also have some animations on the shape’s themselves. I tried to adapt those with the same idea. removing the – to either shape-animation or animation but no success yet. I’m way to rusty with css (been 5+ years prob) and kind of stuck in the ‘I can read it and copy/paste it, but not fix complex things anymore’ phase :slight_smile: I did have I think over 50 animations in my dashboard (mainly warnings if a battery runs out or if it’s charging the icon changes and becomes animated). I may have once gone a bit overboard there. It seems I fixed them all now.

This one doesn’t work yet:

      .shape {
        shape-animation: ping 1.5s infinite;
      }

It’s part of this overall:

card_mod:
  style: |
    {% if
    is_state('binary_sensor.tado_thermostat_connection_state','on')
    %}
      ha-state-icon {
        animation: clip 1.5s infinite;
      }
      @keyframes clip {
        0% { clip-path: circle(13.0% at 50% 50%); }
        100% { clip-path: circle(50.0% at 50% 50%); }
      }
      .shape {
        shape-animation: ping 1.5s infinite;
      }
      @keyframes ping {
        0% { box-shadow: 0 0 1px 1px rgba(var(--rgb-teal), 0.3) inset; }
        50% { box-shadow: 0 0 5px 10px transparent inset; }
        51% { box-shadow: 0 0 1px 1px rgba(var(--rgb-teal), 0.3); }
      }   
    {% endif %}

My comment about perhaps keep supporting ‘the old way’ was mainly based on seeing how many people run into it, not the size of the change itself. It just seems to have impacted a lot of people. And there are some really nice examples on this forum that are now all not working anymore. If people are like me (can copy/paste complex css, find it on the forum - but these days lack the skill & time to really get what it says) it could be helpfull. But in noway complaining about mushroom, the change, etc. I fully understand it.

Hello all,

first post and immediately a strange problem where I hope for your help. I am currently familiarizing myself with Home Assistant and stumbled across Mushroom Cards.

I am still learning and trying out, but have now stumbled across a behavior that I have not yet found anything about - so I suspect I am doing something wrong.

No matter if I use my own template card or e.g. also the welcome card from @rhysb the following happens:

The page loads and then I still see how the individual CSS commands / formatting are applied (e.g. when a button becomes “round”).
I think the reason is card_mod or the interaction with card mod - but perhaps anybody of you have a solution. Because so it looks really weird on Browser and mobile App :frowning:

@dimitri.landerloos i also read your guide for card_mod - perhaps you can give a hint, what i am doing wrong ? :frowning: