thomasloven / lovelace-layout-card

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

Cards not appearing - what' am I doing wrong? #169

Closed selmaohneh closed 2 years ago

selmaohneh commented 2 years ago

Hi!

Just want to get started with lovelace-layout-card. I try to set up a basic simple example by following the documentation on the README. This is my sample:

image

But when I look at my dashboard, the whole tab stays empty.

image

I can't see what I am doing wrong. Any ideas?

Thanks in advance!

tgallacher commented 2 years ago

Try removing "panel: true".

I found this as well. Like me, you using the Grid layout as the outermost / parent card so I don't think the panel attribute is needed.

selmaohneh commented 2 years ago

Try removing "panel: true".

I found this as well. Like me, you using the Grid layout as the outermost / parent card so I don't think the panel attribute is needed.

I just tried that, nothing changed. :-/

tgallacher commented 2 years ago

Huh.

Just did some checking and I can replicate this. There seems to be a bug here, as the Grid component doesn't have any children when it is set as the parent card within a panel view.

I've found a workaround though, using the custom layout card variant in this package. So, you just need to tweak what you have above to something like:

- title: Tests
  path: testi
  type: panel
  cards:
    - type: custom:layout-card
      layout_type: custom:grid-layout
      layout:
        ...
      cards:
        ...

Hope that helps / works for you

tgallacher commented 2 years ago

Possibly related, but this has actually allowed me to fix a similar issue I was having with no cards appearing 💪 .

In my simple case, I had a custom:horizontal-layout card nested within a custom:grid-layout card and none of the child cards were being rendered at all.

Example:

- type: custom:grid-layout
  layout:
    ...
  cards:
    - type: markdown
      view_layout:
        grid-area: ...
      content: >-
        Hello

    - type:  custom:horizontal-layout
      view_layout:
        grid-area: ...
      layout:
        ...
      cards:
        ...

To get the cards rendering, I need to change this to the above workaround:

- type: custom:grid-layout
  layout:
    ...
  cards:
    - type: markdown
      view_layout:
        grid-area: ...
      content: >-
        Hello

    - type:  custom:layout-card
      layout_type: custom:horizontal-layout
      view_layout:
        grid-area: ...
      layout:
        ...
      cards:
        ...

and hey-presto, everything works.

selmaohneh commented 2 years ago

Yeah, that seems work! Thanks so far.

I am fine with this workaround. Not sure if I should close the issue or keep it open since it is a bug?

thomasloven commented 2 years ago

It is not a bug. grid-layout is a layout - as the name implies, not a card and should not be used as such.