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

The placement of card mod code is crucial

type: custom:stack-in-card
cards:
  - type: custom:mushroom-template-card
    primary: Bathroom
    secondary: >-
      {{ states('sensor.openweathermap_temperature') | round (1) }}°C - {{
      states('sensor.openweathermap_humidity') }}%
    icon: mdi:tree
    entity: light.soffit_lights
    hold_action:
      action: toggle
    tap_action:
      action: navigate
      navigation_path: /home-v2/outside
    icon_color: '{{ "orange" if is_state("light.soffit_lights", "on") else "disabled" }}'
    fill_container: true
    layout: horizontal
    multiline_secondary: false
    card_mod:
      style:
        mushroom-state-info$: |
          .primary {
            text-shadow: 0px 0px 5px black;
            --card-primary-font-weight: 325;
           --card-primary-color: white;
            --card-primary-font-size: 20px;
            align-items: end;
            margin-top: 175px;
            inline-size: 180px;
            height: 25px;
          }
          .secondary {
            --card-secondary-font-size: 13px;
              text-shadow: 0px 0px 5px black;
           --card-secondary-color: white;
            --card-secondary-font-weight: 350;
              margin-top: -2px;
          } 
        .: |
          :host {
          {% if is_state('light.soffit_lights', 'off') %}
            background: url('/local/images/areas/bathroom.jpg') center;
            background-size: cover;
            background-position-y: 70px;
            background-blend-mode: overlay;
            #filter: grayscale(70%);
            background-color: rgba(var(--rgb-card-background-color), 0.0);
          {% endif %}
            --mush-icon-size: 0px;
            height: 220px;
            margin-left: -15px !important;
            margin-top: -70px !important;
          {% if is_state('light.soffit_lights', 'on') %}
            background: url('/local/images/areas/bathroom.jpg') center;
            background-size: cover;
            background-blend-mode: overlay;
            background-position-y: 70px;
            background-color: rgba(var(--rgb-card-background-color), 0.0);
          {% endif %}
          }
          mushroom-shape-icon {
            --shape-color: rgba(var(--rgb-{{ 'orange' if is_state('light.soffit_lights', 'on') else 'disabled' }}), 0.4) !important;
          }
  - type: custom:mushroom-chips-card
    chips:
      - type: template
        entity: light.dining_room_lamp
        icon: mdi:fan
        icon_color: '{{ ''grey'' if states(config.entity) == ''off'' else ''blue''}}'
        content: ''
        tap_action:
          action: navigate
          navigation_path: /lovelace/temperature
        card_mod:
          style: |
            ha-card {
              border: none;}
      - type: template
        entity: light.soffit_lights
        icon: >-
          {{ 'mdi:lightbulb' if expand(area_entities('outside')) |
          selectattr('domain','eq','light') | selectattr('state','eq','on') |
          list | count > 0 else 'mdi:lightbulb-outline' }}
        icon_color: >
          {% set lights_in_outside = expand(area_entities('outside')) |
          selectattr('domain', 'eq', 'light') | list %} {{ 'orange' if
          lights_in_outside | selectattr('state', 'eq', 'on') | list | count > 0
          else 'grey' }}
        content: >-
          {{ expand(area_entities('outside')) |
          selectattr('domain','eq','light') | selectattr('state','eq','on') |
          list | count }}
        tap_action:
          action: call-service
          service: light.toggle
          target:
            area_id: outside
        hold_action:
          action: more-info
        card_mod:
          style: |
            ha-card {
              border: none;}  
    alignment: end
    card_mod:
      style:
        mushroom-template-chip:nth-child(1)$: |
         ha-state-icon {
          {{ 'animation: spin 1s linear infinite;' if is_state('light.pc_lights', 'on') else 'animation: none;' }}
                  }
          @keyframes spin {
          100% { transform: rotate(360deg); }
          }  
        .: |
         ha-card {
          --chip-box-shadow: none;
          --chip-background: none;
          --chip-spacing: -15px;
           margin-top: -10px;
          
          } 
card_mod:
  style: |
    ha-card {
      height: 180px;
      width: 180px;
      margin-left: auto;
      margin-right: auto;
      {% if is_state('light.soffit_lights', 'on') %}
          #box-shadow: 0 0 20px rgba(245, 173, 66, 0.5);
          #border-radius: 10px;
          #background: rgba(245, 173, 66, 0.3);      {% endif %}
    }

chrome-capture-2024-6-18

3 Likes

That’s all working now thank you very much for your help.

1 Like

Hello,

I have added in an animation to my grid card to use stack-in-card with mushroom-template-card to have a spinner animation for my washing machine.

Before the animation the card on the UI looks like this:

After implementing the animation and stack-in-card the UI looks like this:

Here is the code:

