decluttering-card icon indicating copy to clipboard operation
decluttering-card copied to clipboard

Use templates across Dashboards

Open rahaaas opened this issue 4 years ago • 4 comments

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.

rahaaas avatar Jun 03 '21 13:06 rahaaas

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?

masman69 avatar Jan 15 '22 17:01 masman69

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:
...

SirIndubitable avatar Mar 17 '22 23:03 SirIndubitable