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

@rhysb Hi, I am trying your animation examples and something is not working right, for example Pouring animation is not working. Seems like ha-icon variable does not respond at all.
Another radiator animation is working halfway:

type: custom:mushroom-template-card
icon: mdi:radiator
icon_color: red
primary: Radiator
secondary: It's HOT!
card_mod:
  style:
    mushroom-shape-icon$: |
      ha-icon {
        --icon-animation: clip 1s linear infinite;
      }
      @keyframes clip {
        0% {
          clip-path: inset(50% 0 0 0);
        }
        100% {
          clip-path: inset(0 0 0 0);
        }
      }
      .shape {
        --shape-animation: ping 2s infinite;
      }
      @keyframes ping {
        0% {
          box-shadow: 0 0 0 0 rgba(var(--rgb-red), 0.7);
        }
        
        70% {
          box-shadow: 0 0 0 10px transparent;
        }
        
        100% {
          box-shadow: 0 0 0 0 transparent;
        }
      }

Only .shape PING animation is working and ha-icon is not working, any ideas?

  1. Your climate entity will likely have an attribute called temperature. This is the target temp you have set. you can therefore do this:
Code
              mushroom-shape-icon {
                --icon-symbol-size: 0.6em;
                {% if state_attr(config.entity, 'temperature') <= 15 %}
                  --card-mod-icon: mdi:leaf;
                  --card-mod-icon-color: rgba(var(--rgb-green), 1);
                  --shape-color: rgba(var(--rgb-green), 0.2) !important;
                {% else %}
                  --card-mod-icon: mdi:fire;
                  --card-mod-icon-color: rgba(var(--rgb-deep-orange), 1);
                  --shape-color: rgba(var(--rgb-deep-orange), 0.2) !important;
                {% endif %}
  1. Same thing, just use your individual climate entites.

Check the updated animations here:

Try the updated animations:

Thanks Dimitri - see my code above, where would I insert this? I donā€™t have the mushroom-shape-icon line on either pages?

By using the following code I can get the temp:
{{ state_attr(ā€˜climate.keukenā€™, ā€˜current_temperatureā€™) }}Ā°C

Where would I need to integrate that in your code?

Sorry. Thought you would already have some card mod in there didnt really check.

      - type: custom:mushroom-climate-card
        entity: climate.keuken
        show_temperature_control: true
        layout: horizontal
        hvac_modes: []
        fill_container: false
        card_mod:
          style: |
            mushroom-shape-icon {
              {% if state_attr(config.entity, 'temperature') <= 15 %}
                --card-mod-icon: mdi:leaf;
                --card-mod-icon-color: rgba(var(--rgb-green), 1);
                --shape-color: rgba(var(--rgb-green), 0.2) !important;
              {% else %}
                --card-mod-icon: mdi:fire;
                --card-mod-icon-color: rgba(var(--rgb-deep-orange), 1);
                --shape-color: rgba(var(--rgb-deep-orange), 0.2) !important;
              {% endif %}
            }

Keep in mind there is a big difference between the current_temperature and temperature attributes. The current temp is unsurprisingly the temp it currently is in the room, not what it is set to (what you asked for in your first post is when set to 15). Temperature attribute is the temp target you have set.

You will need to post something you have tried and isnt working. Unlikely that someone will do the work for you :wink:

But a good starting point would be a mushroom template card and a template chip inside of a stack in card together.

hi @dimitri.landerloos thanks for your help.

Since the temp link on the main dashboard has no function I changed it to:

- type: custom:mushroom-template-card
    primary: Temp
    secondary: ''
    icon: mdi:home
    entity: climate.home
    layout: vertical
    fill_container: true

But when changing it to:

  - type: custom:mushroom-template-card
    primary: Temp
    secondary: ''
    icon: mdi:home
    entity: climate.home
    layout: vertical
    fill_container: true
    card_mod:
      style: |
        mushroom-shape-icon {
          {% if state_attr(climate.keuken, 'current_temperature') <= 15 %}
            --card-mod-icon: mdi:leaf;
            --card-mod-icon-color: rgba(var(--rgb-green), 1);
            --shape-color: rgba(var(--rgb-green), 0.2) !important;
          {% else %}
            --card-mod-icon: mdi:fire;
            --card-mod-icon-color: rgba(var(--rgb-deep-orange), 1);
            --shape-color: rgba(var(--rgb-deep-orange), 0.2) !important;
          {% endif %}
        }

It fails to work. The code starting at mushroom-shape-icon is also shown in blue and the rest in orange. What am I doing wrong?

If you are going to use an entity id in this section instead of config.entity you need to wrap it in quotes:

{% if state_attr('climate.keuken', 'current_temperature') <= 15 %}

Awesome that was it - thank you @dimitri.landerloos ! Now the only issue with this is, I can only define ONE climate attr and I want the main dashboard to look at all climate attributes and then define if they are above or below 15.
Is there a way to do this? All of them except for climate.home (this specific entry doesnā€™t do anything)

A whole bunch of or would do it:

{% if state_attr('climate.keuken', 'current_temperature') <= 15 or  state_attr('climate.bijkeuken', 'current_temperature') <= 15 or state_attr('climate.hofdslaapk', 'current_temperature') <= 15 %}

etcā€¦
Not the most elegant solution, but it works.

Can you copy and paste part of the code in here so Iā€™m doing it right?

- type: custom:mushroom-template-card
    primary: Temp
    secondary: ''
    icon: mdi:home
    entity: climate.home
    layout: vertical
    fill_container: true
    card_mod:
      style: |
        mushroom-shape-icon {
          {% if state_attr('climate.woonkamer', 'current_temperature') <= 15 %}
            --card-mod-icon: mdi:leaf;
            --card-mod-icon-color: rgba(var(--rgb-green), 1);
            --shape-color: rgba(var(--rgb-green), 0.2) !important;
          {% else %}
            --card-mod-icon: mdi:fire;
            --card-mod-icon-color: rgba(var(--rgb-deep-orange), 1);
            --shape-color: rgba(var(--rgb-deep-orange), 0.2) !important;
          {% endif %}
        }
- type: custom:mushroom-template-card
    primary: Temp
    secondary: ''
    icon: mdi:home
    entity: climate.home
    layout: vertical
    fill_container: true
    card_mod:
      style: |
        mushroom-shape-icon {
          {% if state_attr('climate.keuken', 'current_temperature') <= 15 or  state_attr('climate.bijkeuken', 'current_temperature') <= 15 or state_attr('climate.hofdslaapk', 'current_temperature') <= 15 %}
            --card-mod-icon: mdi:leaf;
            --card-mod-icon-color: rgba(var(--rgb-green), 1);
            --shape-color: rgba(var(--rgb-green), 0.2) !important;
          {% else %}
            --card-mod-icon: mdi:fire;
            --card-mod-icon-color: rgba(var(--rgb-deep-orange), 1);
            --shape-color: rgba(var(--rgb-deep-orange), 0.2) !important;
          {% endif %}
        }

Keep in mind i didnt put in all of the or statements, just a few to illustrate.

Perfect - thank you @dimitri.landerloos

Iā€™ve tested it and it works great. Iā€™ve also changed current temp to set temperature as this is better. The room obviously reaches a certain temp and it stays above 15c, even if the heater is off. So it should show green.

Now one more request - sorry to keep you busy with this. Do you think we can add a nice button to the room cards (see screenshot below). That:

  1. Toggles set hvac mode to 20C or 15c ?
  2. Color of icon is based on 15c or 20c toggle (we could use the previous code above?)

type: horizontal-stack
cards:
  - type: custom:mushroom-template-card
    primary: Woonkamer
    secondary: '{{ state_attr(''climate.woonkamer'', ''current_temperature'') }}Ā°C'
    icon: mdi:sofa-outline
    entity: light.woonkamerlampen
    badge_color: ''
    icon_color: |-
      {% if is_state('light.woonkamerlampen', 'on') %}
        orange
      {% endif %}
    tap_action:
      action: navigate
      navigation_path: /dashboard-mushroom/woonkamer
  - type: custom:mushroom-template-card
    primary: Speelkamer
    secondary: '{{ state_attr(''climate.speelkamer'', ''current_temperature'') }}'
    icon: mdi:teddy-bear
    entity: light.speelkamerlampen
    badge_color: ''
    icon_color: |-
      {% if is_state('light.speelkamerlampen', 'on') %}
        orange
      {% endif %}
    tap_action:
      action: navigate
      navigation_path: /dashboard-mushroom/speelkamer

This is the developer tools output of the climate_woonkamer entity. Looks like we need to alter target_heat_temperature to 20 and setpoint mode to : TemporaryOverride (iā€™ve modified the temp via home assistant hvac control and these two items changed)

Epic! This worked - thanks so much!

1 Like

Hello,

Iā€™m trying to build this transparent menu on my phone dashboard

Have you ideas about the code yaml?

4 Likes

Have the tap action that i have added to the chip call a script that does what you want it to do.
so change script.yourscriptid to your script.

type: horizontal-stack
cards:
  - type: custom:stack-in-card
    cards:
      - type: custom:mushroom-template-card
        primary: Woonkamer
        secondary: '{{ state_attr(''climate.woonkamer'', ''current_temperature'') }}Ā°C'
        icon: mdi:sofa-outline
        entity: light.woonkamerlampen
        badge_color: ''
        icon_color: |-
          {% if is_state('light.woonkamerlampen', 'on') %}
            orange
          {% endif %}
        tap_action:
          action: navigate
          navigation_path: /dashboard-mushroom/woonkamer
      - type: custom:mushroom-chips-card
        chips:
          - type: template
            icon: mdi:thermostat
            icon_color: deep-orange
            tap_action:
              action: call-service
              service: script.yourscriptid
              data: {}
              target: {}
            card_mod:
              style: |
                ha-card {
                  background: rgba(var(--rgb-deep-orange), 0.2) !important;
                }
        alignment: end
        card_mod:
          style: |
            ha-card {
              position: absolute;
              bottom: 0px;
              right: 5px;
            }
  - type: custom:mushroom-template-card
    primary: Speelkamer
    secondary: '{{ state_attr(''climate.speelkamer'', ''current_temperature'') }}'
    icon: mdi:teddy-bear
    entity: light.speelkamerlampen
    badge_color: ''
    icon_color: |-
      {% if is_state('light.speelkamerlampen', 'on') %}
        orange
      {% endif %}
    tap_action:
      action: navigate
      navigation_path: /dashboard-mushroom/speelkamer

image

you can also still format the chip in the colors that you want etc.

That is a really nice solution. Could you explain how to do that and paste perhaps the code? Thank you!

I created the rest-sensor but it does not give me the list of rooms?

Here is the automation that turns off all the input booleans that are on when the vacuum changes state to ā€œreturningā€:

alias: Reset Vacuum Rooms
description: ""
trigger:
  - platform: state
    entity_id:
      - vacuum.roborock_s7
    to: returning
condition: []
action:
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id: >
        {% set vacrooms = namespace(boolid=[]) %} {% for rooms in
        state_attr('sensor.roborock_rooms','rooms') -%}
          {% if is_state(rooms.boolean,'on') %}
            {% set room = rooms.boolean %}
            {% set vacrooms.boolid = vacrooms.boolid + [room] %}
          {% endif %}
        {%- endfor %} {{ vacrooms.boolid }}
mode: single

I am adding some mushroom animations today and will post the full code to the page in a bit

3 Likes

Well you created the REST sensor, did you also create the corresponding JSON file that the REST sensor loads? I should note that is becoming off topic for this thread, you should just PM me and I can help you there.