Auto generating mushroom dashboard using strategies



GitHub Link

Howdy! :wave:

I wanted to share this custom strategy I made that automagically creates a dashboard from the areas and devices you have configured in Home Assistant.
It has a home view that shows all the people and cards for each room. Each room has its own subview that shows all the devices and entities in that room. I also created some pre-built views in the strategy that shows domain-specific entities and devices like lights, switches and more.

Usage

To use this, you can add this to your Home Assistant instance via HACS or manually downloading it. You also need Mushroom cards, mini-graph card and WebRTC integration. then just add these 3 lines of code in the Raw configuration editor

strategy:
  type: custom:mushroom-strategy
views: []

Customizability

I tried to make it as customizable as possible to fit most of your needs.

You can easily hide unwanted entities by going to the UI and setting the entity status to hidden or disabled (if you donā€™t want to use it in Home Assistant at all).

I added options toā€¦

  • Disable pre-built views and pre-built chips.
  • Add your own additional cards in various places on the dashboard.
  • Customize the card for a specific entity
  • Customize the room cards

if you think there is something that should be added, feel free to tell me.

Remarks

I have been using Home Assistant for some time now and love the community. I hope this creates more strategies for other cards and dashboard layouts. I am finally giving something back but I am also not a skillful developer and this is actually my first ever javascript and GitHub repository. I will love to hear some feedback and some advice from you guys. Thanks

27 Likes

Nice! Always great to see people create and share strategies :+1:

3 Likes

Getting this error:

Error loading the view strategy:

TypeError: Cannot read properties of undefined (reading ā€˜areaā€™)

Do you just have this in your raw configuration?

strategy:
  type: custom:mushroom-strategy
views: []

Error loading the dashboard strategy:
Error: Timeout waiting for strategy element ll-strategy-mushroom-strategy to be registered

Nothing in logs :confused:

Would you know how I can fix this ?

My configuration:

strategy:
  type: custom:mushroom-strategy
  options:
    areas:
      - name: Salon
        icon: mdi:sofa
        icon_color: green
views:
  - lights: true

Hey!
I see a few errors in your configuration. The views option should be indented so it is under options and views shouldnā€™t have a -
like this

strategy:
  type: custom:mushroom-strategy
  options:
    areas:
      - name: Salon
        icon: mdi:sofa
        icon_color: green
    views:
      lights: true
views: []

I updated examples to make it a bit easier to understand

Are you sure ?
When trying yours:


Votre configuration n'est pas valide : r: At path: views -- Expected an array value, but received: [object Object]


Yes, I am sure.
It seems like you didnā€™t indent it properly. Note that there are 2 views.
One is not indented at all, views: []
and the other is indented so it is under options

strategy:
  type: custom:mushroom-strategy
  options:
    views:
      lights: true

What I suspect you wrote based on the error is this

strategy:
  type: custom:mushroom-strategy
  options:
    areas:
      - name: Salon
        icon: mdi:sofa
        icon_color: green
views:
  lights: true

So I applied your configuration, and I can register it. THX!

Anyway, Iā€™m still having the same issue:

Error: Timeout waiting for strategy element ll-strategy-mushroom-strategy to be registered

How can I get more logs or trying to find where is the issue ?

Best

Hey,
Sorry that youā€™re having issues still.
Does the strategy load up correctly if the configuration is at its minimum?

strategy:
  type: custom:mushroom-strategy
views: []

If not then you will have to make sure you have installed it correctly and the mushroom strategy is present in resources.

What happens when you put this as your configuration?

strategy:
  type: custom:mushroom-strategy
  options:
    areas:
      - name: Salon
        icon: mdi:sofa
        icon_color: green
    views:
      lights: true
views: []

It does work with no errors when I put that in.
You can try going in inspect mode to see more logs (Ctrl + shift + i). Showing a screenshot of the red highlighted errors will help me.
If you have more questions, please ask.

Hi!

Great news: reinstalled the extension and it works!

This is awesome, Iā€™ve been waiting for this for a loooong time!

Splendid job thx !

1 Like

Hi,
Thank you for sharing.
Is there an option to customize the ā€œPerson Cardā€ zone ? I canā€™t find it in the chips options.
Thanks.

Hello, thank you for writing the code for this, very useful tool.

So, Iā€™m trying to use your code to build a different type of dashboard using Leonā€™s Dashboard.

Any idea how I can get this card_mod variable to render in your JavaScript file? Each time I try this it hangs and errors out.

  for (const area of areas)
  {
    definedAreas.add(area);
    roomCards.push
    (
      {
		type: "custom:button-card",
		name: "Test",
		icon: "mdi:sofa-single",
		aspect_ratio: "2/1",
		card_mod: 
		{
		  class: "my_class"
		}


      },
    );
  }
}

Hello,
The Leonā€™s dashboard is pretty cool.
Can you tell me which card you are trying to create? some YAML code will help.

Unfortunately, currently, there are no customization options for that.
Can you tell me what you would like to achieve?

Thank for the reply.
Itā€™s just to filter the display of person card (show or not).

Are there any options to auto sort the area cards by name?

Currently, the order of which you define the areas are used for the order of the area cards. So the closets thing currently is listing your areas in alphabetical order

Hey, quick question; why does this:

image

not hide any of these:

image

It worked with the chips, but not the views?

ā€œI once edited the card in UI mode by chance, but I couldnā€™t get back in after exiting. When I click on ā€˜Edit Dashboardā€™, I can only see those three lines of code. How can I edit the card in UI mode?ā€