I have a lot of views on my dashboard and I’d like to use dashboard chips / badges across all of them without having to maintain each view. Is his possible?
#Shared Dashboard Views? Possible?
1 messages · Page 1 of 1 (latest)
So, I have three answers for you depending on what you're willing to do.
The short answer: No. You cannot reuse stuff across different views with a UI-based dashboard.
Next, answer: Maybe. You could implement custom:button-card with configuration templates or Decluttering card. These options would let you define the cards in the Raw Configuration of the dashboard. Then, they could be easily referenced in each view. (Disclaimer: I don't know how well this will work with badges or using the Sections view as I don't use them. Here's an example of how a custom:button-card configuration template would be used: ```yaml
type: custom:button-card
template: generic_custom_button
entity: light.bathroom_lights
name: Bathroom
Last, answer: Yes **if** the dashboard is a YAML-based dashboard (see: [Adding YAML dashboards](<https://www.home-assistant.io/dashboards/dashboards/#adding-yaml-dashboards>)). With this type of dashboard, everything is created in YAML; there is no UI Editor. Using a YAML-based dashboard would let you using YAML anchors (kind of similar to the templates mentioned above) and `!include`s which allow entire blocks of code to be stored/referenced in a separate file.
Here is an example of a YAML anchor being referenced used with a custom:light-entity-card. The anchor is about 35 lines of code. ```yaml
- entity: light.living_room_lights
<<: *light_entity_card_styling
```And here's an `!include`:```yaml
button_card_templates: !include button-card-templates.yaml
Realistically, the best option for dealing with repetitive/reused code is the YAML-based dashboard. There is a lot of flexibility when working with it. If you find yourself repeating a bunch of stuff, just turn it into a YAML anchor. For that matter, you could make a "header" that contains all your badges and just "import" the header into each view with an !include.
Working in YAML can be intimidating at first. Years ago, I wouldn't even attempt trying to use it and relied strictly on the UI. (This was before Automations had a UI and everything was done in YAML. I chose to start automating with Node-RED because of its graphical interface.) Now, it is almost second nature. I still use a UI-based dashboard to test/experiment with cards, but then copy and paste the code into my YAML-dashboard. The big thing to remember about YAML is that it is very particular about indentation (see: YAML syntax).
In YAML, indentation is important for specifying relationships. Indented lines are nested inside lines that are one level higher. In the above example, platform: pushbullet is a property of (nested inside) the notify integration.
Getting the right indentation can be tricky if you’re not using an editor with a fixed-width font. Tabs are not allowed to be used for indentation. The convention is to use 2 spaces for each level of indentation.
YAML-based dashboards also allow comments which can be handy.
You can see one of my YAML-based dashboards here: (https://github.com/dsellers1/home-assistant/tree/main/dashboards/mini-pc)
Thanks, I do prefer to keep it in UI and I had seen the declutterring reference before. Different AIs have mentioned that but it fell short of my true goal. Is it something that could be a future feature or is it just not practical?
Unfortunately, those are pretty much your options. Is it something that may change? Maybe. Any time soon? I wouldn't hold out waiting for it. (It's been this way for the 5-ish years that I've been using HA.) For the longest time, drag-and-drop dashboard design was a big request. That was implemented with Sections view. I dunno what it would take to make something work in the UI.