thomasloven / lovelace-auto-entities

🔹Automatically populate the entities-list of lovelace cards
MIT License
1.29k stars 116 forks source link

FR: allow single filter, and use config.entity in stacked multiple cards #249

Closed Mariusthvdb closed 2 years ago

Mariusthvdb commented 2 years ago

trying to create an auto-entities filled vertical-stack/stak-in-card, I believe this not to be possible?, and the config.entity wont pass the first type under options:

type: custom:auto-entities
show_empty: false
card:
  type: entities
  card_mod:
    style: |
      .card-content {
        margin: -16px;
      }
filter:
  include:
    - entity_id: 'media_player.plex*'
      state: /playing|paused|'on'/
      options:
        type: custom:stack-in-card
        cards:

          - type: custom:button-card
            aspect_ratio: 1/1
            show_name: false
            show_icon: false
            tap_action: none
            card_mod:
              style: |
                ha-card {
                  background: url({{state_attr(config.entity,'entity_picture')}});
                  box-shadow: none;
                  background-size: cover;
                }

          - type: custom:button-card
            aspect_ratio: 1/1
            show_name: false
            show_icon: false
            tap_action: none
            card_mod:
              style: |
                ha-card {
                  background: url({{state_attr(config.entity,'entity_picture')}});
                  box-shadow: none;
                  background-size: cover;
                }

being positive the config.entity is seen alright when not in a stack, but in a button-card directly using:

filter:
  include:
    - entity_id: 'media_player.plex*'
      state: /playing|paused|'on'/
      options:
        type: custom:button-card
        aspect_ratio: 1/1
        show_name: false
        show_icon: false
        tap_action: none
        card_mod:
          style: |
            ha-card {
              background: url({{state_attr(config.entity,'entity_picture')}});
              box-shadow: none;
              background-size: cover;
            }

is there any chance this could be made possible? asking because the stack I have is rather large, and now has to use 3 times the same filter see community post

please have a look if this would be remotely possible (or, already is, but I failed, and in that case would hugely appreciate a hint....)

Mariusthvdb commented 2 years ago

not sure if this is the way to do it, but it works.... Ive pulled the stack-in-card into the main auto-entities config. this now makes a separate stack for each individual active media-player.

Posted the full config in https://community.home-assistant.io/t/auto-entities-stack-for-plex-media-players/387888, just for reference.

And closing.