Custom Button Card: Templates vs. Lovelace-Gen

@petro, I was just looking at your configuration and it’s given me more than a few ideas!

I’ve also been using lovelace_gen and jinja2 macros to generate some portions of my lovelace UI (though still mostly just getting started.) One thing that you might consider when using jinja2 macros to generate the YAML configuration is that JSON-style syntax works just fine inside of YAML files. So you can mostly just ignore the whitespace indentation issue completely, and have the macro emit JSON in the place that it’s invoked.

I made a post about this about a year ago that lays this out. This approach might simplify things a bit.