Mushroom Cards - Build a beautiful dashboard easily πŸ„ (Part 2)

Can I please ask how to make the coloring of my icon work based on the SOC?

Code not working (chips)
type: horizontal-stack
cards:
  - type: custom:mushroom-chips-card
    chips:
      - type: entity
        entity: weather.forecast_hjem
      - type: entity
        entity: sensor.victron_bluetooth_state_of_charge
        icon_color: |
          {% set soc = states(entity) | int %}
          {% if soc > 35 %} 
            #4caf50
          {% elif soc > 25 %}
            orange
          {% else %}
            red
          {% endif %} 
        tap_action:
          action: navigate
          navigation_path: /lovelace/1
        hold_action:
          action: more-info
      - type: alarm-control-panel
        entity: alarm_control_panel.alarmo
    alignment: center

As it works now it defaults to black, but the following works just fine:

Code working (not chips)
type: custom:stack-in-card
cards:
  - type: custom:layout-card
    layout_type: custom:grid-layout
    layout:
      grid-template-columns: 42px auto
      margin: '-4px -4px -8px -4px;'
    cards:
      - type: custom:mushroom-template-card
        entity: sensor.victron_bluetooth_state_of_charge
        icon: |
          {% set soc = states(entity) | int %}
          {% if soc > 90 %} 
            mdi:battery-90
          {% elif soc > 80 %}
            mdi:battery-80
          {% elif soc > 70 %}
            mdi:battery-70
          {% elif soc < 60 %}
            mdi:battery-60
          {% elif soc < 50 %}
            mdi:battery-50
          {% elif soc < 40 %}
            mdi:battery-40
          {% elif soc > 30 %}
            mdi:battery-30
          {% elif soc > 20 %}
            mdi:battery-20
          {% else %}
            mdi:battery-10
          {% endif %} 
        icon_color: |
          {% set soc = states(entity) | int %}
          {% if soc > 35 %} 
            #4caf50
          {% elif soc > 25 %}
            orange
          {% else %}
            red
          {% endif %} 
        card_mod:
          style: |
            ha-card {
              background: none;
              border: none;
              }
      - type: custom:bar-card
        entity: sensor.victron_bluetooth_state_of_charge
        name: Forbruksbatteri
        height: 42px
        min: '0'
        max: '100'
        entity_row: true
        severity:
          - color: rgb(var(--mush-rgb-green))
            from: 35
            to: 100
          - color: rgb(var(--mush-rgb-orange))
            from: 25
            to: 35
          - color: rgb(var(--mush-rgb-red))
            from: 0
            to: 25
        positions:
          icon: 'off'
          indicator: 'off'
        card_mod:
          style: |
            ha-card {
              padding: 12px;
              border: none;
              margin-left: 20px;
              --bar-card-border-radius: 12px;
              --mush-rgb-red: 244, 67, 54;
              --mush-rgb-pink: 233, 30, 99;
              --mush-rgb-purple: 156, 39, 176;
              --mush-rgb-deep-purple: 103, 58, 183;
              --mush-rgb-indigo: 63, 81, 181;
              --mush-rgb-blue: 33, 150, 243;
              --mush-rgb-light-blue: 3, 169, 244;
              --mush-rgb-cyan: 0, 188, 212;
              --mush-rgb-teal: 0, 150, 136;
              --mush-rgb-green: 76, 175, 80;
              --mush-rgb-light-green: 139, 195, 74;
              --mush-rgb-lime: 205, 220, 57;
              --mush-rgb-yellow: 255, 235, 59;
              --mush-rgb-amber: 255, 193, 7;
              --mush-rgb-orange: 255, 152, 0;
              --mush-rgb-deep-orange: 255, 87, 34;
              --mush-rgb-brown: 121, 85, 72;
              --mush-rgb-grey: 158, 158, 158;
              --mush-rgb-blue-grey: 96, 125, 139;
              --mush-rgb-black: 0, 0, 0;
              --mush-rgb-white: 255, 255, 255;
            }
            bar-card-value {
              margin: 12px;
              font-size: 12px;
              font-weight: bolder;
            }
            bar-card-name {
              margin: 12px;
              font-size: 12px;
              font-weight: bolder;
            }
            bar-card-backgroundbar {
              opacity: 0.2;
              filter: brightness(1);
            }

image

