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

See code

type: horizontal-stack
cards:
  - type: custom:mushroom-person-card
    entity: person.tom
    primary_info: none
    secondary_info: none
    icon_type: entity-picture
    card_mod:
      style:
        mushroom-shape-avatar$: |
          .picture {
            display: flex;
            border-radius: 50%;
            {% if states(config.entity) == 'home' %}
              animation: pinggreen 4s infinite;
            {% else %}
              animation: pingred 5s infinite;
            {% endif %}
          }
          @keyframes pinggreen {
            0% {box-shadow: 0 0 5px 3px rgba(var(--rgb-green), 0.9);}
            100% {box-shadow: 0 0 5px 15px transparent;}
          }
          @keyframes pingred {
            0% {box-shadow: 0 0 5px 3px rgba(var(--rgb-red), 0.9);}
            100% {box-shadow: 0 0 5px 15px transparent;}
          }
        .: |

          ha-card {
           --icon-size: 50px;

          }
  - type: custom:mushroom-person-card
    entity: person.sandra
    primary_info: none
    secondary_info: none
    icon_type: entity-picture
    card_mod:
      style:
        mushroom-shape-avatar$: |
          .picture {
            display: flex;
            border-radius: 50%;
            {% if states(config.entity) == 'home' %}
              animation: pinggreen 4s infinite;
            {% else %}
              animation: pingred 5s infinite;
            {% endif %}
          }
          @keyframes pinggreen {
            0% {box-shadow: 0 0 5px 3px rgba(var(--rgb-green), 0.9);}
            100% {box-shadow: 0 0 5px 15px transparent;}
          }
          @keyframes pingred {
            0% {box-shadow: 0 0 5px 3px rgba(var(--rgb-red), 0.9);}
            100% {box-shadow: 0 0 5px 15px transparent;}
          }
        .: |
          ha-card {
           --icon-size: 50px;
          }
  - type: custom:mushroom-person-card
    entity: person.ben
    primary_info: none
    secondary_info: none
    icon_type: entity-picture
    card_mod:
      style:
        mushroom-shape-avatar$: |

          .picture {

            display: flex;

            border-radius: 50%;

            {% if states(config.entity) == 'home' %}

              animation: pinggreen 4s infinite;

            {% else %}

              animation: pingred 5s infinite;

            {% endif %}

          }

          @keyframes pinggreen {

            0% {box-shadow: 0 0 5px 3px rgba(var(--rgb-green), 0.9);}

            100% {box-shadow: 0 0 5px 15px transparent;}

          }

          @keyframes pingred {

            0% {box-shadow: 0 0 5px 3px rgba(var(--rgb-red), 0.9);}

            100% {box-shadow: 0 0 5px 15px transparent;}

          }
        .: |

          ha-card {

           --icon-size: 50px;

          }
  - type: custom:mushroom-person-card
    entity: person.tim
    primary_info: none
    secondary_info: none
    icon_type: entity-picture
    card_mod:
      style:
        mushroom-shape-avatar$: |

          .picture {

            display: flex;

            border-radius: 50%;

            {% if states(config.entity) == 'home' %}

              animation: pinggreen 4s infinite;

            {% else %}

              animation: pingred 5s infinite;

            {% endif %}

          }

          @keyframes pinggreen {

            0% {box-shadow: 0 0 5px 3px rgba(var(--rgb-green), 0.9);}

            100% {box-shadow: 0 0 5px 15px transparent;}

          }

          @keyframes pingred {

            0% {box-shadow: 0 0 5px 3px rgba(var(--rgb-red), 0.9);}

            100% {box-shadow: 0 0 5px 15px transparent;}

          }
        .: |

          ha-card {

           --icon-size: 50px;

          }
  - type: custom:mushroom-person-card
    entity: person.lena
    primary_info: none
    secondary_info: none
    icon_type: entity-picture
    card_mod:
      style:
        mushroom-shape-avatar$: |

          .picture {

            display: flex;

            border-radius: 50%;

            {% if states(config.entity) == 'home' %}

              animation: pinggreen 4s infinite;

            {% else %}

              animation: pingred 5s infinite;

            {% endif %}

          }

          @keyframes pinggreen {

            0% {box-shadow: 0 0 5px 3px rgba(var(--rgb-green), 0.9);}

            100% {box-shadow: 0 0 5px 15px transparent;}

          }

          @keyframes pingred {

            0% {box-shadow: 0 0 5px 3px rgba(var(--rgb-red), 0.9);}

            100% {box-shadow: 0 0 5px 15px transparent;}

          }
        .: |

          ha-card {

           --icon-size: 50px;

          }

1 Like

Can someone tell me why this isn’t working? Is card_mod not applicable to the title card?

type: custom:mushroom-title-card
title: Hello, {{ user }} !
card_mod:
  style: |
    .title {
      font-size: 15px;
      color: red;
    }

you just need a !important behind each of your items:

type: custom:mushroom-title-card
title: Hello, {{ user }} !
card_mod:
  style: |
    .title {
      font-size: 15px !important;
      color: red !important;
    }

Sometimes things need an !important (often when it is something dictated by your theme… like a font color perhaps) importance is… important… in CSS, but i would always test to see if it works without the !important first and only add it when neccesary :slight_smile:

1 Like

I think he was inquiring about the avatars themselves (images) and how you created them (which program/app) ? also interested to know :slightly_smiling_face: is it Messenger avatars?

Well you cant have this section work the same way that it currently does because a person entity does not have the same states as an input boolean.

{% if is_state(config.entity, ['home', 'not_home', 'unknown']) %}
  rgb(var(--rgb-state-person-{{ states(config.entity) | replace('_', '-') }} ))
{% else %}
  rgb(var(--rgb-state-person-zone))
{% endif %};

but lets say that “on” = “home” and “off” = “not_home” and if we can assume that we could build it like this:

