custom-cards / decluttering-card

🧹 Declutter your lovelace configuration with the help of this card
MIT License
386 stars 30 forks source link

Support picture-elements #4

Closed Chris-V closed 4 years ago

Chris-V commented 5 years ago

Hi. First of all, this card is amazing. It allowed me to shrink my UI config by a lot. It's way easier to maintain by a huge margin.

The only thing I haven't been able to do is declutter my picture-elements cards. I have a couple of them that contain similar elements, but the "frame itself" (the picture-elements card) is too different so I can't just go and move the whole card to a template.

Doing something like so would actually be amazing:

decluttering_templates:
  demo_icon:
    element:
    - type: icon
      icon: mdi:alert-circle
      title: Problem detected!
      entity: '[[entity]]'
      tap_action:
        action: more-info
      style:
        right: -1%
        top: 7%
        color: var(--google-red-500)
        filter: drop-shadow(black 0 0 1px)

views:
- title: Home
  path: home
  icon: mdi:home
  cards:
  - type: picture-elements
    image: /local/frontend/demo_bg.jpg
    elements:
    - type: custom:decluttering-card
      template: demo_icon
      variables:
      - entity: sensor.demo

Thanks again for the awesome work!

kflinderman commented 5 years ago

I also was running into problems with picture-elements cards, but I'm the opposite of you. My frame is the same in my cards, but the number of elements change. For example, one might have 3 sensors while the other has 2 of 3. It'd be cool if some variables could be "optional", and if they aren't filled in would just be as if the element was blank. It might be a work around for your situation, but you'd just have yours more like this:

decluttering_templates:
  demo: 
    card:
      type: picture-elements
      image: /local/frontend/demo_bg.jpg
      elements:
      - type: icon
        icon: mdi:alert-circle
        title: Problem detected!
        entity: '[[entity1]]'
        tap_action:
          action: more-info
        style:
          right: -1%
          top: 7%
          color: var(--google-red-500)
          filter: drop-shadow(black 0 0 1px)
      - type: icon
        icon: mdi:alert-circle
        title: More Problem detected!
        entity: '[[entity2]]'
        tap_action:
          action: more-info
        style:
          right: -1%
          top: 17%
          color: var(--google-red-500)
          filter: drop-shadow(black 0 0 1px)

views:
- title: Home
  path: home
  icon: mdi:home
  cards:
    - type: 'custom:decluttering-card'
      template: demo
      variables:
        - entity1: sensor.something
    - type: 'custom:decluttering-card'
      template: demo
      variables:
        - entity2: sensor.somethingWorse
    - type: 'custom:decluttering-card'
      template: demo
      variables:
        - entity1: sensor.something
        - entity2: sensor.somethingWorse

And there you'd have 3 picture elements cards, two with just the single guy, and the third has both at the same time.

kflinderman commented 4 years ago

Looks like it works with picture elements, but should I open up a new issue for having "optional" variables?

RomRider commented 4 years ago

I don't see how I can make this happen sorry :(

kflinderman commented 4 years ago

Ok, no problem!

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 1.0.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: