Lovelace: Decluttering Card

I figure there’s something specific to do to support casting. I’ll have a look but could you open an issue on github please?

1 Like

Done

I have added a simple decluttering card but it’s not working. Could you point out what am I missing here?

decluttering_templates:
  tv_btn_template:
    card:
      type: "custom:button-card"
      color_type: icon
      template: button_picture_script_small
      icon: 'mdi:[[icon]]'
      name: '[[name]]'
      tap_action:
          action: call-service
          service: script.turn_on
          service_data:
            entity_id: '[[entity]]'
          - type: custom:decluterring-card
            template: tv_btn_template
            variables:
              - name: Up
              - icon: arrow-up-bold
              - entity: media_player.spongebob

Button card template:

button_picture_script_small:
  # icon size
  size: 50%
  show_state: false
  show_label: false
  show_name: true
  show_entity_picture: true
  color_type: card
  tap_action:
#    action: toggle
    haptic: light
  hold_action:
#    action: more-info
    haptic: success
  styles:
    card:
      - border-radius: 12px
      # - width: 70px
      # - height: 70px
      - width: 50px
      - height: 50px
    name:
#      - justify-self: start
      - padding-left: 3px
      - font-weight: bold
      - font-family: Helvetica
      - font-size: 13px
  state:
    - operator: default
      color: grey

image

type: custom:decluterring-card

tt r

:stuck_out_tongue_closed_eyes:
Are you kidding me? I need new glasses. Thank you :+1:

fully aware of this, so if not possible, I know it to be the reason, but let me ask if this is the same:

Right now, I see no other way to have the title show a capitalized ‘id’ than to declare these both in the config:

  - type: custom:decluttering-card
    template: mobile_app
    variables:
      - id: telefoon
      - title: Telefoon

and template

card:
  type: entities
  title: '[[title]] Mobile app'
#  show_header_toggle: false
  entities:
    - 'device_tracker.[[id]]'
    - 'sensor.[[id]]_battery_level'
    - type: custom:auto-entities
      filter:
        include:
          - entity_id: 'sensor.[[id]]_*'
      card:
        type: custom:fold-entity-row
        head:
          type: section
          label: Details

wouldn’t it somehow be possible to do just this:

card:
  type: entities
  title: '{{[[id]]|title}} Mobile app'
#  show_header_toggle: false
  entities:
    - 'device_tracker.[[id]]'
    - 'sensor.[[id]]_battery_level'
    - type: custom:auto-entities
      filter:
        include:
          - entity_id: 'sensor.[[id]]_*'
      card:
        type: custom:fold-entity-row
        head:
          type: section
          label: Details

as we would do in jinja.:

{% set id = 'telefoon'%}
{{id|title}}

checking my setup in Chrome (not default here) results in quite a few unexplainable issues (for me). One of these is a set of:

unacceptable kind of an object to dump [object Undefined]

using this decluttering card template (and secondaryinfo-entity-row card):

card:
  type: 'custom:secondaryinfo-entity-row'
  entity: '[[entity]]'
  secondary_info: '[[ {entity}.attributes.type ]]: [[ {entity}.attributes.original_date ]]'

and a config with 8 like:


  - type: custom:decluttering-card
    template: event_date
    variables:
      - entity: sensor.birthday_marijn

the card is actually showing just fine:
23

so, although this is a heavy erring page, it shows alright ?!

any thoughts on what could be the cause for these errors?

when I click on the small arrow in the red fields, this is revealed (going on but decluttering is mentioned,and these are the only decluttering configs on the view)

hope this makes sense, and you can help me debug this.
thanks for having a look!

update

this seems to have been caused and now solved by the new Custom Header, please see Custom Header

I have a problem getting the icon to change when using a group as the entity.

My config to fully illustrate this is big so hopefully it will be enough to say that if I change the entity in the decluttering-card here

from group.xmas_sitting_room_lights

to switch.teckinplug01 (which is one of the switches in the group)

the ‘on icon’ changes to ‘pine-tree’ as I would like.

