WTH can't we reduce redundancy of YAML code in lovelace?

For everything but the simplest stock cards, I always find myself in the need of copying, pasting and slightly adjusting a lot of YAML lovelace code to various places. Needless to say, that this soon becomes unmanageable, inconsistent, time-consuming, error-prone and frustrating. There must be better ways …

I would like to minimize redundancy and maximize reusability of YAML code. I would like to modularize/save/share/reuse YAML fragments for dashboards/views/cards as far as possible.

A bit more concrete: If I want to show my expensive floorplan in multiple places, I would like to reuse it as is via reference etc. instead of copy and pasting it all over. If I have configured a super-duper higher-level card (= multiple “custom:”-cards + inline styles + whatnot) for device/room A, I would like to abstract it as a template/component and reuse it also for device/room B and C.

Only a few days ago I saw that there is YAML mode for dashboards and “lovelace_gen”. I have not yet tried either. While especially the latter sounds promising, it clearly targets advanced users and seems to have a few downsides as well (caching, refreshing, …). Redundant YAML code, however, is not only a problem of advanced users. I fear it sooner or later hits anybody. Can’t we incorporate tools like the latter into the core and make them accessible, stable and usable by the majority of users?

Please let me know if I missed something. I am no expert here.

Closing as a duplicate of:

Please vote there.

Opening again. The other WTH only uses copies of the card with no area abstraction.

1 Like