Having issue with !include for Lovelace - Solved

I’m running HA on a VM on Unraid. I’m on Version 0.87.1 and it’s set for lovelace mode: yaml in configuration.yaml. Everything (so far) works just fine, but for the life of me, I can’t get - !include to work in the ui-lovelace.yaml.

The ui-lovelace.yaml us very basic:

views:
- !include lovelace/01home.yaml

For the 01home.yaml I’m using the default:
title: My Awesome Home
views:
# View tab title.

  • title: Example
    cards:
    # The markdown card will render markdown text.
    • type: markdown
      title: Lovelace
      content: >
      Welcome to your Lovelace UI.

However, I’m just getting a blank page with “Home Assistant” as the title.
If I change it to config\lovelace\01home.yaml it defaults to (I’m guessing) the .storage/lovelace file.

I know that this is possible, I’ve seen it work. I know that there was an issue in an older build but they restore this feature so what am I missing?

Your ui-lovelace.yaml file is the only one allowed to have the views (I think…). At least that’s how mine is set up and it works fine.

ui-lovelace.yaml:

resources:
  ## other resources for custom cards: 
  ## https://github.com/ciotlosm/custom-lovelace
  
  ## https://github.com/thomasloven/lovelace-card-tools
  - url: /local/lovelace/card-tools.js?v=297fcc
    type: js
  
  ## https://github.com/thomasloven/lovelace-slider-entity-row  ##
  - url: /local/lovelace/slider-entity-row.js
    type: js
    
title: Docker - Lovelace
views:
  - !include '/config/lovelace_views/lovelace_main_view.yaml'
  - !include '/config/lovelace_views/lovelace_media_view.yaml'
  - !include '/config/lovelace_views/lovelace_environment_view.yaml'
  - !include '/config/lovelace_views/lovelace_automations_view.yaml'

then in the include file - lovelace_main_view.yaml:

title: Main
#icon:
#badges:
#  - binary_sensor.ha_update_avail_template
#  - binary_sensor.ha_api_mqtt_test
cards:
  - type: entity-filter
    show_header_toggle: false
    show_empty: false
    card: 
      type: glance
      #title: People at home
    state_filter: 
      - "on"
    entities:
      - binary_sensor.ha_update_avail_template
      - binary_sensor.haapi_mqtt_test
  - type: conditional
    conditions:
      - entity: sensor.nws_alerts_are_active
        state: 'on'
      - entity: input_boolean.bool_9
        state: 'on'
    card:
      type: entities
      entities:
        #- persistent_notification.nwswxalert
        - input_boolean.bool_9
        - type: custom:entity-attributes-card
          entity: sensor.nws_alers
          filter:
            include:
              - sensor.nws_alerts.display_desc

make sure your files are in the correct location for your !include statements.

And make sure that the contents of your included yaml files all start to the far left margin. IOW, “title:” in the lovelace_main_view.yaml should be all the way left then your indentation is based on that margin per my example above.

1 Like

Aaahhhhh the view was messing it up. Live and learn.

Thanks for replying :slight_smile: