custom-cards / decluttering-card

🧹 Declutter your lovelace configuration with the help of this card
MIT License
379 stars 29 forks source link

Use templates across Dashboards #43

Open rahaaas opened 3 years ago

rahaaas commented 3 years ago

Have decluttering cards set up and working across single dashboards, but using it on different dashboards results in an error:

"undefined is not an object (evaluating 't.config.decluttering_templates[e.template]’)”

The use case is tablets with different dashboards in different rooms, so I would want to use, for example, my 'House Status’ card across each room.

Is this possible? I’m using the Lovelace GUI and pasting the template YAML in the default dashboard’s Raw Configuration editor.

masman69 commented 2 years ago

Very similar to this issue, I use multiple dashboards using the method described in Dashboards under the section Adding more dashboards with YAML.

With this method, I don't have a lovelace-ui.yaml file. My resources are referenced in configuration.yaml and dashboards included from separate yaml files.

I have tried adding decluttering_templates in the lovelace section under resources and that causes the error: Invalid config for [lovelace]: [decluttering_templates] is an invalid option for [lovelace]

Adding a ui-lovelace file with just decluttering_templates results in the dashboard that includes the templates warning: Cannot read properties of undefined (reading "test_template").

Suggestions on how to use the awesome card with this configuration?

SirIndubitable commented 2 years ago

I think I figured it out, you have to add the decluttering_templates in each yaml dashboard. I did this with includes so I can reuse them between dashboards

configuration.yaml

lovelace:
  mode: yaml
  resources:
    - url: /hacsfiles/decluttering-card/decluttering-card.js
      type: module
  dashboards:
    my-yaml-dashboard:
      mode: yaml
      title: yaml
      show_in_sidebar: true
      filename: my-yaml-dashboard.yaml

my-yaml-dashboard.yaml

decluttering_templates: !include decluttering_templates.yaml
views:
  - path: default_view
    cards:
...
DorwinDT commented 1 month ago

Is there some solution working nowadays for current version of homeassistant? I want to re-use template across various dashboards

ildar170975 commented 1 month ago

I want to re-use template across various dashboards

Available only for yaml-dashboards.