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

I am not 100% sure.
but until someone corrects me with the right answer I would look at these two in your themes yaml file.

 
      # Home Assistant override
  ha-card-box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.16)
  ha-card-border-width: 1px

This doesnā€™t affect Mushroom cards unfortunately.

Edit: Hereā€™s the fix, if anyone is interested. :wink:

 card-mod-card: |
     mushroom-shape-icon {
        --shape-color: none !important; 
        --shape-color-disabled: none;
      }
1 Like

sorry I completely missed the little black line. I thought you were pointing to the card border.

This was exactly what i was looking for. Thank you!

no problem if you wanted them closer together you can add some margin. like this.

type: custom:stack-in-card
cards:
  - type: vertical-stack
    cards:
      - type: custom:mushroom-entity-card
        card_mod:
          style: |
            ha-card {
              border: 0px;
              box-shadow: none;
              }
        entity: light.diner
        name: Sprinkler
        icon: mdi:sprinkler
      - type: custom:mushroom-number-card
        card_mod:
          style: |
            ha-card {
              border: 0px;
              box-shadow: none;
              margin-top: -20px
              } 
        entity: input_number.daily_energy_cost
        display_mode: buttons
        primary_info: none
        secondary_info: none
        icon_type: none

Hi there!

Guys, in chipā€™s ha-card:after is possible to set color of border line?

image

        - type: template
          entity: sensor.electricity_input_wh_to_kwh_bimonthly
          content: "{{ states('sensor.electricity_input_wh_to_kwh_bimonthly') }} kWh"
          icon: mdi:calendar-weekend
          icon_color: "#44739e"
          tap_action:
            action: more-info
          double_tap_action:
            action: none
          hold_action:
            action: more-info
          card_mod:
            style: |
              ha-card:after {
                content: "{{ states('sensor.money_total_bimonthly') }} Š³Ń€Š½";
                position: absolute;
                display: flex;
                justify-content: center;
                align-items: center;
                background: rgb(var(--rgb-white));
                color: black;
                font-weight: bolder;
                border-radius: 15px 15px 15px 15px;
                top: -5px;
                right: -5px;
                width: 50px;
                height: 11px;
                font-size: 10px;
              }

Yes add border: 2px solid red;
image

type: custom:mushroom-chips-card
chips:
        - type: template
          entity: sensor.electricity_input_wh_to_kwh_bimonthly
          content: "{{ states('sensor.electricity_input_wh_to_kwh_bimonthly') }} kWh"
          icon: mdi:calendar-weekend
          icon_color: "#44739e"
          tap_action:
            action: more-info
          double_tap_action:
            action: none
          hold_action:
            action: more-info
          card_mod:
            style: |
              ha-card:after {
                content: "{{ states('sensor.money_total_bimonthly') }} Š³Ń€Š½";
                position: absolute;
                display: flex;
                justify-content: center;
                align-items: center;
                background: rgb(var(--rgb-white));
                color: black;
                font-weight: bolder;
                border-radius: 15px 15px 15px 15px;
                border: 2px solid red;
                top: -5px;
                right: -5px;
                width: 50px;
                height: 11px;
                font-size: 10px;
              }
1 Like

I want to implement this across my entire dashboard using my theme, instead of having to add it to each card individually.

Can someone help me figure out how to solve this?

    card_mod:
      style:
        mushroom-shape-icon$: |
          .shape {
            background: none !important;
          }

You can put it in your configuration.yaml file. Here is an extract from mine, where I wanted the same effect replicated across all cardsā€¦

frontend:
  themes:
    Mushroom Custom:
      card-mod-theme: "Mushroom Custom"
      card-mod-card: |
        ha-card:active {
          background: rgba(var(--rgb-disabled), 0.1);
          transition: 0s;
        }
2 Likes

Iā€™m unable to insert that. Iā€™m using this theme, can it be inserted into that file?


####################### LIGHT MODE ####################
MiniHass_Light:

contrast

contrast-0: ā€œ#ffffffā€
contrast-10: ā€œ#F2F2F2ā€
contrast-20: ā€œ#e5e5e5ā€
contrast-33: ā€œ#888888ā€
contrast-66: ā€œ#444444ā€
contrast-100: ā€œ#000000ā€

main interface colors

color-green: ā€œ#39bb4fā€
color-yellow: rgb(253 204 18)
color-blue: rgba(159,204,250,1)
ā€¦

according to @sooty post it has to be in the configuration.yaml file. should be at the top of that file

you will more than likely already have this.

#Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

Is there a option to show the time for last-changed in a mushroom card like in this sample:
IMG_0898
I need this to see, how long a state is actually on

This my code, it works but in english. Can I change it?

{{ relative_time(states.switch.Pool_0.last_updated) }}

I need hours and minutes whe the device is on for more than 60minutes not only hours.

Hi @Stevengerrard08, I tend to bumble my way through this stuff largely by making lots of mistakes. However, to get this working I referenced these two documents around Card-Mod Themes which you may also find helpfulā€¦