type: custom:stack-in-card
cards:
  - type: custom:mushroom-template-card
    entity: input_select.washing_machine_status
    icon: mdi:washing-machine
    icon_color: |-
      {% if is_state('input_select.washing_machine_status','Running') -%}
        orange
      {%- else -%}
        blue
      {%- endif %}
    layout: horizontal
    primary: |-
      {% if is_state('input_select.washing_machine_status', 'Idle') %}
        Idle
      {% elif is_state('input_select.washing_machine_status', 'Running') %}
        On
      {% elif is_state('input_select.washing_machine_status', 'Complete') %}
        Full
      {% endif %}
    tap_action:
      action: navigate
      navigation_path: /lovelace/washer-dryer
    card_mod:
      style: |
        ha-state-icon {
          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);
        }
        ha-card {
          border: none;
        }
  - type: custom:mushroom-template-card
    entity: input_select.washing_machine_status
    icon: mdi:washing-machine
    icon_color: |-
      {% if is_state('input_select.washing_machine_status','Running') -%}
        orange
      {%- else -%}
        blue
      {%- endif %}
    layout: horizontal
    tap_action:
      action: navigate
      navigation_path: /lovelace/washer-dryer
    card_mod:
      style: |
        ha-state-icon {
          {{ 'animation: spin 1s linear infinite;' if is_state('input_select.washing_machine_status','Running') }}
          transform-origin: 50% 58%;
          clip-path: circle(21.7% at 50% 58%);
        }
        ha-card {
          top: -72px;
          border: none;
        }
card_mod:
  style: |
    ha-card {
      height: 47%;
      width: 100%;
    }          

@LiQuid_cOOled would you know any way to fix up the height so there is no big gap (similar to before adding in animation)?

@peterbarbosa Can you provide the entire card code? the other cards may come into play.

