thomasloven / lovelace-layout-card

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

grid-layout not work with multple auto-entities #265

Open ceinmart opened 10 months ago

ceinmart commented 10 months ago

My Home Assistant version: 2023.12.1

Layout-card version (FROM BROWSER CONSOLE): 2.4.4

What I am doing: trying to convert a vertical-stack, which have 3 auto-entities columns to a grid-layout to auto adjust they layout.

What I expected to happen: just works...

What happened instead: nothing appear , stay into a blank card...

Minimal steps to reproduce:

type: custom:grid-layout
title: Custos
layout:
  grid-template-columns: auto
  grid-template-areas: |
    "lin1 lin1 lin1"
  mediaquery:
    '(max-width: 800px)':
      grid-template-columns: 50% 50%
      grid-template-areas: |
        "lin1 lin1"
        "lin1 lin1"
        "lin1 lin1"
        "lin1 lin1"
cards:
  - type: custom:auto-entities
    title: Diario
    filter:
      template: |-
        {% for state in states.sensor -%}
          {%- if (state.entity_id | regex_match("^sensor.energia_consumo", ignorecase=true)) 
                 and (state.name | regex_match(".*custo.*", ignorecase=true)) 
                 and (state.name | regex_match(".*diario.*", ignorecase=true))
            -%}
              {{
                {
                  'entity': state.entity_id,
                  'name': state.attributes.friendly_name|regex_replace(find='(energia consumo *|diario)', replace='', ignorecase=True)|capitalize           
                 }
               }},
           {%- endif -%}
        {%- endfor %}
    show_empty: true
    card:
      type: custom:bar-card
    view_layout:
      grid-area: lin1
  - type: custom:auto-entities
    title: Semanal
    filter:
      template: |-
        {% for state in states.sensor -%}
          {%- if (state.entity_id | regex_match("^sensor.energia_consumo", ignorecase=true)) 
                 and (state.name | regex_match(".*custo.*", ignorecase=true)) 
                 and (state.name | regex_match(".*semanal.*", ignorecase=true))
            -%}
              {{
                {
                  'entity': state.entity_id,
                  'name': state.attributes.friendly_name|regex_replace(find='(energia consumo *|semanal)', replace='', ignorecase=True)|capitalize           
                 }
               }},
           {%- endif -%}
        {%- endfor %}
    show_empty: true
    card:
      type: custom:bar-card
    view_layout:
      grid-area: lin1
  - type: custom:auto-entities
    title: Mensal
    filter:
      template: |-
        {% for state in states.sensor -%}
          {%- if (state.entity_id | regex_match("^sensor.energia_consumo", ignorecase=true)) 
                 and (state.name | regex_match(".*custo.*", ignorecase=true)) 
                 and (state.name | regex_match(".*mensal.*", ignorecase=true))
            -%}
              {{
                {
                  'entity': state.entity_id,
                  'name': state.attributes.friendly_name|regex_replace(find='(energia consumo *|mensal)', replace='', ignorecase=True)|capitalize           
                 }
               }},
           {%- endif -%}
        {%- endfor %}
    show_empty: true
    card:
      type: custom:bar-card
    view_layout:
      grid-area: lin1

Error messages from the browser console:

There is no error on the web console, it just shows nothing... If I refresh the page , out of card editor , at the dashboard, shows others plugins messages , apparently , nothing with layout-card or auto-entities...


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