type: custom:mushroom-chips-card
chips:
  - type: entity
    entity: input_boolean.alarm_skip
    card_mod:
      style: |
        /* Color border around avatar to show person status */
        ha-card {
          {% if is_state(config.entity, 'on') %}
            --chip-background: rgb(var(--rgb-state-person-home));
          {% else %}
            --chip-background: rgb(var(--rgb-state-person-zone));
          {% endif %};
        } 
        /* Slightly enlarge & bring to front on hover */
        ha-card:hover {
          transform: scale(1.2);
          transform-origin: top center;
          z-index: 1;
          transition: all 1s;
        }

Animated Home Assistant Weather Card with Weather Report

Page Properties:

  • Fully animated
  • Can be used with any weather integration. (see manual page for what this card requires)
  • White and Dark Theme Ready
  • 5 day Forecast
  • Hourly Forecast
  • Detailed Weather info
  • Short Weather Report
  • Ability to turn off animations
  • Fully customizable through using the manual provided.
  • All the multimedia files are included
  • Manual includes information about pulling information from weather attributes. Use any data you like
  • Fully dynamic
  • Single click change from dark to white or vice versa
  • Learn how to take data from weather attributes
  • Learn how to change your theme automatically
  • Full Manual for installation
11 Likes

Hello,

It is possible to make a template card to look like the photo below?
Weather forecast webs1ite

Probably can be done.

A template card in vertical layout, and then for the top header use a css pseudo element to just write today.

Or put it in a stack in card with a title card using center alignment and write today in that too.

Can you show me how to use css pseudo element as you say?

Yes, that was the answer. Cheers!

type: custom:mushroom-template-card
primary: Hello, {{user}}
secondary: How are you?
icon: mdi:home
layout: vertical
card_mod:
  style: |
    ha-card:before {
      content: 'Today';
      display: flex;
      position: relative;
      justify-content: center;
      top: -10px;
      font-size: 12px;
    }
    ha-card {
      padding-top: 20px !important;
    }
1 Like

Thanks a lot!

1 Like

Everything can be copied.

image

type: custom:layout-card
layout_type: masonry
layout: {}
cards:
  - type: grid
    columns: 4
    square: false
    cards:
      - type: custom:vertical-stack-in-card
        layout_type: masonry
        layout: {}
        cards:
          - type: vertical-stack
            cards:
              - type: custom:mushroom-template-card
                primary: >
                  {{ as_datetime(state_attr('weather.forecast_home','forecast')[4].datetime,).strftime('%A') }}
                layout: vertical
                card_mod:
                  style:
                    mushroom-state-info$: |
                      .primary {
                        font-size: 18px !important;
                        margin-top: 20px;           
                        --primary-text-color: rgb(var(--rgb-white));  
                        z-index:1;    
                      } 
                    mushroom-shape-icon$: |
                      .shape {
                       --icon-size: 80px !important;
                       --shape-color: none !important;  
                      }
                    .: |
                      ha-card { 
                        background: #5596f6;
                      }   
                      :host {
                        background: transparent; 
                        margin-bottom: -40px !important;   
                      }  
              - type: custom:mushroom-template-card
                primary: Humidity
                secondary: >
                  {{
                  state_attr('weather.forecast_home_hourly','forecast')[18].humidity
                  | int  }}%
                icon: mdi:weather-partly-cloudy
                layout: vertical
                icon_color: white
                card_mod:
                  style:
                    mushroom-state-info$: |
                      .primary {
                        font-size: 18px !important;
                        font-weight: 300 !important;
                        margin-top: -20px;    
                        text-align: center;   
                        --primary-text-color: rgb(var(--rgb-white)); 
                      } 
                      .secondary {
                        font-weight: 400 !important;
                        font-size: 20px !important;
                        --secondary-text-color: rgb(var(--rgb-white));  
                        font-weight: bold;
                        text-align: center;   
                      } 
                    mushroom-shape-icon$: |
                      .shape {
                        position: relative;
                        border-radius: 0px !important;
                       --icon-size: 80px !important;
                       --shape-color: none !important;  
                      }
                    .: |
                      ha-card { 
                        background: #5596f6;
                        height: 166px !important;
                      }   
                      :host {
                        background: transparent;
                      }  
        card_mod:
          style: |
            ha-card {
              --ha-card-border-width: 0;
              background: none;    
              box-shadow: none;
              width: 186px !important;
            }               

You can even add a 4th line into this code.

4 Likes

@PskNorz our 2 solutions combined (mostly work by berkans, you should be very thankful that someone is willing to put in that much effort into such a broad question) as 1 card instead.

        type: custom:mushroom-template-card
        primary: Humidity
        secondary: >
          {{ state_attr('weather.openweathermap','forecast')[1].humidity | int
          }}%
        icon: mdi:weather-partly-cloudy
        layout: vertical
        icon_color: white
        card_mod:
          style:
            mushroom-state-info$: |
              .primary {
                font-size: 18px !important;
                font-weight: 300 !important;
                margin-top: -20px;    
                text-align: center;   
                --primary-text-color: rgb(var(--rgb-white)); 
              } 
              .secondary {
                font-weight: 400 !important;
                font-size: 20px !important;
                --secondary-text-color: rgb(var(--rgb-white));  
                font-weight: bold;
                text-align: center;   
              } 
            mushroom-shape-icon$: |
              .shape {
                position: relative;
                border-radius: 0px !important;
               --icon-size: 80px !important;
               --shape-color: none !important;  
              }
            .: |
              ha-card { 
                background: #5596f6;
                height: 166px !important;
                padding-bottom: 30px !important;
                --ha-card-border-width: 0;
                box-shadow: none;
                width: 186px !important;
              }
              ha-card:before {
                content: '{{as_datetime(state_attr('weather.home','forecast')[1].datetime,).strftime('%A')}}';
                display: flex;
                position: relative;
                justify-content: center;
                font-size: 18px !important;
                top: 20px !important;
                padding-bottom: 8px !important;
                --primary-text-color: rgb(var(--rgb-white));  
              }
              :host {
                background: transparent;
              }  
2 Likes

@dimitri.landerloos @berkans Thank you both for your help, you guys are awesome!!!