square: false
type: grid
cards:
  - type: custom:mushroom-template-card
    entity: sensor.thermostat_temperature
    icon: mdi:thermostat
    icon_color: |-
      {% if is_state('climate.thermostat', 'off') %}
        grey
      {% elif is_state('climate.thermostat', 'cool') %}
        blue
      {% elif is_state('climate.thermostat', 'heat') %}
        blue
      {% else %}
        gray
      {% endif %}
    primary: |+
      {% if is_state('climate.thermostat', 'off') %}
        Off
      {% elif is_state('climate.thermostat', 'cool') %}
        {{ state_attr('climate.thermostat', 'temperature') }}°C
      {% elif is_state('climate.thermostat', 'heat') %}
        {{ state_attr('climate.thermostat', 'temperature') }}°C
      {% else %}
        ???
      {% endif %}



    tap_action:
      action: navigate
      navigation_path: /lovelace/temperature
    secondary: ''
    badge_color: |-
      {% if is_state('climate.thermostat', 'off') %}
        grey
      {% elif is_state('climate.thermostat', 'cool') %}
        blue
      {% elif is_state('climate.thermostat', 'heat') %}
        red
      {% else %}
        gray
      {% endif %}
    badge_icon: |-
      {% if is_state('climate.thermostat', 'off') %}
        
      {% elif is_state('climate.thermostat', 'cool') %}
        mdi:snowflake
      {% elif is_state('climate.thermostat', 'heat') %}
        mdi:heat-wave
      {% else %}
        gray
      {% endif %}
  - type: custom:mushroom-template-card
    entity: sensor.thermostat_temperature
    icon: mdi:water-percent
    icon_color: blue
    primary: '{{ states(''sensor.thermostat_humidity'') }}% '
    tap_action:
      action: navigate
      navigation_path: /lovelace/temperature
    secondary: ''
    badge_color: |-
      {% if is_state('climate.thermostat', 'off') %}
        grey
      {% elif is_state('climate.thermostat', 'cool') %}
        blue
      {% elif is_state('climate.thermostat', 'heat') %}
        red
      {% else %}
        gray
      {% endif %}
    badge_icon: ''
  - type: custom:mushroom-template-card
    entity: climate.thermostat
    icon: mdi:fan
    icon_color: |-
      {% if is_state_attr('climate.thermostat', 'fan_mode', 'off') %}
        grey
      {% elif is_state_attr('climate.thermostat', 'fan_mode', 'on') %}
        blue
      {% endif %}
    primary: HVAC
    tap_action:
      action: navigate
      navigation_path: /lovelace/temperature
    badge_icon: ''
    badge_color: ''
    secondary: ''
    card_mod:
      style: |
        ha-state-icon { 
         {% if is_state_attr('climate.thermostat', 'fan_mode', 'on') %}
          animation: spin 1s linear infinite
         {% endif %}
        }
  - type: custom:mushroom-template-card
    entity: switch.hrv
    icon: mdi:fan
    icon_color: |-
      {% if is_state('input_boolean.hrv_status', 'off') %}
        grey
      {% elif is_state('input_boolean.hrv_status', 'on') %}
        blue
      {% endif %}
    primary: HRV
    tap_action:
      action: more-info
    badge_icon: ''
    badge_color: ''
    secondary: ''
    card_mod:
      style: |
        ha-state-icon { 
         {% if is_state('input_boolean.hrv_status', 'on') %}
          animation: spin 1s linear infinite
         {% endif %}
        }
  - type: custom:mushroom-template-card
    entity: sensor.0x00158d00097782ee_temperature
    icon: mdi:grill
    icon_color: red
    primary: 0 °C
    tap_action:
      action: more-info
    secondary: ''
    badge_color: ''
    badge_icon: ''
  - type: custom:mushroom-template-card
    entity: sensor.0x00158d00097782ee_temperature
    icon: mdi:piggy-bank-outline
    icon_color: red
    primary: 0 °C
    tap_action:
      action: more-info
    secondary: ''
    badge_color: ''
    badge_icon: ''
  - type: custom:stack-in-card
    cards:
      - type: custom:mushroom-template-card
        entity: input_select.washing_machine_status
        icon: mdi:washing-machine
        icon_color: |-
          {% if is_state('input_select.washing_machine_status','Running') -%}
            orange
          {%- else -%}
            blue
          {%- endif %}
        layout: horizontal
        primary: |-
          {% if is_state('input_select.washing_machine_status', 'Idle') %}
            Idle
          {% elif is_state('input_select.washing_machine_status', 'Running') %}
            On
          {% elif is_state('input_select.washing_machine_status', 'Complete') %}
            Full
          {% endif %}
        tap_action:
          action: navigate
          navigation_path: /lovelace/washer-dryer
        card_mod:
          style: |
            ha-state-icon {
              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);
            }
            ha-card {
              border: none;
            }
      - type: custom:mushroom-template-card
        entity: input_select.washing_machine_status
        icon: mdi:washing-machine
        icon_color: |-
          {% if is_state('input_select.washing_machine_status','Running') -%}
            orange
          {%- else -%}
            blue
          {%- endif %}
        layout: horizontal
        tap_action:
          action: navigate
          navigation_path: /lovelace/washer-dryer
        card_mod:
          style: |
            ha-state-icon {
              {{ 'animation: spin 1s linear infinite;' if is_state('input_select.washing_machine_status','Running') }}
              transform-origin: 50% 58%;
              clip-path: circle(21.7% at 50% 58%);
            }
            ha-card {
              top: -72px;
              border: none;
            }
    card_mod:
      style: |
        ha-card {
          height: 47%;
          width: 100%;
        }          
  - type: custom:mushroom-template-card
    entity: vacuum.roborock_q_revo
    icon: mdi:vacuum
    icon_color: |-
      {% if is_state('vacuum.roborock_q_revo', 'docked') %}
        blue
      {% elif is_state('vacuum.roborock_q_revo', 'cleaning') %}
        orange
      {% else %}
        gray
      {% endif %}
    primary: |-
      {% if is_state('vacuum.roborock_q_revo', 'docked') %}
        Idle
      {% elif is_state('vacuum.roborock_q_revo', 'cleaning') %}
        Clean
      {% else %}
        N/A
      {% endif %}
    tap_action:
      action: navigate
      navigation_path: /lovelace/vac
    badge_icon: ''
    badge_color: ''
    secondary: ''
    hold_action:
      action: more-info
    card_mod:
      style:
        mushroom-shape-icon$: |
          ha-state-icon { 
            {{ iif(is_state_attr('climate.thermostat', 'fan_mode', 'off'), '--icon-animation: spin 1s linear infinite;') }}
          }
  - type: custom:mushroom-template-card
    icon: |-
      {% if is_state('sensor.recycle', 'in 7 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 6 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 5 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 4 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 3 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 2 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 1 day') %}
        mdi:recycle
      {% elif is_state('sensor.garbage', 'in 7 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 6 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 5 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 4 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 3 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 2 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 1 day') %}
        mdi:trash-can-outline
      {% endif %}
    icon_color: |-
      {% if is_state('sensor.recycle', 'in 1 day') %}
        yellow
      {% elif is_state('sensor.garbage', 'in 1 day') %}
        yellow
      {% else %}
        green
      {% endif %}
    primary: |-
      {% if is_state('sensor.recycle', 'in 6 days') %}
        6 days
      {% elif is_state('sensor.recycle', 'in 5 days') %}
        5 days
      {% elif is_state('sensor.recycle', 'in 4 days') %}
        4 days
      {% elif is_state('sensor.recycle', 'in 3 days') %}
        3 days
      {% elif is_state('sensor.recycle', 'in 2 days') %}
        2 days
      {% elif is_state('sensor.recycle', 'in 1 day') %}
        1 day
      {% elif is_state('sensor.recycle', 'in 7 days') %}
        7 days
      {% elif is_state('sensor.garbage', 'in 6 days') %}
        6 days
      {% elif is_state('sensor.garbage', 'in 5 days') %}
        5 days
      {% elif is_state('sensor.garbage', 'in 4 days') %}
        4 days
      {% elif is_state('sensor.garbage', 'in 3 days') %}
        3 days
      {% elif is_state('sensor.garbage', 'in 2 days') %}
        2 days
      {% elif is_state('sensor.garbage', 'in 1 day') %}
        1 day
      {% elif is_state('sensor.garbage', 'in 7 days') %}
        7 days
      {% else %}
        green
      {% endif %}
    tap_action:
      action: none
    badge_icon: ''
    badge_color: ''
    secondary: ''
    entity: sensor.recycle
    card_mod:
      style:
        mushroom-shape-icon$: |
          ha-state-icon { 
            {{ iif(is_state_attr('climate.thermostat', 'fan_mode', 'off'), '--icon-animation: spin 1s linear infinite;') }}
          }
