thomasloven / lovelace-layout-card

🔹 Get more control over the placement of lovelace cards.
MIT License
1.05k stars 125 forks source link

Please help with defining a !include #173

Closed steveuk23 closed 2 years ago

steveuk23 commented 2 years ago

My Home Assistant version: 2021.11.5

Layout-card version 2.3.1

What I am doing: Trying to create a sidebar using This Method

What I expected to happen:

A sidebar should appear on my dashboard

What happened instead: I'm getting a error saying "/config/yamldash2.yaml", line 24, column 9: Unable to read file /lovelace/components/sidebar.yaml. I have added the sidebar.yaml file into the config/lovelace/components folder i have tried various folder locations and paths now but it's not picking up the sidebar.yaml file at all. Thanks

Minimal steps to reproduce: Use this code in a yaml dashboard

path: test
title: Test
cards:
  - type: custom:layout-card
    layout_type: custom:grid-layout
    layout:
      grid-template-columns: 20% 30px auto
      grid-template-rows: auto
      grid-template-areas: |
        "sidebar . main"
      mediaquery:
        "(max-width: 600px)":
          grid-template-columns: 100%
          grid-template-areas: |
            "sidebar"
            "main"
        "(max-width: 800px)":
          grid-template-columns: 50% 50%
          grid-template-areas: |
            "sidebar"
            "main"
    cards:
      - !include /lovelace/components/sidebar.yaml
      - type: entities
        entities:
          - light.bedroom
        title: Bedroom
        view_layout:
          grid-area: main

End of code



Error messages from the browser console:

---

**By putting an X in the boxes ([X]) below, I indicate that I:**

- [] Understand that this is a channel for reporting bugs, not a support forum (https://community.home-assistant.io/).
- [] Have made sure I am using the latest version of the plugin.
- [] Have followed the troubleshooting steps of the "Common Problems" section of https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins.
- [] Understand that leaving one or more boxes unticked or failure to follow the template above may increase the time required to handle my bug-report, or cause it to be closed without further action.
tgallacher commented 2 years ago

I don't believe that /lovelace is a special alias that HomeAssistant knows anything about. You should use the full path instead:

cards:
  - !include /config/lovelace/components/sidebar.yaml
  ...
steveuk23 commented 2 years ago

I don't believe that /lovelace is a special alias that HomeAssistant knows anything about. You should use the full path instead:

cards:
  - !include /config/lovelace/components/sidebar.yaml
  ...

Thanks for the reply. I was just coming on here to edit this as I changed it to your suggestion and it picks it up fine now. The code above with the sidebar code is meant to show a "sidebar" in home assistant but it's not doing, but I've asked the original creator on that other page so hopefully he can advise. Unless you can see where I've gone wrong. Cheers

tgallacher commented 2 years ago

Had a quick glance at the linked thread. My question would be:

Do you have a ui-lovelace.yml card or a lovelace.dashboards entry inside your configuration.yml?

steveuk23 commented 2 years ago

Had a quick glance at the linked thread. My question would be:

  • How are you exposing this dashboard?

Do you have a ui-lovelace.yml card or a lovelace.dashboards entry inside your configuration.yml? Hi thanks for looking. I have it set up as "storage" in my configuration.yaml as with my understanding that meant I could keep my original UI dashboards but have this one as Yaml. This is what's in my configuration.yaml and it does appear in my ha side menu.

lovelace:
mode: storage
dashboards:
yaml-dash:
mode: yaml
title: yamldashnew
show_in_sidebar: true
filename: yamldash2.yaml
thomasloven commented 2 years ago

This is not a layout-card issue unless the exact same line works outside of layout-card.