I did mix the code and i got the result is the photo below.

I want now to try to change the background color on the forecast card based on what day we have today.

The picture that i get the idea.

Code
type: custom:stack-in-card
cards:
  - type: custom:layout-card
    layout_type: custom:grid-layout
    cards:
      - type: custom:mushroom-template-card
        primary: ''
        icon: |-
          {% set current_hour = now().hour %}
          {% set is_night = current_hour >= 20 or current_hour < 6 %}

          {% if is_state('weather.openweathermap_2','sunny') %}
              mdi:weather-sunny
          {% elif is_state('weather.openweathermap_2','clear-night') %}
              mdi:weather-night
          {% elif is_state('weather.openweathermap_2','rainy') %}
              mdi:weather-rainy
          {% elif is_state('weather.openweathermap_2','snow') %}
              mdi:weather-snowy
          {% elif is_state('weather.openweathermap_2','fog') %}
              mdi:weather-fog
          {% elif is_state('weather.openweathermap_2','sleet') %}
              mdi:weather-partly-snowy-rainy
          {% elif is_state('weather.openweathermap_2_2','wind') %}
              mdi:weather-windy
          {% elif is_state('weather.openweathermap_2','cloudy') %}
              mdi:weather-cloudy
          {% elif is_state('weather.openweathermap_2','partlycloudy') %}
              {{ 'mdi:weather-night-partly-cloudy' if is_night else 'mdi:weather-partly-cloudy' }}
          {% elif is_state('weather.openweathermap_2','hail') %}
              mdi:weather-hail
          {% elif is_state('weather.openweathermap_2','lightning') %}
              mdi:weather-lightning
          {% elif is_state('weather.openweathermap_2','thunderstorm') %}
              mdi:weather-lightning-rainy
          {% endif %}
        secondary: |2-
            {% set en = states('weather.openweathermap_2') %} 
              {% set conditions = ['clear-night:Καθαρός',
                                   'cloudy:Συννεφιασμένος',
                                   'fog:Ομιχλώδες',
                                   'hail:Χαλαζόπτωση',
                                   'lightning:Αστραπές',
                                   'lightning-rainy:Βροχερός με αστραπές',
                                   'partlycloudy:Τοπικές νεφώσεις',
                                   'pouring,rainy:Βροχερός',
                                   'snowy:Χιονόπτωση',
                                   'snowy-rainy:Χιονόνερο',
                                   'sunny:Λιακάδα',
                                   'windy:Ανεμώδης',
                                   'windy-variant:Θυελλώδης',
                                   'exceptional:Ιδιαίτερος'] %}
              {{ conditions
                    | select('search', en)
                    | map('regex_replace', '.*:')
                    | list 
                    | default([''], true)
                    | first }}
        layout: vertical
        card_mod:
          style:
            mushroom-state-info$: |
              .primary {
                font-weight: 400 !important;
              }
              .secondary {
                font-weight: 700 !important;
                --secondary-text-color: var(--primary-text-color) !important;
                margin-top:50px;
              }
              .container {
                --card-secondary-font-size: 18px;
                --card-primary-font-size: 35px;

              }
            mushroom-shape-icon$: |
              .shape {
                --shape-color: transparent;
              }
            .: |
              ha-state-icon {
                --icon-symbol-size: 65px;
                color: #487aff;
                margin-top: 60px;
              }
              ha-state-icon::after {
                content: '{{states('sensor.wu_temperature_rafina')}}°C';
                position: relative;
                display: flex;
                justify-content: center !important;
                top: 32px;
                left: 10px;
                color: var(--primary-text-color) !important;
                font-size: 35px;
                }
              ha-card:before {
                content: 'Ραφήνα';
                display: flex;
                position: relative;
                justify-content: center;
                font-size: 15px;
                color: var(--secondary-text-color) !important;
                font-weight: var(--card-primary-font-weight);
              }
              ha-card {
                margin-top:26%;
                background-color: none;
                border-width: 0px;
                border-radius: 25px !important;
                border-width: 0px;
                width: 200px;
                height: 150px!important;
        view_layout:
          grid-column-start: 1
          grid-column-end: 3
          grid-row-start: 1
          grid-row-end: 1
          place-self: center
      - type: custom:mini-graph-card
        entities:
          - entity: sensor.wu_temperature_rafina
            name: Θερμοκρασία
            color: '#487aff'
        show:
          icon: false
          state: false
          fill: fade
        hours_to_show: 24
        animate: true
        line_width: 3
        height: 120
        card_mod:
          style: |
            ha-card {
              position: absolute !important;
              height: 185px;
              width: 410px;
              background: transparent;
              border-width: 0;
              top: -10px;
            }
            ha-card .header.flex .name.flex {
              font-size: 14px;
              margin-top: 22px;

             }
      - type: custom:mushroom-template-card
        primary: Υγρασία
        secondary: '{{states(''sensor.wu_humidity_rafina'')}}%'
        icon: ''
        layout: vertical
        card_mod:
          style:
            mushroom-state-info$: |
              .container {
                --card-secondary-font-size: 15px;
                --card-primary-font-size: 15px;
                --secondary-text-color:#e1e1e1;
                --primary-text-color: #9b9b9b;
              }
            mushroom-shape-icon$: |
              .shape {
                --shape-color: transparent;
              }
            .: |
              ha-state-icon::after {
                content: '{{states('sensor.lounge_downstairs_temperature')}}°C';
                position: relative;
                display: flex;
                justify-content: center !important;
                top: 32px;
                left: 5px;
                color: var(--primary-text-color) !important;
                font-size: 65px;
              }
              ha-card {
                background-color: none;
                border-width: 0px;
                width: 100px;
                height: 150px!important;
                background: transparent;
              }
        view_layout:
          grid-area: h4
      - type: custom:mushroom-template-card
        primary: Άνεμος
        secondary: |
          {{states('sensor.wind_bf_from_kmh')}} - 
          {% set dir = states('sensor.wu_wind_direction_rafina') %}
          {% if dir == "NNE" %} ΒΒΑ
          {% elif dir == "NE" %} ΒΑ
          {% elif dir == "ENE" %} ΑΒΑ
          {% elif dir == "E" %} Α
          {% elif dir == "ESE" %} ΑΝΑ
          {% elif dir == "SE" %} ΝΑ
          {% elif dir == "SSE" %} ΝΝΑ
          {% elif dir == "S" %} Ν
          {% elif dir == "SSW" %} ΝΝΔ
          {% elif dir == "SW" %} ΝΔ
          {% elif dir == "WSW" %} ΔΝΔ
          {% elif dir == "W" %} Δ
          {% elif dir == "WNW" %} ΔΒΔ
          {% elif dir == "NW" %} ΒΔ
          {% elif dir == "NNW" %} ΒΒΔ
          {% else %} Β
          {% endif %}
        icon: ''
        layout: vertical
        view_layout:
          grid-area: h5
        card_mod:
          style:
            mushroom-state-info$: |
              .container {
                --card-secondary-font-size: 15px;
                --card-primary-font-size: 15px;
                --secondary-text-color:#e1e1e1;
                --primary-text-color: #9b9b9b;
              }
            mushroom-shape-icon$: |
              .shape {
                --shape-color: transparent;
              }
            .: |
              ha-state-icon::after {
                content: '{{states('sensor.lounge_downstairs_temperature')}}°C';
                position: relative;
                display: flex;
                justify-content: center !important;
                top: 32px;
                left: 5px;
                color: var(--primary-text-color) !important;
                font-size: 65px;
              }
              ha-card {
                background-color: none;
                border-width: 0px;
                width: 110px;
                height: 150px!important;
                background: transparent;
              }
      - type: custom:stack-in-card
        cards:
          - type: custom:layout-card
            layout_type: custom:grid-layout
            cards:
              - type: custom:mushroom-template-card
                primary: >-
                  {% set days = ['Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη',
                  'Παρασκευή', 'Σαββάτο', 'Κυριακή'] %}
                            {{ days[as_timestamp(state_attr('weather.openweathermap_2', 'forecast')[0].datetime) | timestamp_custom('%w') | int -1] }}
                secondary: >-
                  {{ state_attr('weather.openweathermap_2',
                  'forecast')[0].temperature | round(1) }} °C 
                icon: >-
                  {% set current_hour = now().hour %}

                  {% set is_night = current_hour >= 20 or current_hour < 6 %}

                  {% set weather_icon = state_attr('weather.openweathermap_2',
                  'forecast')[0].condition %}


                  {% if weather_icon == 'sunny' %}
                      mdi:weather-sunny
                  {% elif weather_icon == 'clear-night' %}
                      mdi:weather-night
                  {% elif weather_icon == 'rainy' %}
                      mdi:weather-rainy
                  {% elif weather_icon == 'snow' %}
                      mdi:weather-snowy
                  {% elif weather_icon == 'fog' %}
                      mdi:weather-fog
                  {% elif weather_icon == 'sleet' %}
                      mdi:weather-partly-snowy-rainy
                  {% elif weather_icon == 'wind' %}
                      mdi:weather-windy
                  {% elif weather_icon == 'cloudy' %}
                      mdi:weather-cloudy
                  {% elif weather_icon == 'partlycloudy' %}
                      {{ 'mdi:weather-night-partly-cloudy' if is_night else 'mdi:weather-partly-cloudy' }}
                  {% elif weather_icon == 'hail' %}
                      mdi:weather-hail
                  {% elif weather_icon == 'lightning' %}
                      mdi:weather-lightning
                  {% elif weather_icon == 'thunderstorm' %}
                      mdi:weather-lightning-rainy
                  {% endif %}
                layout: vertical
                card_mod:
                  style:
                    mushroom-state-info$: |
                      .container {
                        --card-secondary-font-size: 15px;
                        --card-primary-font-size: 15px;

                      }
                    mushroom-shape-icon$: |
                      .shape {
                        --shape-color: none;
                      }
                    .: |
                      ha-state-icon {
                      --icon-symbol-size: 35px;
                      color: #487aff;
                      }
                      ha-card {
                        border-width: 0px;
                        border-width: 0px;
                        background: transparent;
                      }
                view_layout:
                  grid-area: h1
                  place-self: center
              - type: custom:mushroom-template-card
                primary: >-
                  {% set days = ['Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη',
                  'Παρασκευή', 'Σαββάτο', 'Κυριακή'] %}
                            {{ days[as_timestamp(state_attr('weather.openweathermap_2', 'forecast')[1].datetime) | timestamp_custom('%w') | int -1] }}
                secondary: >-
                  {{ state_attr('weather.openweathermap_2',
                  'forecast')[1].temperature | round(1) }} °C 
                icon: >-
                  {% set current_hour = now().hour %}

                  {% set is_night = current_hour >= 20 or current_hour < 6 %}

                  {% set weather_icon = state_attr('weather.openweathermap_2',
                  'forecast')[1].condition %}


                  {% if weather_icon == 'sunny' %}
                      mdi:weather-sunny
                  {% elif weather_icon == 'clear-night' %}
                      mdi:weather-night
                  {% elif weather_icon == 'rainy' %}
                      mdi:weather-rainy
                  {% elif weather_icon == 'snow' %}
                      mdi:weather-snowy
                  {% elif weather_icon == 'fog' %}
                      mdi:weather-fog
                  {% elif weather_icon == 'sleet' %}
                      mdi:weather-partly-snowy-rainy
                  {% elif weather_icon == 'wind' %}
                      mdi:weather-windy
                  {% elif weather_icon == 'cloudy' %}
                      mdi:weather-cloudy
                  {% elif weather_icon == 'partlycloudy' %}
                      {{ 'mdi:weather-night-partly-cloudy' if is_night else 'mdi:weather-partly-cloudy' }}
                  {% elif weather_icon == 'hail' %}
                      mdi:weather-hail
                  {% elif weather_icon == 'lightning' %}
                      mdi:weather-lightning
                  {% elif weather_icon == 'thunderstorm' %}
                      mdi:weather-lightning-rainy
                  {% endif %}
                layout: vertical
                card_mod:
                  style:
                    mushroom-state-info$: |
                      .container {
                        --card-secondary-font-size: 15px;
                        --card-primary-font-size: 15px;

                      }
                    mushroom-shape-icon$: |
                      .shape {
                        --shape-color: none;
                      }
                    .: |
                      ha-state-icon {
                      --icon-symbol-size: 35px;
                      color: #487aff;
                      }
                      ha-card {
                        border-width: 0px;
                        border-width: 0px;
                        background: transparent;
                      }
                view_layout:
                  grid-area: h2
                  place-self: center
              - type: custom:mushroom-template-card
                primary: >-
                  {% set days = ['Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη',
                  'Παρασκευή', 'Σαββάτο', 'Κυριακή'] %}
                            {{ days[as_timestamp(state_attr('weather.openweathermap_2', 'forecast')[2].datetime) | timestamp_custom('%w') | int -1] }}
                secondary: >-
                  {{ state_attr('weather.openweathermap_2',
                  'forecast')[2].temperature | round(1) }} °C 
                icon: >-
                  {% set current_hour = now().hour %}

                  {% set is_night = current_hour >= 20 or current_hour < 6 %}

                  {% set weather_icon = state_attr('weather.openweathermap_2',
                  'forecast')[2].condition %}


                  {% if weather_icon == 'sunny' %}
                      mdi:weather-sunny
                  {% elif weather_icon == 'clear-night' %}
                      mdi:weather-night
                  {% elif weather_icon == 'rainy' %}
                      mdi:weather-rainy
                  {% elif weather_icon == 'snow' %}
                      mdi:weather-snowy
                  {% elif weather_icon == 'fog' %}
                      mdi:weather-fog
                  {% elif weather_icon == 'sleet' %}
                      mdi:weather-partly-snowy-rainy
                  {% elif weather_icon == 'wind' %}
                      mdi:weather-windy
                  {% elif weather_icon == 'cloudy' %}
                      mdi:weather-cloudy
                  {% elif weather_icon == 'partlycloudy' %}
                      {{ 'mdi:weather-night-partly-cloudy' if is_night else 'mdi:weather-partly-cloudy' }}
                  {% elif weather_icon == 'hail' %}
                      mdi:weather-hail
                  {% elif weather_icon == 'lightning' %}
                      mdi:weather-lightning
                  {% elif weather_icon == 'thunderstorm' %}
                      mdi:weather-lightning-rainy
                  {% endif %}
                layout: vertical
                card_mod:
                  style:
                    mushroom-state-info$: |
                      .container {
                        --card-secondary-font-size: 15px;
                        --card-primary-font-size: 15px;

                      }
                    mushroom-shape-icon$: |
                      .shape {
                        --shape-color: none;
                      }
                    .: |
                      ha-state-icon {
                      --icon-symbol-size: 35px;
                      color: #487aff;
                      }
                      ha-card {
                        border-width: 0px;
                        border-width: 0px;
                        background: transparent;
                      }
                view_layout:
                  grid-area: h3
                  place-self: center
              - type: custom:mushroom-template-card
                primary: >-
                  {% set days = ['Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη',
                  'Παρασκευή', 'Σαββάτο', 'Κυριακή'] %}
                            {{ days[as_timestamp(state_attr('weather.openweathermap_2', 'forecast')[3].datetime) | timestamp_custom('%w') | int -1] }}
                secondary: >-
                  {{ state_attr('weather.openweathermap_2',
                  'forecast')[3].temperature | round(1) }} °C 
                icon: >-
                  {% set current_hour = now().hour %}

                  {% set is_night = current_hour >= 20 or current_hour < 6 %}

                  {% set weather_icon = state_attr('weather.openweathermap_2',
                  'forecast')[3].condition %}


                  {% if weather_icon == 'sunny' %}
                      mdi:weather-sunny
                  {% elif weather_icon == 'clear-night' %}
                      mdi:weather-night
                  {% elif weather_icon == 'rainy' %}
                      mdi:weather-rainy
                  {% elif weather_icon == 'snow' %}
                      mdi:weather-snowy
                  {% elif weather_icon == 'fog' %}
                      mdi:weather-fog
                  {% elif weather_icon == 'sleet' %}
                      mdi:weather-partly-snowy-rainy
                  {% elif weather_icon == 'wind' %}
                      mdi:weather-windy
                  {% elif weather_icon == 'cloudy' %}
                      mdi:weather-cloudy
                  {% elif weather_icon == 'partlycloudy' %}
                      {{ 'mdi:weather-night-partly-cloudy' if is_night else 'mdi:weather-partly-cloudy' }}
                  {% elif weather_icon == 'hail' %}
                      mdi:weather-hail
                  {% elif weather_icon == 'lightning' %}
                      mdi:weather-lightning
                  {% elif weather_icon == 'thunderstorm' %}
                      mdi:weather-lightning-rainy
                  {% endif %}
                layout: vertical
                card_mod:
                  style:
                    mushroom-state-info$: |
                      .container {
                        --card-secondary-font-size: 15px;
                        --card-primary-font-size: 15px;

                      }
                    mushroom-shape-icon$: |
                      .shape {
                        --shape-color: none;
                      }
                    .: |
                      ha-state-icon {
                      --icon-symbol-size: 35px;
                      color: #487aff;
                      }
                      ha-card {
                        border-width: 0px;
                        border-width: 0px;
                        background: transparent;
                      }
                view_layout:
                  grid-area: h4
                  place-self: center
              - type: custom:mushroom-template-card
                primary: >-
                  {% set days = ['Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη',
                  'Παρασκευή', 'Σαββάτο', 'Κυριακή'] %}
                            {{ days[as_timestamp(state_attr('weather.openweathermap_2', 'forecast')[4].datetime) | timestamp_custom('%w') | int -1] }}
                secondary: >-
                  {{ state_attr('weather.openweathermap_2',
                  'forecast')[4].temperature | round(1) }} °C 
                icon: >-
                  {% set current_hour = now().hour %}

                  {% set is_night = current_hour >= 20 or current_hour < 6 %}

                  {% set weather_icon = state_attr('weather.openweathermap_2',
                  'forecast')[4].condition %}


                  {% if weather_icon == 'sunny' %}
                      mdi:weather-sunny
                  {% elif weather_icon == 'clear-night' %}
                      mdi:weather-night
                  {% elif weather_icon == 'rainy' %}
                      mdi:weather-rainy
                  {% elif weather_icon == 'snow' %}
                      mdi:weather-snowy
                  {% elif weather_icon == 'fog' %}
                      mdi:weather-fog
                  {% elif weather_icon == 'sleet' %}
                      mdi:weather-partly-snowy-rainy
                  {% elif weather_icon == 'wind' %}
                      mdi:weather-windy
                  {% elif weather_icon == 'cloudy' %}
                      mdi:weather-cloudy
                  {% elif weather_icon == 'partlycloudy' %}
                      {{ 'mdi:weather-night-partly-cloudy' if is_night else 'mdi:weather-partly-cloudy' }}
                  {% elif weather_icon == 'hail' %}
                      mdi:weather-hail
                  {% elif weather_icon == 'lightning' %}
                      mdi:weather-lightning
                  {% elif weather_icon == 'thunderstorm' %}
                      mdi:weather-lightning-rainy
                  {% endif %}
                layout: vertical
                card_mod:
                  style:
                    mushroom-state-info$: |
                      .container {
                        --card-secondary-font-size: 15px;
                        --card-primary-font-size: 15px;

                      }
                    mushroom-shape-icon$: |
                      .shape {
                        --shape-color: none;
                      }
                    .: |
                      ha-state-icon {
                      --icon-symbol-size: 35px;
                      color: #487aff;
                      }
                      ha-card {
                        border-width: 0px;
                        border-width: 0px;
                        background: transparent;
                      }
                view_layout:
                  grid-area: h5
                  place-self: center
            layout:
              grid-template-columns: 80px 80px 80px 80px 80px
              grid-template-areas: |
                "h1 h2 h3 h4 h5"
        card_mod:
          style: |
            ha-card {
              --ha-card-border-width: 0px !important;
              width: 405px;
              background: transparent;
            }
        view_layout:
          grid-area: h6
    layout:
      max_cols: 2
      grid-gap: 5px 5px
      padding: 0px
      margin: 0px
      card_margin: 0px
      grid-template-columns: 100px 120px 500px
      grid-template-rows: 160px 150px
      grid-template-areas: |
        "h1 h2 h3"
        "h4 h5 h6"
card_mod:
  style: |
    ha-card {
      --ha-card-border-width: 0px !important;
      width: 655px;
      border-radius: 40px !important;


    }

9 Likes

looks really really good, well done on this one. when you are finished do you think you could post a non-translated version (so maybe english as a base) think many people might want to use this one :wink:

here is a way to have it check what day it is today and set the color appropriately.

ha-card {
  {% set days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] %}
  {% set today = days[as_timestamp(now()) | timestamp_custom('%w') | int -1] %}
  {% set day = days[as_timestamp(state_attr('weather.openweathermap', 'forecast')[2].datetime) | timestamp_custom('%w') | int -1] %}
  {% if today == day %}
    background: #5596f6;
  {% else %}
    background: transparent;
  {% endif %}
}