columns: 3


@LiQuid_cOOled see above

The animation you are using is the issue because it is using one card overlayed on another.

I switched the animation a bit and eliminated the second card. We can adjust if you don’t like it.

square: false
type: grid
cards:
  - type: custom:mushroom-template-card
    entity: sensor.thermostat_temperature
    icon: mdi:thermostat
    icon_color: |-
      {% if is_state('climate.thermostat', 'off') %}
        grey
      {% elif is_state('climate.thermostat', 'cool') %}
        blue
      {% elif is_state('climate.thermostat', 'heat') %}
        blue
      {% else %}
        gray
      {% endif %}
    primary: |+
      {% if is_state('climate.thermostat', 'off') %}
        Off
      {% elif is_state('climate.thermostat', 'cool') %}
        {{ state_attr('climate.thermostat', 'temperature') }}°C
      {% elif is_state('climate.thermostat', 'heat') %}
        {{ state_attr('climate.thermostat', 'temperature') }}°C
      {% else %}
        ???
      {% endif %}



    tap_action:
      action: navigate
      navigation_path: /lovelace/temperature
    secondary: ''
    badge_color: |-
      {% if is_state('climate.thermostat', 'off') %}
        grey
      {% elif is_state('climate.thermostat', 'cool') %}
        blue
      {% elif is_state('climate.thermostat', 'heat') %}
        red
      {% else %}
        gray
      {% endif %}
    badge_icon: |-
      {% if is_state('climate.thermostat', 'off') %}
        
      {% elif is_state('climate.thermostat', 'cool') %}
        mdi:snowflake
      {% elif is_state('climate.thermostat', 'heat') %}
        mdi:heat-wave
      {% else %}
        gray
      {% endif %}
  - type: custom:mushroom-template-card
    entity: sensor.thermostat_temperature
    icon: mdi:water-percent
    icon_color: blue
    primary: '{{ states(''sensor.thermostat_humidity'') }}% '
    tap_action:
      action: navigate
      navigation_path: /lovelace/temperature
    secondary: ''
    badge_color: |-
      {% if is_state('climate.thermostat', 'off') %}
        grey
      {% elif is_state('climate.thermostat', 'cool') %}
        blue
      {% elif is_state('climate.thermostat', 'heat') %}
        red
      {% else %}
        gray
      {% endif %}
    badge_icon: ''
  - type: custom:mushroom-template-card
    entity: climate.thermostat
    icon: mdi:fan
    icon_color: |-
      {% if is_state_attr('climate.thermostat', 'fan_mode', 'off') %}
        grey
      {% elif is_state_attr('climate.thermostat', 'fan_mode', 'on') %}
        blue
      {% endif %}
    primary: HVAC
    tap_action:
      action: navigate
      navigation_path: /lovelace/temperature
    badge_icon: ''
    badge_color: ''
    secondary: ''
    card_mod:
      style: |
        ha-state-icon { 
         {% if is_state_attr('climate.thermostat', 'fan_mode', 'on') %}
          animation: spin 1s linear infinite
         {% endif %}
        }
  - type: custom:mushroom-template-card
    entity: switch.hrv
    icon: mdi:fan
    icon_color: |-
      {% if is_state('input_boolean.hrv_status', 'off') %}
        grey
      {% elif is_state('input_boolean.hrv_status', 'on') %}
        blue
      {% endif %}
    primary: HRV
    tap_action:
      action: more-info
    badge_icon: ''
    badge_color: ''
    secondary: ''
    card_mod:
      style: |
        ha-state-icon { 
         {% if is_state('input_boolean.hrv_status', 'on') %}
          animation: spin 1s linear infinite
         {% endif %}
        }
  - type: custom:mushroom-template-card
    entity: sensor.0x00158d00097782ee_temperature
    icon: mdi:grill
    icon_color: red
    primary: 0 °C
    tap_action:
      action: more-info
    secondary: ''
    badge_color: ''
    badge_icon: ''
  - type: custom:mushroom-template-card
    entity: sensor.basement_sensor
    icon: mdi:piggy-bank-outline
    icon_color: red
    primary: 0 °C
    tap_action:
      action: more-info
    secondary: ''
    badge_color: ''
    badge_icon: ''
  - type: custom:mushroom-template-card
    entity: input_select.washing_machine_status
    primary: |-
      {% if is_state('input_select.washing_machine_status', 'Idle') %}
        Idle
      {% elif is_state('input_select.washing_machine_status', 'Running') %}
        On
      {% elif is_state('input_select.washing_machine_status', 'Complete') %}
        Full
      {% endif %}
    icon: mdi:washing-machine
    icon_color: |-
      {% if is_state('input_select.washing_machine_status','Running') -%}
        orange
      {%- else -%}
        blue
      {%- endif %}
    layout: horizontal
    tap_action:
      action: navigate
      navigation_path: /lovelace/washer-dryer
    card_mod:
      style: >
        ha-state-icon {
        {{ 'animation: shake 400ms ease-in-out infinite, drum 2s ease infinite;'
        if is_state('input_select.washing_machine_status', 'Running') else 'animation: none;' }}
        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); }
               }
  - type: custom:mushroom-template-card
    entity: vacuum.roborock_q_revo
    icon: mdi:vacuum
    icon_color: |-
      {% if is_state('vacuum.roborock_q_revo', 'docked') %}
        blue
      {% elif is_state('vacuum.roborock_q_revo', 'cleaning') %}
        orange
      {% else %}
        gray
      {% endif %}
    primary: |-
      {% if is_state('vacuum.roborock_q_revo', 'docked') %}
        Idle
      {% elif is_state('vacuum.roborock_q_revo', 'cleaning') %}
        Clean
      {% else %}
        N/A
      {% endif %}
    tap_action:
      action: navigate
      navigation_path: /lovelace/vac
    badge_icon: ''
    badge_color: ''
    secondary: ''
    hold_action:
      action: more-info
    card_mod:
      style:
        mushroom-shape-icon$: |
          ha-state-icon { 
            {{ iif(is_state_attr('climate.thermostat', 'fan_mode', 'off'), '--icon-animation: spin 1s linear infinite;') }}
          }
  - type: custom:mushroom-template-card
    icon: |-
      {% if is_state('sensor.recycle', 'in 7 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 6 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 5 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 4 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 3 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 2 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 1 day') %}
        mdi:recycle
      {% elif is_state('sensor.garbage', 'in 7 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 6 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 5 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 4 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 3 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 2 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 1 day') %}
        mdi:trash-can-outline
      {% endif %}
    icon_color: |-
      {% if is_state('sensor.recycle', 'in 1 day') %}
        yellow
      {% elif is_state('sensor.garbage', 'in 1 day') %}
        yellow
      {% else %}
        green
      {% endif %}
    primary: |-
      {% if is_state('sensor.recycle', 'in 6 days') %}
        6 days
      {% elif is_state('sensor.recycle', 'in 5 days') %}
        5 days
      {% elif is_state('sensor.recycle', 'in 4 days') %}
        4 days
      {% elif is_state('sensor.recycle', 'in 3 days') %}
        3 days
      {% elif is_state('sensor.recycle', 'in 2 days') %}
        2 days
      {% elif is_state('sensor.recycle', 'in 1 day') %}
        1 day
      {% elif is_state('sensor.recycle', 'in 7 days') %}
        7 days
      {% elif is_state('sensor.garbage', 'in 6 days') %}
        6 days
      {% elif is_state('sensor.garbage', 'in 5 days') %}
        5 days
      {% elif is_state('sensor.garbage', 'in 4 days') %}
        4 days
      {% elif is_state('sensor.garbage', 'in 3 days') %}
        3 days
      {% elif is_state('sensor.garbage', 'in 2 days') %}
        2 days
      {% elif is_state('sensor.garbage', 'in 1 day') %}
        1 day
      {% elif is_state('sensor.garbage', 'in 7 days') %}
        7 days
      {% else %}
        green
      {% endif %}
    tap_action:
      action: none
    badge_icon: ''
    badge_color: ''
    secondary: ''
    entity: sensor.recycle
    card_mod:
      style:
        mushroom-shape-icon$: |
          ha-state-icon { 
            {{ iif(is_state_attr('climate.thermostat', 'fan_mode', 'off'), '--icon-animation: spin 1s linear infinite;') }}
          }
