Grid - Cards Template

Hello,

I’ve a grid with 5 five cards, all five cards with unique code with only entity_id as common parameter. May I know how to template this scenario?

I’ve looked at lovelace_gen / decluttering card, and I couldn’t figure out how to template a grid using either.

Here’s the sample code of the grid

    - square: false
      type: grid
      cards:
          - type: custom:button-card
            icon: mdi:snowflake
            aspect_ratio: 1/1
            tap_action:
              action: call-service
              service: climate.set_temperature
              haptic: medium
              service_data:
                entity_id: climate.drawing_ac
                temperature: 24
                hvac_mode: cool
            styles:
              card:
                - background-color: var(--blue)
              icon:
                - color: var(--black)
                - animation: |
                    [[[
                      var ac_state = states['climate.drawing_ac'].state;
                      return (ac_state == "off") ? "None" : "rotating 1s linear infinite";
                    ]]]

And a bunch of 4 other cards of the thermostat in the same grid.

What I’d like to do is something like this:

- !include hvac_grid_template.yaml
  - entity: entity_id

Rather than:

- square: false
  type: grid
  cards:
    - !include
      - card1.yaml
      - hvac-entity-id
    - !include
      - card2.yaml
      - hvac-entity-id

Thanks.

Any help please? Or using horizontal card is the route instead of grid?

Hello all,

I was able to use decluttering_card to achieve the desired result. Can point me to achieve the same using lovelace_gen?

      - type: custom:decluttering-card
        template: hvac_template
        variables:
          - entity: climate.drawing_ac

decluttering_templates: !include_dir_merge_named decluttering_templates/

hvac_template:
  card:
    type: horizontal-stack
    cards:
      - type: custom:button-card
....