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

Hi
How do we change the state colour of the light card, when not using light colour I want the state colour to be blue instead of orange?
Thanks

Worked it out it , changed this in mushroom theme.
mush-rgb-state-light: 3, 169, 244

1 Like

I got it:

image

it was an attribute “alignment” set to center

1 Like

Thanks for this! This made designing my mobile dashboard so much easier. I have a garage cover card, built on the cover card. Is it possible to add a restriction card to this? I wanted to add a pin to the garage. I tried to edit the code to this but no avail. Any tips?

type: custom:restriction-card
restrictions:
  pin:
    code: 2244

type: custom:mushroom-cover-card
entity: cover.garage
show_position_control: false
show_buttons_control: true
2 Likes

How is your sensor set up? What’s the state when you have no lights on?

This sensor shows the value 0 when no lights are on (where light.alle_lys_lamper is my light group for all my lights):

current_lights_on:
            friendly_name: All Lights Currently On
            value_template: >-
              {{ expand('light.alle_lys_lamper')|selectattr('state','eq','on')|list|count }}

I have this as a sensor:

sensor:
  - platform: template
    sensors:
      lights_active:
        value_template: >-
          {% set lights = [states.light.newfanlight, states.light.desk_lamp, states.light.hallway, states.switch.bathroom,
          states.light.livingroom_dimmer, states.light.entryway, states.light.hanging_lamp, states.switch.sp10_2, states.light.girls_light, states.light.boy_light] %}
          {% set lights_on = lights | selectattr('state','eq','on') | list %}
          {% set lights_name = lights | selectattr('state','eq','on') | map(attribute='name') | join(', ') %}
          {% if (lights_on | length ==1)%}
          {{ lights_name }} is on
          {% elif (lights_on | length >1 )%}
          {{ lights_on | length}} lights are on
          {% else %}
          <font color='#6a7377'>Everything is off!</font>
          {% endif %}

and then I just use a basic template chip card

    chip:
      type: template
      entity: sensor.lights_active
      icon: mdi:lightbulb
      icon_color: yellow
      content: '{{ states(''sensor.lights_active'')}}'

image

5 Likes

Figured it out. Here for reference in case anyone else comes across this. Basic formatting error!

type: custom:restriction-card
restrictions:
  pin:
    code: xxxx
card:
  type: custom:mushroom-cover-card
  entity: cover.garage
  show_position_control: false
  show_buttons_control: true

2 Likes

Hi,

is there a way to hide the name of the light-entity card ?
If I use as Space the icons isn’t centered anymore :

thanks

is there a way to color an icon if the stare is higher/lower then a set value?
something like {{ 'green' if is_state(entity,>'40') else 'red' }}

Yes, I use this for some travel time sensors that I display with a mushroom template card. The sensor gives me a numeric state that represents minutes. I use the grey for something that could be invalid.
In your case you’d only need the red and the else.

          icon_color: |-
            {% set state = states('sensor.my_commute_in') %}
            {% if is_number(state) and state | float > 44 %} red 
            {% elif is_number(state) and state | float > 34 %} amber 
            {% elif is_number(state) and state | float > 1 %} green 
            {% else %} grey
            {% endif %}
5 Likes

or a easier methode then card_mod

chips:
  - type: template
    entity: input_select.home_mode
    icon_color: "{% if is_state('input_select.home_mode','Home') %} amber {% endif %}"
    icon: mdi:lightbulb
2 Likes

The state of sensor when all lights is off is 0

lights_on_count:
        friendly_name: "Lights On count"
        value_template: >
          {% set reject = ['light.goup_kitchen', 'light.goup_living_room'] %}
          {{ states.light | rejectattr('entity_id', 'in', reject) | selectattr('state','equalto','on')| list | length  }}

What’s strange

If I add text after the status of the sensor it displays the 0 and if I don’t add text after the sensor it doesn’t display the 0

Example :

If I put this in Content in my chip template:

{{states('sensor.lights_on_count') }} lights 

it shows me 0 lights

but if I do this

{{states('sensor.lights_on_count') }}

it doesn’t show me anything

The fact of not putting text after the sensor, it does not display 0 but on the other hand if I turn on one or more lights it displays the right number

Template dont want show “0”, i dont know why…

That’s i why i made like this.

type: template
double_tap_action:
  action: none
entity: sensor.number_of_lights_on
icon: mdi:lightbulb
icon_color: |-
  {% set state=states('sensor.number_of_lights_on') %}
  {% if state=='0' %}
  black
  {% elif state!='0' %}
  yellow
  {% endif %}
content: |-
  {% set state=states('sensor.number_of_lights_on') %}
  {% if state=='0' %}
  {{'wył.'}} 
  {% elif state!='0' %}
  {{(states('sensor.number_of_lights_on'))}} 
  {% endif %}
tap_action:
  action: none
hold_action:
  action: none

and when is off is info “wył” (off)

and numbers when are on.

4 Likes

How about this? @xisio @MSBIZ

{{ states.sensor.lights_on_count.state }}

@piitaya Hi Paul, I read trough all posts and you already received many congrats. But let me add one more. Magnificent set of cards !
However I am also looking for some more flexibility regarding icon en icon color control, based on the state of an entity. This is already included in the template card, but I also could use this functionality on specific designed cards like the cover card. Is there any chance that this functionality will also be made available on some of the more specific cards like the cover card?
I do understand you do not want to overcomplicate things but this would be a really nice addition.
My current workaround is to “mimic” the cover card using 2 nested grid cards filled with 4 template cards. Below in the picture on top the out-of-the-box mushroom variant and below my current workaround.

image

Just sensor with all devices what you want count as light.

-  sensor:
      - name: "number_of_lights_on"
        unit_of_measurement: ""
        state: >
          {% set lights = [
            states.light.taras_kinkiet1,
            states.light.taras_swiatlo,
            states.light.lazienka_led,
            states.light.lazienka_swiatlo,
            states.light.korytarz_led,
            states.light.korytarz_swiatlo,
          ] %}
          {{ lights | selectattr('state','eq','on') | list | count }}
3 Likes

So far I’m really liking these cards. I’m using conditional cards to show light controls when the lighting isn’t on “auto”. If it is, I show a scene selector. Also the chips are very nice for showing the auto/manual control and a link to the settings dashboard (haven’t found a way to align them to the bottom though).

1 Like

Thank you for the idea! I have made a card for each area
Just what I needed to finish my home page

21 Likes

Agree! I love the template card but there are some cards (light card for example) where I’d love the icon to be colored even when off to match the rest of my layout.

Which card are you using for the rooms in your screen shot? It looks really nice. Is that a template card? How are you getting multiple entities displayed? Just adding them to the info lines with templates?

Is quite simple:
Template card + chips card in a “Vertical Stack In Card” custom card

1 Like