Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95486

Need help with decluttering card (template)

$
0
0

@prankousky wrote:

Hi everybody,

UPDATE: I had missed the type in my template card. However, one thing I still don’t get: how can I (or, is it possible) to have as many entities as needed instead of “entity_1”, “entity_2”, etc.? Let’s say one room has 6 entities and another room has 53, what kind of template would I use that both rooms would be able to work with?

I am trying to get into decluttering-card to make configuring my lovelace ui a bit simpler. However, I don’t quite understand how to do this when there are multiple “sub cards” involved.

Here is an example for a regular card (left) which I’d like to translate to a decluttering template (right).

OLD Screenshot

NEW Screenshot

Manual Card

type: "vertical-stack"
cards:
  - type: "custom:button-card"
    color_type: label-card
    color: rgb(44, 109, 214)
    name: Schlafzimmer
  - type: "horizontal-stack"
    cards:
    - type: "custom:button-card"
      entity: light.sz_tv
      size: 20px
    - type: "custom:button-card"
      entity: light.sz_bett
      size: 20px
    - type: "custom:button-card"
      entity: light.schlafzimmer_innr_light
      size: 20px
    - type: "custom:button-card"
      entity: switch.schlafzimmer_deckenventilator
      name: Decke
      size: 20px
    - type: "custom:button-card"
      entity: switch.schlafzimmer_klimaanlage
      name: Klima
      size: 20px

Template (in ui-lovelace.yaml)

# Decluttering Templates
decluttering_templates:
  my_first_template:     # This is the name of a template
    default:
      - icon: fire
    card:
      type: custom:button-card
      name: '[[name]]'
      icon: 'mdi:[[icon]]'
  zimmer:
    card:
      type: "vertical-stack"
      cards:
        - type: "custom:button-card"
          color_type: label-card
          color: rgb(44, 109, 214)
          name: "[[zimmer]]"
        - type:
          cards:
            - type: "custom:button-card"
              entity: "[[entity]]"
              size: 20px

and finally

Decluttering Card

type: "custom:decluttering-card"
template: zimmer
variables: 
  - zimmer: Schlafzimmer
  - entity_1: light.sz_tv
  - entity_2: light.sz_bett

As you can see, it does take the first variable, zimmer; the header displays Schlafzimmer as intended. However, those other variables are not used by the card; I know that I must be doing something wrong, but don’t quite understand what it is, as I tried using this example.

Thank you for your ideas :slight_smile:

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 95486

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>