You can have a look for the hacs integration easy time. There you have many options. Also to translate

Here is one example: {{ easy_relative_time(states.sensor.my_energy_meter.last_updated, language= 'de') }}

GrĆ¼ĆŸe

2 Likes

I really like the style of these cards and itā€™s nice to see other projects adopting the same principles (eg. Timer Card), gives the whole experience a uniform feel.

What i was missing was a card with the information a gauge card can give, an indication of the position of a value in a range and itā€™s severity. The original gauge card feels a bit bulky, especially compared with the mushroom guidelines. The same info can be given with the Bar Card, but its style also doesnā€™t match with what i want.

I tried to tweak the styling with css, I shared the code for those interested in this post.

5 Likes

Is it possible to animate a chip card icon? If so, how? I could not find anything helpful in this post or this other one, this is how my card config looks like:

type: custom:mushroom-chips-card
chips:
  - type: entity
    entity: person.person_1
    hold_action:
      action: none
    double_tap_action:
      action: none
    use_entity_picture: true
    content_info: name
    icon_color: primary
  - type: conditional
    conditions:
      - condition: state
        entity: group.all_lights
        state: "on"
    chip:
      type: template
      icon: mdi:lightbulb
      icon_color: amber
      content: >-
        {{ expand(states.group.all_lights) | selectattr( 'state', 'eq', 'on') |
        list | count }}
      tap_action:
        action: none
      hold_action:
        action: none
      double_tap_action:
        action: none
  - type: conditional
    conditions:
      - condition: state
        entity: fan.all_fans
        state: "on"
    chip:
      type: template
      tap_action:
        action: none
      hold_action:
        action: none
      double_tap_action:
        action: none
      icon: mdi:fan
      icon_color: blue
      content: >-
        {{ expand(states.fan.all_fans) | selectattr( 'state', 'eq', 'on') | list | count }}
      card_mod:
        style: |
          ha-state-icon {
            {% if is_state(config.entity, 'on') %}
                animation: rotate .5s infinite linear}
                @keyframes rotate {
                    0% {
                        transform: rotate(0deg);
                    }
                    100% {
                        transform: rotate(-359deg);
                    }
                }
           {% endif %}
           }
  - type: conditional
    conditions:
      - condition: state
        entity: group.door_windows_sensors
        state: "on"
    chip:
      type: template
      tap_action:
        action: none
      hold_action:
        action: none
      double_tap_action:
        action: none
      icon: mdi:door-sliding-open
      icon_color: red
      content: >-
        {{ expand(states.group.door_windows_sensors) | selectattr( 'state', 'eq', 'on') | list | count }}
  - type: conditional
    conditions:
      - condition: numeric_state
        entity: sensor.batteries_status
        below: 20
    chip:
      type: template
      tap_action:
        action: none
      hold_action:
        action: none
      double_tap_action:
        action: none
      icon: mdi:battery-20
      icon_color: red
      content: >-
        {{ expand(states.sensor.batteries_status) | selectattr( 'state', 'eq', '20.0') | list | count }}

This should work for youā€¦

type: custom:mushroom-chips-card
chips:
  - type: entity
    entity: person.person_1
    hold_action:
      action: none
    double_tap_action:
      action: none
    use_entity_picture: true
    content_info: name
    icon_color: primary
  - type: conditional
    conditions:
      - condition: state
        entity: group.all_lights
        state: 'on'
    chip:
      type: template
      icon: mdi:lightbulb
      icon_color: amber
      content: >-
        {{ expand(states.group.all_lights) | selectattr( 'state', 'eq', 'on') |
        list | count }}
      tap_action:
        action: none
      hold_action:
        action: none
      double_tap_action:
        action: none
  - type: conditional
    conditions:
      - condition: state
        entity: fan.all_fans
        state: 'on'
    chip:
      type: template
      tap_action:
        action: none
      hold_action:
        action: none
      double_tap_action:
        action: none
      icon: mdi:fan
      icon_color: blue
      content: >-
        {{ expand(states.fan.all_fans) | selectattr( 'state', 'eq', 'on') | list
        | count }}
  - type: conditional
    conditions:
      - condition: state
        entity: group.door_windows_sensors
        state: 'on'
    chip:
      type: template
      tap_action:
        action: none
      hold_action:
        action: none
      double_tap_action:
        action: none
      icon: mdi:door-sliding-open
      icon_color: red
      content: >-
        {{ expand(states.group.door_windows_sensors) | selectattr( 'state',
        'eq', 'on') | list | count }}
  - type: conditional
    conditions:
      - condition: numeric_state
        entity: sensor.batteries_status
        below: 20
    chip:
      type: template
      tap_action:
        action: none
      hold_action:
        action: none
      double_tap_action:
        action: none
      icon: mdi:battery-20
      icon_color: red
      content: >-
        {{ expand(states.sensor.batteries_status) | selectattr( 'state', 'eq',
        '20.0') | list | count }}