you can of course include your other things like getting rid of the border, setting the height and width, etc.

1 Like

OfCourse when i will finish it i will post it in english.

For the color background, i am think that only the 1st box from the left in the forecast need to change just the color because its the day that we have today.

true. that is a good point.

if you wanted you could also have it be selections using for example input booleans as the entities to toggle, then have the graph update to show the graph for that day (if it is different). so then you would color the day based on the selection of the user instead.

1 Like

This is very nice idea, it will go in the todo list :slight_smile:

1 Like

Hello,
I thought I’d share the Solar information in case anyone else needs it.
- Mushroom card :mushroom:
- Apexcharts card :chart:
- Card mod :credit_card:
- Layout card
- Custom brand icons :information_source:

  1. More Inverter active power (W) - active and inactive status (pulses blue if active, gray if inverter does not detect sun and is not charging)
  2. PW Power summary for several inverters (W) – active and inactive status (orange if active, gray if not charging)
  3. Inverters with Daily yield display (kWh)
  4. Accumulator charge level
  5. Apexcharts - Return to Grid - Grid Consumption - Total Yield 24h. In the middle, current power is indicated with flow direction (the icon and text are green if there is an export and the icon and text are red if there is an import.
  6. Daily Grid Consumption (kWh)
  7. Return to grid (kWh)
  8. Daily Yield (kWh)

type: vertical-stack
cards:
  - type: custom:layout-card
    layout_type: grid
    layout:
      width: 100%
      grid-template-columns: 1fr 1fr 1fr
    cards:
      - type: custom:mushroom-template-card
        entity: sensor.sun2000_10ktl_active_power
        primary: 10KTL Inverter
        secondary: '{{(states(''sensor.sun2000_10ktl_active_power''))}} W'
        layout: vertical
        fill_container: false
        icon: |
          {% set state=states('sensor.sun2000_10ktl_device_status') %}
          {% if state=='On-grid' %}
          phu:huawei-solar-inverter
          {% elif state!='Standby:no irradiation' %}
          phu:huawei-solar-inverter
          {% endif %}
        icon_color: |
          {% set state=states('sensor.sun2000_10ktl_device_status') %}
          {% if state=='On-grid' %}
          #41bdf5
          {% elif state!='Standby:no irradiation' %}
          disabled
          {% endif %}
        secondary_info: state
        multiline_secondary: false
        badge_icon: ''
        badge_color: ''
        tap_action:
          action: more-info
        card_mod:
          style:
            mushroom-shape-icon$: |
              .shape {
                
                --shape-color: none !important;
                
                {% if is_state('sensor.sun2000_10ktl_device_status', 'On-grid') %}
                --shape-animation: blink 5s linear infinite;
                {% endif %}
              }
              @keyframes blink {
                  30% {opacity: 0;}
              }
            .: |
              ha-card {
                margin-top: 10px;
                --icon-size: 50px;
                --icon-symbol-size: 30px;
                --card-secondary-font-size: 10px;
                --card-primary-font-size: 12px;
                padding-top: 5px !important;
                padding-bottom: 5px !important;
              }
      - type: custom:mushroom-template-card
        entity: sensor.sun2000_6ktl_active_power
        primary: 6KTL Inverter
        secondary: '{{(states(''sensor.sun2000_6ktl_active_power''))}} W'
        layout: vertical
        fill_container: false
        icon: |
          {% set state=states('sensor.sun2000_6ktl_device_status') %}
          {% if state=='On-grid' %}
          phu:huawei-solar-inverter
          {% elif state!='Standby:no irradiation' %}
          phu:huawei-solar-inverter
          {% endif %}
        icon_color: |
          {% set state=states('sensor.sun2000_6ktl_device_status') %}
          {% if state=='On-grid' %}
          #41bdf5
          {% elif state!='Standby:no irradiation' %}
          disabled
          {% endif %}
        secondary_info: state
        multiline_secondary: false
        tap_action:
          action: more-info
        card_mod:
          style:
            mushroom-shape-icon$: |
              .shape {
                
                --shape-color: none !important;
                
                {% if is_state('sensor.sun2000_6ktl_device_status', 'On-grid') %}
                --shape-animation: blink 5s linear infinite;
                {% endif %}
              }
              @keyframes blink {
                  30% {opacity: 0;}
              }
            .: |
              ha-card {
                margin-top: 10px;
                --icon-size: 50px;
                --icon-symbol-size: 30px;
                --card-secondary-font-size: 10px;
                --card-primary-font-size: 12px;
                padding-top: 5px !important;
                padding-bottom: 5px !important;
              }
      - type: custom:mushroom-template-card
        entity: sensor.solar_inverter_daily_power
        primary: PV Power
        secondary: |-
          {% set state=states('sensor.solar_inverter_daily_power') %}
                {% if state | is_number and state | float > 0 %}
                  {{(states('sensor.solar_inverter_daily_power'))}} W
                {% elif state | is_number and state | float < 0 %}
                  {{(states('sensor.solar_inverter_daily_power'))}} W
                {% else %}
                  {{(states('sensor.solar_inverter_daily_power'))}} W
                {% endif %}
        layout: vertical
        fill_container: false
        icon: |-
          {% set state=states('sensor.solar_inverter_daily_power') %}
                {% if state | is_number and state | float > 5 %}
                  mdi:solar-panel-large
                {% elif state | is_number and state | float < 0 %}
                  mdi:solar-panel-large
                {% else %}
                  mdi:grid-off
                {% endif %}
        icon_color: |-
          {% set state=states('sensor.solar_inverter_daily_power') %}
                {% if state | is_number and state | float > 0 %}
                  #FFA500
                {% elif state | is_number and state | float < 0 %}
                  #9ACD32
                {% else %}
                  disabled
                {% endif %}
        secondary_info: state
        multiline_secondary: true
        tap_action:
          action: more-info
        card_mod:
          style:
            mushroom-shape-icon$: |
              .shape {
                
                --shape-color: none !important;
            .: |
              ha-card {
                margin-top: 10px;
                --icon-size: 50px;
                --icon-symbol-size: 30px;
                --card-secondary-font-size: 10px;
                --card-primary-font-size: 12px;
                padding-top: 5px !important;
                padding-bottom: 5px !important;
                --secondary-text-color:  {% set state=states('sensor.solar_inverter_daily_power') %} {% if state | is_number
                  and state | float > 100 %}
                  #9ACD32
                {% elif state | is_number and state | float < 0 %}
                  #f77c7c
                {% else %}
                  #A9A9A9
                {% endif %};
                }
              }
    card_mod:
      style: |
        ha-card {
          height: 150px;
        }
  - type: custom:layout-card
    layout_type: grid
    layout:
      width: 100%
      grid-template-columns: 1fr 2fr
      grid-template-rows: auto
      margin: 0px
      padding: 0px
    cards:
      - type: custom:stack-in-card
        cards:
          - type: custom:mushroom-entity-card
            entity: sensor.sun2000_10ktl_daily_yield
            icon: mdi:solar-power-variant
            icon_color: '#FFA500'
            hold_action:
              action: none
            primary_info: name
            secondary_info: state
            name: 10KTL
            card_mod:
              style: |
                :host {
                  --mush-card-primary-font-size: 12px;
                  --mush-card-secondary-font-size: 10px;
                }
                ha-card {
                  margin-top: -10px;
                  margin-right: -8px;
                }
          - type: custom:mushroom-entity-card
            entity: sensor.sun2000_6ktl_daily_yield
            icon_color: '#FFA500'
            icon: mdi:solar-power-variant
            hold_action:
              action: none
            primary_info: name
            secondary_info: state
            name: 6KTL
            card_mod:
              style: |
                :host {
                  --mush-card-primary-font-size: 12px;
                  --mush-card-secondary-font-size: 10px;
                }
                ha-card {
                  margin-top: -10px;
                  margin-right: -8px;
                }
          - type: custom:mushroom-entity-card
            entity: sensor.luna2000_battery_state_of_capacity
            icon_color: '#9ACD32'
            hold_action:
              action: none
            primary_info: name
            secondary_info: state
            name: Battery
            card_mod:
              style: |
                :host {
                  --mush-card-primary-font-size: 12px;
                  --mush-card-secondary-font-size: 10px;
                }
                ha-card {
                  margin-top: -10px;
                  margin-right: -8px;
                }
        card_mod:
          style: |
            ha-card {

              --ha-card-box-shadow: 0px;
            }
      - type: custom:stack-in-card
        cards:
          - type: custom:apexcharts-card
            experimental:
              color_threshold: true
            chart_type: radialBar
            graph_span: 5day1s
            span:
              end: day
            show:
              loading: false
            cache: true
            update_interval: 10min
            apex_config:
              chart:
                height: 250px
              plotOptions:
                radialBar:
                  offsetY: -20
                  startAngle: -135
                  endAngle: 135
                  hollow:
                    size: 45%
                  dataLabels:
                    name:
                      show: false
                    value:
                      show: false
              legend:
                show: false
              stroke:
                dashArray: 0
                lineCap: flat
            series:
              - entity: sensor.p1_teljes_energia_visszataplalas
                type: area
                name: CPU
                color_threshold:
                  - value: 0
                    color: rgb(183, 201, 145)
                  - value: 10
                    color: rgb(173, 199, 117)
                  - value: 30
                    color: rgb(154, 205, 50)
                group_by:
                  func: diff
                  duration: 1d
              - entity: sensor.p1_teljes_energia_vetelezes
                type: area
                name: RAM
                color_threshold:
                  - value: 0
                    color: rgb(245, 201, 201)
                  - value: 25
                    color: rgb(245, 154, 154)
                  - value: 35
                    color: rgb(247, 124, 124)
                group_by:
                  func: diff
                  duration: 1d
              - entity: sensor.solar_panel_total_yield
                type: area
                name: SSD
                color_threshold:
                  - value: 0
                    color: rgb(247, 210, 141)
                  - value: 15
                    color: rgb(247, 197, 104)
                  - value: 30
                    color: rgb(255, 165, 0)
                group_by:
                  func: diff
                  duration: 1d
            card_mod:
              style: |
                ha-card {
                  background: none;
                  --ha-card-box-shadow: 0px;
                }
          - type: custom:mushroom-template-card
            entity: sensor.p1_aktiv_teljesitmeny
            tap_action:
              action: more-info
            primary: |-
              {% set state=states('sensor.p1_aktiv_teljesitmeny') %}
                {% if state | is_number and state | float > 0 %}
                  - {{(states('sensor.p1_aktiv_teljesitmeny'))}} kWh
                {% elif state | is_number and state | float < 0 %}
                  {{(states('sensor.p1_aktiv_teljesitmeny'))}} kWh
                {% else %}
                  No data
                {% endif %}
            icon_color: |-
              {% set state=states('sensor.p1_aktiv_teljesitmeny') %}
                {% if state | is_number and state | float > 0 %}
                  #f77c7c
                {% elif state | is_number and state | float < 0 %}
                  #9ACD32
                {% else %}
                  disabled
                {% endif %}
            icon: |-
              {% set state=states('sensor.p1_aktiv_teljesitmeny') %}
                {% if state | is_number and state | float > 0 %}
                  mdi:transmission-tower-export
                {% elif state | is_number and state | float < 0 %}
                  mdi:transmission-tower-import
                {% else %}
                  mdi:transmission-tower-off
                {% endif %}
            layout: vertical
            card_mod:
              style: |
                :host {
                  --mush-card-primary-font-size: 12px;
                  --mush-icon-border-radius: 50%;
                  --mush-icon-size: 72px; 
                  --primary-text-color:  {% set state=states('sensor.p1_aktiv_teljesitmeny') %} {% if state | is_number
                  and state | float > 0 %}
                  #f77c7c
                {% elif state | is_number and state | float < 0 %}
                  #32CD32
                {% else %}
                  black
                {% endif %};
                }
                ha-card {
                  background: transparent;
                  margin-top: -112px;
                  width: 120px;
                  margin-left: auto;
                  margin-right: auto;
                }
  - type: custom:layout-card
    layout_type: grid
    layout:
      width: 100%
      grid-template-columns: 1fr 1fr 1fr
      grid-template-rows: auto
      margin: 0px
      padding: 0px
    cards:
      - type: custom:mushroom-template-card
        icon: mdi:transmission-tower-export
        layout: vertical
        primary: Grid Consumption
        icon_color: '#f77c7c'
        secondary: '{{(states(''sensor.energia_vetelezes_napi''))}} kWh'
        entity: sensor.energia_vetelezes_napi
        tap_action:
          action: more-info
        card_mod:
          style: |
            :host {
              margin-top: -10px;
              --mush-icon-size: 60px;
              --mush-card-primary-font-size: 12px;
              --mush-card-secondary-font-size: 10px;
            }
            mushroom-shape-icon {
              --shape-color: none !important; 
            }
            ha-card {
              padding-top: 5px !important;
              padding-bottom: 5px !important;
            }
        badge_icon: ''
        badge_color: ''
      - type: custom:mushroom-template-card
        icon: mdi:transmission-tower-import
        layout: vertical
        primary: Return to grid
        icon_color: '#9ACD32'
        tap_action:
          action: more-info
        secondary: '{{(states(''sensor.energia_visszataplalas_napi''))}} kWh'
        entity: sensor.energia_visszataplalas_napi
        card_mod:
          style: |
            :host {
              margin-top: -10px;
              --mush-icon-size: 60px;
              --mush-card-primary-font-size: 12px;
              --mush-card-secondary-font-size: 10px;
            }
            mushroom-shape-icon {
              --shape-color: none !important; 
            }
            ha-card {
              padding-top: 5px !important;
              padding-bottom: 5px !important;
            }
      - type: custom:mushroom-template-card
        icon: mdi:sun-wireless
        layout: vertical
        primary: Daily Yield
        icon_color: '#FFA500'
        tap_action:
          action: more-info
        secondary: '{{(states(''sensor.solar_panel_daily_yield''))}} kWh'
        entity: sensor.solar_panel_daily_yield
        card_mod:
          style: |
            :host {
              margin-top: -10px;
              --mush-icon-size: 60px;
              --mush-card-primary-font-size: 12px;
              --mush-card-secondary-font-size: 10px;
            }
            mushroom-shape-icon {
              --shape-color: none !important; 
            }
            ha-card {
              padding-top: 5px !important;
              padding-bottom: 5px !important;
            }


10 Likes