columns: 3

chrome-capture-2024-6-18 (1)

@LiQuid_cOOled Yeah that was intentional to have it spin :slight_smile:

Do you think there is a way to keep the spin but do it without an overlay and with the height being consistent with the other columns? If not, I can settle with the one you shared.

Let me test a few things and I’ll let you know. It should be doable.

I like the spin feature :grinning:

1 Like

New version…

square: false
type: grid
cards:
  - type: custom:mushroom-template-card
    entity: sensor.thermostat_temperature
    icon: mdi:thermostat
    icon_color: |-
      {% if is_state('climate.thermostat', 'off') %}
        grey
      {% elif is_state('climate.thermostat', 'cool') %}
        blue
      {% elif is_state('climate.thermostat', 'heat') %}
        blue
      {% else %}
        gray
      {% endif %}
    primary: |
      {% if is_state('climate.thermostat', 'off') %}
        Off
      {% elif is_state('climate.thermostat', 'cool') %}
        {{ state_attr('climate.thermostat', 'temperature') }}°C
      {% elif is_state('climate.thermostat', 'heat') %}
        {{ state_attr('climate.thermostat', 'temperature') }}°C
      {% else %}
        ???
      {% endif %}
    tap_action:
      action: navigate
      navigation_path: /lovelace/temperature
    secondary: ''
    badge_color: |-
      {% if is_state('climate.thermostat', 'off') %}
        grey
      {% elif is_state('climate.thermostat', 'cool') %}
        blue
      {% elif is_state('climate.thermostat', 'heat') %}
        red
      {% else %}
        gray
      {% endif %}
    badge_icon: |-
      {% if is_state('climate.thermostat', 'off') %}
        
      {% elif is_state('climate.thermostat', 'cool') %}
        mdi:snowflake
      {% elif is_state('climate.thermostat', 'heat') %}
        mdi:heat-wave
      {% else %}
        gray
      {% endif %}
  - type: custom:mushroom-template-card
    entity: sensor.thermostat_temperature
    icon: mdi:water-percent
    icon_color: blue
    primary: '{{ states(''sensor.thermostat_humidity'') }}% '
    tap_action:
      action: navigate
      navigation_path: /lovelace/temperature
    secondary: ''
    badge_color: |-
      {% if is_state('climate.thermostat', 'off') %}
        grey
      {% elif is_state('climate.thermostat', 'cool') %}
        blue
      {% elif is_state('climate.thermostat', 'heat') %}
        red
      {% else %}
        gray
      {% endif %}
    badge_icon: ''
  - type: custom:mushroom-template-card
    entity: climate.thermostat
    icon: mdi:fan
    icon_color: |-
      {% if is_state_attr('climate.thermostat', 'fan_mode', 'off') %}
        grey
      {% elif is_state_attr('climate.thermostat', 'fan_mode', 'on') %}
        blue
      {% endif %}
    primary: HVAC
    tap_action:
      action: navigate
      navigation_path: /lovelace/temperature
    badge_icon: ''
    badge_color: ''
    secondary: ''
    card_mod:
      style: |
        ha-state-icon { 
         {% if is_state_attr('climate.thermostat', 'fan_mode', 'on') %}
          animation: spin 1s linear infinite
         {% endif %}
        }
  - type: custom:mushroom-template-card
    entity: switch.hrv
    icon: mdi:fan
    icon_color: |-
      {% if is_state('input_boolean.hrv_status', 'off') %}
        grey
      {% elif is_state('input_boolean.hrv_status', 'on') %}
        blue
      {% endif %}
    primary: HRV
    tap_action:
      action: more-info
    badge_icon: ''
    badge_color: ''
    secondary: ''
    card_mod:
      style: |
        ha-state-icon { 
         {% if is_state('input_boolean.hrv_status', 'on') %}
          animation: spin 1s linear infinite
         {% endif %}
        }
  - type: custom:mushroom-template-card
    entity: sensor.0x00158d00097782ee_temperature
    icon: mdi:grill
    icon_color: red
    primary: 0 °C
    tap_action:
      action: more-info
    secondary: ''
    badge_color: ''
    badge_icon: ''
  - type: custom:mushroom-template-card
    entity: sensor.basement_sensor
    icon: mdi:piggy-bank-outline
    icon_color: red
    primary: 0 °C
    tap_action:
      action: more-info
    secondary: ''
    badge_color: ''
    badge_icon: ''
  - type: custom:mushroom-template-card
    primary: |-
      {% if is_state('input_select.washing_machine_status', 'Idle') %}
       Idle
      {% elif is_state('input_select.washing_machine_status', 'Running') %}
       On
      {% else %}
       Full
      {% endif %}
    icon: mdi:washing-machine
    icon_color: |-
      {% if is_state('input_select.washing_machine_status','Running') -%}
        orange
      {%- else -%}
        blue
      {%- endif %}
    layout: horizontal
    tap_action:
      action: navigate
      navigation_path: /lovelace/washer-dryer
    card_mod:
      style:
        mushroom-shape-icon$: |
          .shape:after {
          content: '';
          position: absolute;
          width: 9px;
          height: 4.5px;
          border-radius: 1rem 1rem 0 0;
          background: {{ 'orange' if
          is_state('input_select.washing_machine_status','Running') else
          'black' }};
          animation: {{ 'circle 1s linear infinite'if
          is_state('input_select.washing_machine_status','Running') else
          'animation: none;' }};
          transform-origin: 52% 100%;
                }
          @keyframes circle {
          0% {transform: rotate(0deg);}
          100% {transform:rotate(360deg);}
          }
        .: >
          ha-state-icon { clip-path: polygon(0 0, 0 100%, 35% 100%, 35% 70%, 60%
          35%, 70% 50%, 65% 75%, 50% 80%, 35% 70%, 35% 100%, 100% 100%, 100% 0);
           }
  - type: custom:mushroom-template-card
    entity: vacuum.roborock_q_revo
    icon: mdi:vacuum
    icon_color: |-
      {% if is_state('vacuum.roborock_q_revo', 'docked') %}
        blue
      {% elif is_state('vacuum.roborock_q_revo', 'cleaning') %}
        orange
      {% else %}
        gray
      {% endif %}
    primary: |-
      {% if is_state('vacuum.roborock_q_revo', 'docked') %}
        Idle
      {% elif is_state('vacuum.roborock_q_revo', 'cleaning') %}
        Clean
      {% else %}
        N/A
      {% endif %}
    tap_action:
      action: navigate
      navigation_path: /lovelace/vac
    badge_icon: ''
    badge_color: ''
    secondary: ''
    hold_action:
      action: more-info
    card_mod:
      style:
        mushroom-shape-icon$: |
          ha-state-icon { 
            {{ iif(is_state_attr('climate.thermostat', 'fan_mode', 'off'), '--icon-animation: spin 1s linear infinite;') }}
              }
  - type: custom:mushroom-template-card
    icon: |-
      {% if is_state('sensor.recycle', 'in 7 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 6 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 5 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 4 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 3 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 2 days') %}
        mdi:recycle
      {% elif is_state('sensor.recycle', 'in 1 day') %}
        mdi:recycle
      {% elif is_state('sensor.garbage', 'in 7 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 6 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 5 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 4 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 3 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 2 days') %}
        mdi:trash-can-outline
      {% elif is_state('sensor.garbage', 'in 1 day') %}
        mdi:trash-can-outline
      {% endif %}
    icon_color: |-
      {% if is_state('sensor.recycle', 'in 1 day') %}
        yellow
      {% elif is_state('sensor.garbage', 'in 1 day') %}
        yellow
      {% else %}
        green
      {% endif %}
    primary: |-
      {% if is_state('sensor.recycle', 'in 6 days') %}
        6 days
      {% elif is_state('sensor.recycle', 'in 5 days') %}
        5 days
      {% elif is_state('sensor.recycle', 'in 4 days') %}
        4 days
      {% elif is_state('sensor.recycle', 'in 3 days') %}
        3 days
      {% elif is_state('sensor.recycle', 'in 2 days') %}
        2 days
      {% elif is_state('sensor.recycle', 'in 1 day') %}
        1 day
      {% elif is_state('sensor.recycle', 'in 7 days') %}
        7 days
      {% elif is_state('sensor.garbage', 'in 6 days') %}
        6 days
      {% elif is_state('sensor.garbage', 'in 5 days') %}
        5 days
      {% elif is_state('sensor.garbage', 'in 4 days') %}
        4 days
      {% elif is_state('sensor.garbage', 'in 3 days') %}
        3 days
      {% elif is_state('sensor.garbage', 'in 2 days') %}
        2 days
      {% elif is_state('sensor.garbage', 'in 1 day') %}
        1 day
      {% elif is_state('sensor.garbage', 'in 7 days') %}
        7 days
      {% else %}
        green
      {% endif %}
    tap_action:
      action: none
    badge_icon: ''
    badge_color: ''
    secondary: ''
    entity: sensor.recycle
    card_mod:
      style:
        mushroom-shape-icon$: |
          ha-state-icon { 
            {{ iif(is_state_attr('climate.thermostat', 'fan_mode', 'off'), '--icon-animation: spin 1s linear infinite;') }}
          }
