#Using button-card templates for YAML dashboards

1 messages · Page 1 of 1 (latest)

verbal breach
#

I'm entering the world of button-card templates.

I created a templates.yaml file in dashboards/ that contain my button_card_templates

However I'm confused how I could then reference a template in a different yaml file say dashboards/views/home.yaml, I'm assuming I would need to reference or import it somewhere but I'm not positive where.

crude violet
# verbal breach I'm entering the world of button-card templates. I created a `templates.yaml` f...

My setup looks as follows. I have a main.yaml in which I reference the button cards templates and also all the view.yaml‘s my dashboard has. This way you only need to reference the templates once.


title: Dashboard
button_card_templates: !include_dir_merge_named "/config/dashboards/dashboard/templates/"
streamline_templates: !include_dir_merge_named "/config/dashboards/dashboard/streamline_templates/"

views: !include_dir_list "/config/dashboards/dashboard/views/"

kiosk_mode:
  non_admin_settings:
    hide_header: true
    ignore_entity_settings: true
  mobile_settings:
    hide_header: true

verbal breach
#

Hmm. Maybe I'm missing something.

I have a dashboard defined in dashboards/home.yaml which at the top looks like

title: "Overview"
button_card_templates: !include templates.yaml
views:
  - !include views/home.yaml
  - !include views/solar.yaml

Then in dashboards/templates.yaml I have

button_card_templates:
  pv_panel:
    aspect_ratio: 200/120
    show_entity_picture: true
    show_icon: false
    show_state: true
    ....

Should I be able to say template: pv_panel in views/solar.yaml?

I thought so, but am getting Configuration error

crude violet
#

What about the ““ for the url?

verbal breach
#

Which URL? do you mean after the !include ?

crude violet
#

Look at my example.