The battery is the one I am trying to template.

I use the below for this and works perfect

- type: template
        entity: sensor.iphone_van_kevin_battery_level
        content: '{{ states(''sensor.iphone_van_kevin_battery_level'') }} %'
        icon: |2
                    {% set bl = states('sensor.iphone_van_kevin_battery_level') | int %}
                    {% if bl < 10 %} mdi:battery-outline
                    {% elif bl < 20 %} mdi:battery-10
                    {% elif bl < 30 %} mdi:battery-20
                    {% elif bl < 40 %} mdi:battery-30
                    {% elif bl < 50 %} mdi:battery-40
                    {% elif bl < 60 %} mdi:battery-50
                    {% elif bl < 70 %} mdi:battery-60
                    {% elif bl < 80 %} mdi:battery-70
                    {% elif bl < 90 %} mdi:battery-80
                    {% elif bl < 100 %} mdi:battery-90
                    {% elif bl == 100 %} mdi:battery
                    {% else %} mdi:battery-unknown
                    {% endif %}
        icon_color: |2-
                    {% set bl = states('sensor.iphone_van_kevin_battery_level') | int %}
                    {% if bl < 10 %} red
                    {% elif bl < 20 %} red
                    {% elif bl < 30 %} red
                    {% elif bl < 40 %} orange
                    {% elif bl < 50 %} orange
                    {% elif bl < 60 %} green
                    {% elif bl < 70 %} green
                    {% elif bl < 80 %} green
                    {% elif bl < 90 %} green
                    {% elif bl < 100 %} green
                    {% elif bl == 100 %} green
                    {% else %} grey
                    {% endif %}

I think it’s not working for you as you use the state of charge instead of the battery level?

1 Like

Yeah that works for normal cards, but the problem is the chip card. Maybe I need to use CSS and Card Mod?

I have this inside the chip card.

- type: custom:mushroom-chips-card
    chips:
      - type: template
        icon: |2-
            {% if is_state(entity, 'Charging') %}
            mdi:power-plug
            {% else %}
            mdi:power-plug-off
            {% endif %}
        icon_color: |2-
            {% if is_state(entity, 'Charging') %}
            green
            {% else %}
            grey
            {% endif %}
        entity: sensor.iphone_van_kevin_battery_state
        tap_action:
          action: more-info
      - type: template
        entity: sensor.iphone_van_kevin_battery_level
        content: '{{ states(''sensor.iphone_van_kevin_battery_level'') }} %'
        icon: |2
                    {% set bl = states('sensor.iphone_van_kevin_battery_level') | int %}
                    {% if bl < 10 %} mdi:battery-outline
                    {% elif bl < 20 %} mdi:battery-10
                    {% elif bl < 30 %} mdi:battery-20
                    {% elif bl < 40 %} mdi:battery-30
                    {% elif bl < 50 %} mdi:battery-40
                    {% elif bl < 60 %} mdi:battery-50
                    {% elif bl < 70 %} mdi:battery-60
                    {% elif bl < 80 %} mdi:battery-70
                    {% elif bl < 90 %} mdi:battery-80
                    {% elif bl < 100 %} mdi:battery-90
                    {% elif bl == 100 %} mdi:battery
                    {% else %} mdi:battery-unknown
                    {% endif %}
        icon_color: |2-
                    {% set bl = states('sensor.iphone_van_kevin_battery_level') | int %}
                    {% if bl < 10 %} red
                    {% elif bl < 20 %} red
                    {% elif bl < 30 %} red
                    {% elif bl < 40 %} orange
                    {% elif bl < 50 %} orange
                    {% elif bl < 60 %} green
                    {% elif bl < 70 %} green
                    {% elif bl < 80 %} green
                    {% elif bl < 90 %} green
                    {% elif bl < 100 %} green
                    {% elif bl == 100 %} green
                    {% else %} grey
                    {% endif %}
        tap_action:
          action: more-info

Good day everyone. I have another question about template chip cards. Is it possible to add second line in content? I have a fridge chip and I want to see a Voltage (120V) and Current(2 Amp) for example, I add voltage line , but don’t know how to add Current behind V

  - type: template
    entity: switch.kitchen_refrigerator
    icon: mdi:fridge
    icon_color: '{{ ''red'' if is_state(entity, ''off'') }}'
    content: '{{ states(''sensor.kitchen_refrigerator_energy_voltage'') | round(0) }} V'
