custom-cards / decluttering-card

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

Support additional types #88

Open shaiger opened 16 hours ago

shaiger commented 16 hours ago

Apologies, I do not consider myself to be nor a YAML or an HA expert. For the very least I am hoping to learn about a new approach that I may have not considered in the past.

Problem: I've become addicted to the ability to reuse config for cards. Decluttering templates make a huge difference for me in maintaining configurations across my dashboards and devices. Over time I have accumulated a large number of dashboards and views. In fact, I have a certain baseline I use for all of my views and dashboards. What I lack is the ability to reuse "view:" configuration, just as I can do with my cards. My dashboard and view configuration is becoming more and more convoluted over time.

The solution I'd like: Here is a simple example for illustration:

template_view_base:
  view:
    title: '[[title]]'
    path: '[[path]]'
    type: sections
    max_columns: 10
    icon: '[[icon]]'
    dense_section_placement: true
    sections:
      - type: grid
        column_span: full
        cards: '[[cards]]'

Alternatives I've considered:

  1. Replicate and clutter :(
  2. Instead of managing customizations on top of the base in YAML, build a single stateful dashboard that can:
    • manage state per device
    • leverage some new configuration that will dictates which options to use per device
    • contain the logic to select desired behaviors in run time instead of config time
ildar170975 commented 10 hours ago

Alternatively:

shaiger commented 8 hours ago

Alternatively:

  • you can use a lovelace_gen custom plugin;
  • you can use a custom layout-card which can represent a whole view (although it does not support sections).

lovelace_gen - have not been able to get it to work, I'll give it another try at some point layout-card - I am using it everywhere, but am getting funky results from time to time. a few more folks are struggling as well. It's not just the layout-card though, this path (cards as views) eventually leads to tab card hosting layout cards, etc which is getting more and more convoluted. I thought I'd simplify things and build upon what seems to be the emerging standard. To add to that, templating a whole dashboard is my ultimate goal...