Contitional Template Card?

Looking for some assistance in creating a series of cards; based on which docker containers are running, then showing a container specific card for each.

I believe I need to use a combination of custom:auto-entities & custom:card-templater; I’m just honestly not sure how to iterate through the running containers dynamically. So if a new container gets added, so does a new set of cards.

Each container should have the following config

type: vertical-stack
cards:
  - type: custom:multiple-entity-row
    entity: sensor.jabba_adguard_status
    secondary_info: last-changed
  - type: custom:bar-card
    entities:
      - entity: sensor.jabba_adguard_cpu
        name: CPU
        positions:
          minmax: inside
        animation:
          state: on
      - entity: sensor.jabba_adguard_memory
        name: Memory
        positions:
          minmax: inside
        animation:
          state: on
        color: var(--secondary-color)

The variables here would be “title”, and “entity”. The entities will always be in format sensor.jabba_$name_cpu, sensor.jabba_$name_memory or sensor.jabba_$name_status.

Just not sure how to iterate through all running containers.

Any help would be greatly appreciated.

Cheers

  1. auto-entities creates a list of cards inside a vertical-stack (or horizontal) card.
  2. Each card from (1) is a vertical-stack card containing:
    – some conventional entity-row card (or multiple-entity-row card) for “entity_status”;
    – set of bar-card rows for “enity_cpu”, “-memory”.
  3. The auto-entities card has a filter defined by a template option containing:
    – a “for … endfor” loop enumerating your containers (probably by " sensor.jabba_*_status");
    – a code for a vertical-stack card from (2);
    – a code for constructing “entity-…” strings.

Go to the dedicated thread for “auto-entities” for details / examples.
And no need for “card-templater”.

Great, thank you.