columns: 3

chrome-capture-2024-6-19

2 Likes

Amazing. This is much better then my original implementation :slight_smile: Thanks for looking into it and sharing.

I’ve created some animations for my grill icons for mushroom-template-card if anyone would like to re-use.

Grill Pit Icon:

type: custom:mushroom-template-card
entity: sensor.grill_pit
icon: mdi:grill
icon_color: red
primary: ''
tap_action:
  action: more-info
secondary: 0 °C
badge_color: ''
badge_icon: ''
card_mod:
  style: |
    ha-state-icon {
     {{ 'animation: clip 2s linear infinite;' if is_state('sensor.grill_pit', 'on') }}
    }
    @keyframes clip {
     100% { clip-path: polygon(12% 0, 84% 0, 100% 100%, 0% 100%); }     
     80% { clip-path: polygon(10% 10%, 83% 10%, 100% 100%, 0% 100%); }     
     60% { clip-path: polygon(14% 18%, 83% 17%, 100% 100%, 0% 100%); }
     40% { clip-path: polygon(15% 30%, 86% 30%, 100% 100%, 0% 100%); }     
     20% { clip-path: polygon(15% 30%, 86% 30%, 100% 100%, 0% 100%); }
    }

For the food probe(s):

type: custom:mushroom-template-card
entity: sensor.food_probe_1
icon: mdi:food-turkey
icon_color: red
primary: ''
tap_action:
  action: more-info