card_mod:
  style:
    mushroom-template-chip:nth-child(8)$: |
      ha-state-icon {
        {% if is_state('switch.kitchen_refrigerator', 'off') %}
          animation: fire 1.5s infinite;
          transform-origin: 50% 85%;
        {% else %}

        {% endif %}
      }
      @keyframes fire {
        0% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        5% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        10% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        15% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        20% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        25% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        30% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        35% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        40% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        45% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        50% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        55% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        60% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        65% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        70% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        75% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        80% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        85% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        90% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        95% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        100% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
      }
    .: |
      ha-card {
        #border: 1px solid lightgrey !important;
        border-radius: 20px !important;
        box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.2) !important;
        background: none !important;
        --chip-background: none;
       --chip-border: none !important;
        --chip-box-shadow: none !important;
        --chip-spacing: 0px;

      }

image
second entity: sensor.kitchen_refrigerator_energy_current
Thank you

maybe of no help, but for simplicity you could make a template sensor and combine them.

1 Like

Not a bad idea, thank you, will do this if it’s no other solution

Great idea!!

Did you see my response to Iona two days ago. You can shrink a template-card down to look just like a chip and have secondary information.

type: custom:mushroom-template-card
primary: Living Room
secondary: Secondary
icon: mdi:sofa
icon_color: black
card_mod:
  style:
    mushroom-shape-icon$: |
      .shape {
        background: none !important;
        left: -10px;
           }
    mushroom-state-info$: |
      .primary {
        margin-left: -14px !important;
        font-weight: bolder !important;
        }
      .secondary {
        margin-top: -8px !important;
        margin-left: -8px !important;
        }
    .: |
      ha-card {
        border-radius: 15px 15px 15px 15px;
        height: 30px !important;
        width: 125px;
        --card-primary-font-size: 10px;
        --card-secondary-font-size: 8px; 
        }

image

1 Like

Yes, but it’s for template card, not for chip template card, I thought . This chip is part of chips card
Will try now.

I think, I founded the way how to do this. Thank you @Frosty for idea and @LiQuid_cOOled for everything what he tell me before this question and point to post to Iona

  - type: template
    entity: switch.kitchen_refrigerator
    icon: mdi:fridge
    icon_color: '{{ ''red'' if is_state(entity, ''off'') }}'
    content: '{{ states(''sensor.kitchen_refrigerator_energy_voltage'') | round(0) }} V'
    tap_action:
      action: none
    hold_action:
      action: none
  - type: template
    entity: sensor.kitchen_refrigerator_energy_current
    content: '{{ states(''sensor.kitchen_refrigerator_energy_current'') | round(0) }} A | {{ states(''sensor.kitchen_refrigerator_energy_power'') | round(0) }} W'  
alignment: center
card_mod:
  style:
    mushroom-template-chip:nth-child(9)$: |
      ha-state-icon {
        {% if is_state('switch.kitchen_refrigerator', 'off') %}
          animation: fire 1.5s infinite;
          transform-origin: 50% 85%;
        {% else %}

        {% endif %}
      }
      @keyframes fire {
        0% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        5% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        10% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        15% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        20% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        25% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        30% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        35% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        40% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        45% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        50% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        55% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        60% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        65% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        70% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        75% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        80% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        85% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        90% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
        95% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-red)); opacity: {{range(7, 10) | random / 10}}; }
        100% { transform: rotate({{range(-20, 20) | random / 10}}deg) scaleY({{range(9, 12) | random / 10}}); color: rgb(var(--rgb-deep-orange)); opacity: {{range(7, 10) | random / 10}}; }
      }
    .: |
      ha-card {
        #border: 1px solid lightgrey !important;
        border-radius: 20px !important;
        box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.2) !important;
        background: none !important;
        --chip-background: none;
       --chip-border: none !important;
        --chip-box-shadow: none !important;
        --chip-spacing: 0px;

      }

image

Updated to exactly what I want:

  - type: template
    entity: switch.kitchen_refrigerator
    icon: mdi:fridge
    icon_color: '{{ ''red'' if is_state(entity, ''off'') }}'
    content: >-
      {{ states('sensor.kitchen_refrigerator_energy_voltage') | round(0) }} V /
      {{ states('sensor.kitchen_refrigerator_energy_current') | round(0) }} A /
      {{ states('sensor.kitchen_refrigerator_energy_power') | round(0) }} W 
    tap_action:
      action: none
    hold_action:
      action: none
    alignment: end