Is there a bug or have I missed something?
And of course more info is available.

          - type: custom:state-switch
            entity: input_boolean.its_christmas
            states:
              'on':
                type: custom:decluttering-card
                template: standard_square_button
                variables:
                  - entity: group.xmas_sitting_room_lights
                  - lock_enabled: true
                  - name: Sitting Room <br> Xmas Lights
                  - on_icon: pine-tree
                  - tap_action: toggle
              'off':
                type: "custom:button-card"
                color_type: blank-card
1 Like

Hi,

Do you still have those errors ? I have one for each decluttering-card used in my views.

The update you mentionned about Custom Header does not seem to fixed that.

Thanks a laot

No I don’t, and I’ve posted on that above, as you saw. Not sure about your conclusions though, as this was clearly the issue, and none of my decluttering cards or there cards changed.

:tada::tada: Version 0.3.0 :tada::tada:

New Features

Hi Romrider,

Thanks for the update, button-card doing fine now on Cast, decluttering card unfortunately not yet…

do we need to adjust a config, or could this still be a bug of sorts?
thanks for having a look

Seems like a bug… But it was working on my end :frowning:
Will check again, it’s a pain to debug…

hmmm, had a full Chrome restart, and that made the red card disappear. Made another issue visible though:

all images are replaced by a placeholder…

default:
  - color: '#F0C209'
  - ext: png

card:
  type: custom:button-card
  template: button_picture_script_small_no_name
  entity_picture: '/local/activities/[[picture]].[[ext]]' #opstaan
  option: '[[option]]' #Opstaan
  tap_action:
    action: call-service
    service: script.lighting_[[picture]] #opstaan
  state:
    - operator: template
      value: >
        [[[
        return states['input_select.activity_lighting'].state == '[[option]]'
        ]]]
      color: '[[color]]'

ought to look like this:

I’ll have a look asap :slight_smile:

@RomRider

I’ve just learned about this awesome card, but what are the benefits over ‘anchors:’ which I use today?

at the very least, decluttering templates are ‘global’, while anchors need to be defined in the same yaml file as they are used.

1 Like

Hey @RomRider is the following possible with the decluttering-card (and if not, would it be a viable option to add?):

EDIT: Don’t worry, I’ve decided not to use Decluttering Card in the end.

I want to use a template, but adjust it depending where its position is in a vertical-stack. For example:

  • at the top I would have padding: 16px 16px 8px 16px
  • in the middle I would have padding: 8px 16px 8px 16px
  • at the bottom I would have padding: 8px 16px 16px 16px

My thought was, I could use the defaults: in the decluttering card to define those defaults, something like:

default:
  - top_card: 16px 16px 8px 16px
  - middle_card: 8px 16px 8px 16px
  - bottom_card: 8px 16px 16px 16px

Then under styles:

  styles:
    card:
      - padding: '[[card_position]]'

And then when calling the template:

        - type: custom:decluttering-card
          template: single_entity_row
          variables:
            - card_position: top_card

So it would use the card_position variable, to pass top_card to the decluttering template, which would then translate top_card to the values listed in defaults.

Does that make sense? Is there any other way to do something like that, rather than make either 3 decluttering cards, or to always pass the values in the variables (which is fine, just a bit easier to read 6 months later if its more descriptive).

Thoughts welcome!

I get the same error as was posted allllll the way back in post #37. I understand that user fixed the problem with a cache clear and reload but that doesn’t appear to be working for me.

I originally thought the problem was with using a button-card (as others here have said caused trouble) but I can’t seem to get any template to work for me at all.

Even the most basic of templates gives me the error.

decluttering_templates:
  test:
    card:
      - type: thermostat
        entity: '[[entity]]'

and my card

type: 'custom:decluttering-card'
template: test
variables:
  - entity: climate.lr_thermostat

The error in question is Cannot read property 'startsWith' of undefined

card is singular, not plural, which means it’s not an array :wink:
So…

decluttering_templates:
  test:
    card:
      type: thermostat
      entity: '[[entity]]'