card_mod:
  style:
    mushroom-conditional-chip:nth-child(3):
      mushroom-template-chip$: |
       ha-state-icon {
         {% if is_state('fan.all_fans', 'on') %}
          animation: rotate .5s infinite linear; }
         @keyframes rotate {
          0% {  transform: rotate(0deg); }
          100% {transform: rotate(-359deg); }
                }
          {% endif %}
           }

chrome-capture-2024-4-29

1 Like

it is in the guide:

3 Likes

I tried making a template for the action confirmation, but that does not seem to work on the mushroom-template-card.
Is there any way around this, or any other good way to have a nice looking confirmation for opening the garage door for example?

bild

    tap_action:
      action: call-service
      service: script.gardiner_oppna_stang
      confirmation:
        text: 'Vill du {{''ƶppna'' if is_state(entity, ''closed'') else ''stƤnga''}} gardinerna?'

Hereā€™s the complete code:

type: horizontal-stack
cards:
  - type: custom:mushroom-template-card
    layout: vertical
    icon_color: light-blue
    tap_action:
      action: call-service
      service: script.gardiner_oppna_stang
      confirmation:
        text: 'Vill du {{''ƶppna'' if is_state(entity, ''closed'') else ''stƤnga''}} gardinerna?'
    hold_action:
      action: none
    double_tap_action:
      action: none
    icon: 'mdi:roller-shade{{''-closed'' if is_state(entity, ''closed'')}} '
    entity: cover.gardiner
    card_mod:
      style: |
        ha-card { 
        background: var(ā€”card-background-color); 
        width: 70px; 
        border-radius: 40px; 
        margin-left: auto; 
        margin-right: auto; 
        margin-bottom: 2px;
        border-width: 2px;
        {% if states('cover.gardiner') == 'open' %}
          border-color: none;
        {% else %}
          border-color: rgba(62, 160, 255, 0.5);
        {% endif %}
  - type: custom:mushroom-template-card
    layout: vertical
    icon_color: red
    tap_action:
      action: call-service
      service: script.garageport_oppna_stang
      confirmation:
        text: Vill du ƶppna/stƤnga garageport?
    hold_action:
      action: none
    double_tap_action:
      action: none
    icon: 'mdi:garage{{''-open'' if is_state(entity, ''open'')}} '
    entity: cover.garageport
    card_mod:
      style: |
        ha-card { 
        background: var(ā€”card-background-color); 
        width: 70px; 
        border-radius: 40px; 
        margin-left: auto; 
        margin-right: auto; 
        margin-bottom: 2px;
        border-width: 2px;
        {% if states('cover.garageport') == 'closed' %}
          border-color: none;
        {% else %}
          border-color: rgba(255, 62, 62, 0.5);
        {% endif %}
        }
  - type: custom:mushroom-template-card
    entity: lawn_mower.robotgrasklippare
    layout: vertical
    icon_color: orange
    tap_action:
      action: call-service
      service: script.robotgrasklippare_starta_pausa
      confirmation:
        text: Vill du starta/pausa robotgrƤsklippare?
    hold_action:
      action: call-service
      service: script.robotgrasklippare_docka
      confirmation:
        text: Vill du docka robotgrƤsklippare?
    double_tap_action:
      action: none
    icon: 'mdi:mower{{''-on'' if is_state(entity, ''error'' )}} '
    card_mod:
      style: |
        ha-card { 
          background: var(ā€”card-background-color); 
          width: 70px; 
          border-radius: 40px; 
          margin-left: auto; 
          margin-right: auto; 
          margin-bottom: 2px;
          border-width: 2px;
          {% if states('lawn_mower.robotgrasklippare') == 'docked' %}
            border-color: none;
          {% else %}
            border-color: rgba(255, 160, 62, 0.5);
          {% endif %}
        }
  - type: custom:mushroom-template-card
    entity: vacuum.robotdammsugare
    layout: vertical
    icon_color: green
    tap_action:
      action: call-service
      service: script.robotdammsugare_starta_pausa
      confirmation:
        text: Vill du starta/pausa robotdammsugare?
    hold_action:
      action: call-service
      service: script.robotdammsugare_docka
      confirmation:
        text: Vill du docka robotdammsugare?
    double_tap_action:
      action: none
    icon: 'mdi:robot-vacuum-variant{{''-alert'' if is_state(entity, ''error'')}} '
    badge_color: ''
    card_mod:
      mushroom-state-info$: |
        .container {
         --card-secondary-font-size: 5px!important;
        }
      style: |
        ha-card { 
         background: var(ā€”card-background-color); 
         width: 70px; 
         border-radius: 40px; 
         margin-left: auto; 
         margin-right: auto; 
         margin-bottom: 2px;
         border-width: 2px;
         {% if states('vacuum.robotdammsugare') == 'docked' %}
           border-color: none;
         {% else %}
           border-color: rgba(202, 246, 180, 0.5);
         {% endif %}
        }

As I know, confirmation text could not be a template, text only.

I would also like template support.