A tip for splitting up your Lovelace config

whats at line 51, character 11?

1 Like

Assuming your basic ui-lovelace.yaml structure is correct - ie. ‘views:’ is at the top level (far left) - it’s probably something in one of the included files.

Can you try moving files out of the directory one at a time, refreshing, and see if a particular one is causing the problem?

Typically when that occurs it calls out the position of the include which should be 6 or 7 characters in not 11. Something else is going on in his config.

1 Like

create a new topic.

1 Like

Hi!

I just splitted my ui-lovelace.yaml and works fine. The only problem is that my VSC show me a problem at ui-lovelace.yaml.
Incorrect type. Expected “array”. Why?

I use this code instead:

#
# Views
#
views: !include_dir_merge_list lovelace/

Hi,

I have same issue. Did you resolve this Incorrect type. Expected “array” message somehow?

Nothin…i changed configuration but the same result… i modified to merge and change ui-lovelace directory to lovelace buy HA do not show screen

am I wrong something or is it normal? let me explain, with the separation of lovelace into single files / views also for the simple configuration changes in lovelace I have to restart the assistant, when before it was enough to just update the page. it’s normal?

just hit Refresh, it’s in top-right corner when you click on three vertical dots

1 Like

thanks very kind

I am trying to use some tips from @petro splitting up my ui-lovelace.yaml. I do use anchors in my main ui-lovelace.yaml file, but it seems to be that i cannot use the anchor withing a view which is included. So

I do have

views: 
  - !include lovelace/views/01-home.yaml

Within the include file i cannot call the anchor and getting error ‘found undefined alias’
How do i solve this?

You can’t. Either use includes and no anchors. Or use no inlcudes and anchors.

Your other options are to use the decluttering card (as your anchors) with includes. Also, lovelace_gen with includes (No need for anchors).

Currently I use lovelace_gen. It allows you to piece meal your entire config but it’s not easy to set up. And you have to use heavy jinja in order to piece meal everything.

1 Like

I am not sure if I did the right thing. I’ve split the ui-lovelace.yaml file.

custom_header:
  compact_mode: true

views:
  - !include /config/lovelace/views/view_floorplan.yaml

And in the folder /lovelace/view/ the file view_floorplan.yaml

views:
  - id: 0
    icon: 'mdi:home'
    name: Floorplan
    panel: true
    path: floorplan
    title: Floorplan
    cards:
      - elements:
          - entity:
#etc

Bu I only get an empty view.

you’re already specifying view ui-lovelace.yaml as well as the dash (indicating the view). Therefore you don’t need either inside vew_floorplan.yaml.

id: 0
icon: mdi:home
... etc...
2 Likes