image

2 Likes

Were you ever able to get this fixed?

Hi everyone, I would like to insert a button on this card on the right side that starts an automation (sending me a report of the daily and monthly electricity costs, I have everything ready) but I really can’t insert a button that does this, I I turn to those who have more experience than me, can you help me, thank you all.


type: custom:stack-in-card
cards:
  - type: custom:layout-card
    layout_type: grid
    layout:
      width: 100%
      grid-template-columns: auto
      grid-template-rows: auto
    cards:
      - type: custom:mushroom-template-card
        primary: Consumo Casa
        secondary: '{{ states(''sensor.consumi_mensili'') | int }} kWh'
        icon: mdi:lightning-bolt
        entity: sensor.prezzo_attuale_energia_al_dettaglio
        icon_color: blue
        tap_action:
          action: more-info
        fill_container: true
        card_mod:
          style: |
            :host {
              --mush-icon-size: 86px;
              height: 50px;
              margin-left: -35px !important;
              
            }
            ha-card {
              box-shadow: none;
              width: 232px;
            }
      - type: horizontal-stack
        cards:
          - type: custom:mushroom-chips-card
            chips:
              - type: template
                content: '{{ states(''sensor.prezzo_attuale_energia_al_dettaglio'') }}€'
                icon: mdi:currency-eur
                entity: sensor.prezzo_attuale_energia_al_dettaglio
                tap_action:
                  action: more-info
                hold_action:
                  action: none
                double_tap_action:
                  action: none
                card_mod:
                  style: |
                    ha-card {
                      margin-top: 5px;                    
                      --chip-height: 40px;                     
                      --chip-box-shadow: none;
                      --chip-background: none;
                      --chip-spacing: 0;
                      width: 65px !important;
                    }      
              - type: template
                content: '{{ states(''sensor.costo_energia_elettrica_mese'') | round(2)}}'
                icon: mdi:currency-eur
                entity: sensor.costo_energia_elettrica_mese
                tap_action:
                  action: more-info
                hold_action:
                  action: none
                double_tap_action:
                  action: none
                card_mod:
                  style: |
                    ha-card {
                      margin-top: 5px;                    
                      --chip-height: 40px;                     
                      --chip-box-shadow: none;
                      --chip-background: none;
                      --chip-spacing: 0;
                      width: 65px !important;
                    }                          
            alignment: end
            card_mod:
              style: |
                ha-card {
                  position: absolute;
                  top: 10px;
                  right: 20px;
                  --chip-spacing: 1px;
                }


1 Like

Hello, how can I make it so that instead of the on/off status it will be shown at what percentage of power the fan is operating? I didn’t find my solution in the examples above…
fan

type: custom:mushroom-template-card
entity: fan.ventilation_pwm_fan1
secondary: '{{states(''fan.ventilation_pwm_fan1'')}} %'
tap_action:
  action: toggle
icon: mdi:fan
layout: vertical
icon_color: |
  {{ 'blue' if is_state(config.entity, 'on') else 'grey' }}
