[SOLVED] !include lovelace will only show empty page

Hi everybody,

I am trying to finally split my ui-lovelace.yaml into multiple files. As a template/cheat sheet I tried using jimz011’s configuration.

This is my folder structure (/config beeing the root folder)

lovelace
├── cch
│   └── cch.yaml
├── resources
│   └── resources.yaml
├── templates
│   └── button.yaml
├── ui-lovelace.yaml
└── views
    ├── batterien.yaml
    └── main.yaml

I then copied my cch settings and resources from the original yaml (which was just everything in one large, confusing to read file) to their dedicated yaml files. I am currently not using templates, so I just copied one of his templates and created the folder (so that sourcing the decluttering templates - which I plan on integrating later! - will not be a problem).

Then I added this to my configuration.yaml

homeassistant:
  # (...)
  whitelist_external_dirs:
  # (...)
  - /config/lovelace
  - /config/lovelace/resources
  - /config/lovelace/cch
  - /config/lovelace/templates
  - /config/lovelace/views

Below is my ui-lovelace.yaml

# Custom Cards
resources:
  !include lovelace/resources/resources.yaml

# Compact Custom Header
cch:
  !include lovelace/cch/cch.yaml

# Decluttering Templates
# decluttering_templates:
  # !include_dir_named lovelace/templates

# Hier gehts los
title: Home
# background: var(--background-image) # This is the background image that will be used in all the views. (currently backgrounds are set in themes, dont edit this if you want themes to work)
views:
  !include lovelace/views/batterien.yaml

So then I created the batterien.yaml file; the contents of this file are from a custom battery script that I found here in the forums and that had been automatically generated.

title: Batterien
  badges: []
  cards:
    - type: entities
      entities:
        - input_boolean.low_batteries
        - input_number.battery_alert_threshold_min
        - input_number.battery_alert_threshold_max
        - input_text.delete_battery_sensor
        - input_text.notifier_name
        - input_select.notifier_format
        - automation.battery_persistent_notification
        - automation.battery_persistent_notification_clear
        - automation.battery_notification_default
        - automation.battery_notification_slack
        - automation.battery_sensor_from_attributes
        - automation.update_battery_status_group_members
        - automation.delete_battery_sensor
      title: Batterien Alarm
      show_header_toggle: false
  icon: 'mdi:battery-alert'

As the ui-lovelace.yaml sources the file like this

views:
  !include (...)

with two spaces in front of !include, I assume that it is correct that I removed those two spaces in front of all lines of the batterien.yaml file. I believe that I had also tried leaving those two spaces in the included file, but after posting this, I will try once more and then add information, if that changes anything.

When I restart Home Assistant, I will only get an empty Home page. There is no content at all.

Here is the confusing part

I have lovelace: yaml in my configuration.yaml; however, after restart Home Assistant, I am able to click the button to modify the page in the browser; when I do, I have to agree to this once, then I get a popup with The edit UI is not available when in YAML mode.. Yeah, exactly! I did not expect this to work, but why did I have to enable yaml config anyway, when it was already in my configuration file?

I still have my old ui-lovelace.yaml backed up, so I will just resort to it for now. But can you please tell me what to change so that sourcing each view from a different file will work?

Thank you :slight_smile:

This will pop up each time I reload the page. I get information about lovelace being changed, and when I click reload, I get this warning again. Really weird.

bad spacing

  title: Batterien
  badges: []
  cards:
    - type: entities
      entities:

Thank you. Unfortunately, this is still not working. I get an empty page and the same prompt when reloading it. I just switched back to my previous lovelace file; when I reload, I get the previous layout. When I then switch to this new version and reload, I get the error again.

My mistake, add the bullet. Or include each view:

views:
- !include..
- !include..

Yes! Thank you so much :slight_smile: This works now.