secondary: 0 °C
badge_color: ''
badge_icon: ''
card_mod:
  style: |
    ha-state-icon {
     {{ 'animation: clip 4s linear infinite;' if is_state('sensor.food_probe_1', 'on') }}
    }
    @keyframes clip {
     100% { clip-path: polygon(66% 0, 73% 5%, 94% 18%, 100% 35%, 100% 100%, 0 100%, 0 80%, 0% 43%, 0 0); }     
     80% { clip-path: polygon(45% 0, 67% 13%, 92% 30%, 100% 35%, 100% 100%, 0 100%, 0 80%, 0% 43%, 0 0); }     
     60% { clip-path: polygon(39% 3%, 64% 21%, 91% 35%, 100% 42%, 100% 100%, 0 100%, 0 80%, 0% 43%, 0 0); }
     40% { clip-path: polygon(37% 9%, 62% 26%, 90% 42%, 100% 63%, 100% 100%, 0 100%, 0 80%, 0% 43%, 0 0); }     
     20% { clip-path: polygon(36% 15%, 61% 34%, 85% 58%, 100% 78%, 100% 100%, 0 100%, 0 80%, 0% 43%, 0 0); }
    }
1 Like

The icon looks slightly off (I guess the clipped piece that is spinning. Is there any way to resolve that? I’m happy to settle on this though - it’s great!

Screenshot 2024-06-19 110953

I’ll see if I can tweak it.

Let’s try another method

chrome-capture-2024-6-19 (2)

  type: custom:mushroom-template-card
entity: input_select.washing_machine_status
primary: |-
  {% if is_state(config.entity, 'Idle') %}
   Idle
  {% elif is_state(config.entity, 'Running') %}
   On
  {% else %}
   Full
  {% endif %}
icon: mdi:washing-machine
icon_color: |-
  {% if is_state(config.entity, 'Running') -%}
    orange
  {%- else -%}
    blue
  {%- endif %}
layout: horizontal
tap_action:
  action: navigate
  navigation_path: /lovelace/washer-dryer
card_mod:
  style:
    mushroom-shape-icon$: |
      .shape:before {
       content: '';
       z-index: 1;
       position: absolute;
       width: 24%;
       height: 12%;
       border: 1px solid black;
       border-radius: 1rem 1rem 0 0;
       background: {{ 'deepskyblue' if
        is_state(config.entity, 'on') else
        'black' }};
       animation: {{ 'circle 2s linear infinite alternate'if
        is_state(config.entity, 'on') else
        'animation: none;' }};
       transform-origin: 50% 85%;
           }
       @keyframes circle {
       0% {transform: rotate(0deg);}
       100% {transform:rotate(360deg);}
        }
      .shape:after {
       content: '';
       position: absolute;
       width: 27%;
       height: 27%;
       border-radius: 100%;
       border: 1px solid black !important;
       background:black;
       top: 16px
        }
badge_icon: ''
badge_color: ''

4 Likes

Hi mate.

Any idea how to do this weather template that was part of rhysb’s original card, been broken since weather changes couple releases ago and can’t figure it :frowning:

      - type: custom:mushroom-template-card
        primary: '{{ state_attr(entity, ''temperature'') | round(1) | float(0) }} °C'
        secondary: >-
          {% set condition = state_attr(entity, 'forecasts')[0]['conditions'] %}
          {% set intensity = states('weather.tomorrow_io_home_daily') %}

          {% if intensity != 'None' %}
            {% set condition = intensity + "mm" ' Rain' %}
          {% endif %}

          {{ condition }}
        icon: ' '
        entity: weather.tomorrow_io_home_daily
        picture: >-
          {% set condition = states(entity)  %}

          {% set intensity = states('weather.tomorrow_io_home_daily') |
          replace(" ", "-") | lower %}

          {% if condition == 'partlycloudy' and is_state('sun.sun',
          'below_horizon') %}
            {% set condition = condition + '-night' %}
          {% endif %}

          {% if intensity != 'none' and condition != 'lightning' %}
            {% set condition = intensity %}
          {% endif %}

          /local/weather_icons/anim/{{ condition }}.svg
1 Like

Have you got a screenshot of what it is meant to look like?

IMG_3960
IMG_3959
Top is now, other is before

So the words Partly Cloudy are missing?

Or sunny or cloudy yes, but also if rain is forecast it would say 22mm, rain for example

Where is the link to the original location you got this card config from?