primary: Fan
fill_container: false
multiline_secondary: false
card_mod:
  style:
    mushroom-shape-icon$: |
      .shape {
       }
    .: |
      ha-state-icon {

          {% set pwr = states(config.entity) %} 
          {% set perc = state_attr(config.entity,'percentage')|int %}

          {% if (perc <= 17 and pwr == 'on') %} animation: rotation 2.5s linear infinite
          {% elif (perc <= 34 and pwr == 'on') %} animation: rotation 2s linear infinite
          {% elif (perc <= 51 and pwr == 'on') %} animation: rotation 1.5s linear infinite
          {% elif (perc <= 67 and pwr == 'on') %} animation: rotation 1s linear infinite
          {% elif (perc <= 84 and pwr == 'on') %} animation: rotation .75s linear infinite
          {% elif (perc <= 100 and pwr == 'on') %} animation: rotation .5s linear infinite
          {%- else  %} animation: rotation 0s linear infinite
                
          {% endif %};
           }
        ha-card {
          box-shadow: none;
          margin-left: -0px !important;
          margin-right: 0px !important;
          margin-bottom: 0px !important;
          #width: 75%;
        }
          @keyframes rotation {
          0% {transform: rotate(0deg);}
          100% {transform: rotate(-360deg);
          }

Thanks mate! Changed to template chip card and that did the trick :slight_smile:

image

Summary
type: template
entity: sensor.victron_bluetooth_state_of_charge
content: '{{ states(entity) | round(0) }}%'
tap_action:
  action: navigate
  navigation_path: /lovelace/1
icon: |
  {% set soc = states(entity) | int %}
  {% if soc > 90 %} 
    mdi:battery-90
  {% elif soc > 80 %}
    mdi:battery-80
  {% elif soc > 70 %}
    mdi:battery-70
  {% elif soc > 60 %}
    mdi:battery-60
  {% elif soc > 50 %}
    mdi:battery-50
  {% elif soc > 40 %}
    mdi:battery-40
  {% elif soc > 30 %}
    mdi:battery-30
  {% elif soc > 20 %}
    mdi:battery-20
  {% else %}
    mdi:battery-10
  {% endif %} 
icon_color: |
  {% set soc = states(entity) | int %}
  {% if soc > 35 %} 
    #4caf50
  {% elif soc > 25 %}
    orange
  {% else %}
    red
  {% endif %}
1 Like

chrome_XXzGm0KIvl

Id love to have volume buttons on my sonos card but the volume buttons dont work. Does anyone know how to replicate it with card mod perhapse?

square: false
type: grid
cards:
  - type: custom:mushroom-media-player-card
    entity: media_player.sonos_woonkamer
    volume_controls:
      - volume_mute
      - volume_set
      - volume_buttons
    name: Sonos
  - type: custom:mushroom-media-player-card
    entity: media_player.shield_woonkamer
    volume_controls:
      - volume_mute
      - volume_set
      - volume_buttons
    name: Shield
columns: 2

If no one has answered Ill help tomorrow. Out of gas :sleeping:

you could recreate the card and use a service call for the volume.

type: custom:stack-in-card
cards:
  - type: vertical-stack
    cards:
      - type: custom:mushroom-template-card
        card_mod:
          style: |
            ha-card {
              border: none;
              box-shadow: none;
              ha-card-border-width: 0px;
            }
        primary: Shield
        secondary: Uit
        icon: mdi:television
        entity: media_player.lg_webos_tv_uk6470plc_2
      - type: horizontal-stack
        cards:
          - type: custom:mushroom-template-card
            card_mod:
              style:
                mushroom-shape-icon$: |
                  .shape {
                    width: 50px !important;
                    border-radius: 10px !important;
                  }
                .: |
                  ha-card {
                    border: none;
                    box-shadow: none;
                    ha-card-border-width: 0px;
                    margin-top: -20px;
                  }
            primary: ''
            secondary: ''
            icon: mdi:volume-mute
            tap_action:
              action: call-service
              service: media_player.volume_mute
              target:
                entity_id: media_player.lg_webos_tv_uk6470plc_2
              data:
                is_volume_muted: false
          - type: custom:mushroom-template-card
            card_mod:
              style:
                mushroom-shape-icon$: |
                  .shape {
                    width: 50px !important;
                    border-radius: 10px !important;
                  }
                .: |
                  ha-card {
                    border: none;
                    box-shadow: none;
                    ha-card-border-width: 0px;
                    margin-left: -70px;
                    margin-top: -20px;
                  }
            primary: ''
            secondary: ''
            icon: mdi:volume-minus
            tap_action:
              action: call-service
              service: media_player.volume_down
              target:
                entity_id: media_player.lg_webos_tv_uk6470plc_2
          - type: custom:mushroom-template-card
            card_mod:
              style:
                mushroom-shape-icon$: |
                  .shape {
                    width: 50px !important;
                    border-radius: 10px !important;
                  }
                .: |
                  ha-card {
                    border: none;
                    box-shadow: none;
                    ha-card-border-width: 0px;
                    margin-left: -140px;
                    margin-top: -20px;
                  }
            secondary: ''
            icon: mdi:volume-plus
            tap_action:
              action: call-service
              service: media_player.volume_down
              target:
                entity_id: media_player.lg_webos_tv_uk6470plc_2
1 Like

Thanks very much!! Its almost perfect! Just the color has to be the same :smiley:
image

1 Like