just put this in your file
# lovelace_gen
{#- # Macro for building a Dictionary #}
{%- macro buildmapping(indent, items, iterfunc) %}
{%- for attr, value in items.items() %}
{%- set line = indent ~ '- ' if loop.first else indent ~ ' ' %}
{%- if value is iterable and value is not string and value is not mapping %}
{{ line }}{{ attr }}:
{{- iterfunc(indent ~ ' ', value) }}
{%- elif value is mapping %}
{{ line }}{{ attr }}:
{{- buildmapping(indent+' ', value, iterfunc) }}
{%- elif value %}
{{ line }}{{ attr }}: {{ value }}
{%- endif %}
{%- endfor %}
{%- endmacro %}
{#- # Macro for building a List #}
{%- macro builditerable(indent, values) %}
{%- for value in values %}
{%- if value is iterable and value is not string and value is not mapping %}
{{ indent ~ '- ' }}
{{- builditerable(indent+' ', value) }}
{%- elif value is mapping %}
{{- buildmapping(indent, value, builditerable) }}
{%- elif value %}
{{ indent ~ '- ' }}{{ value }}
{%- endif %}
{%- endfor %}
{%- endmacro %}
{#- # Macro for turning an object into yaml #}
{%- macro toyaml(indent, attr, value, first=False) %}
{%- set line = indent[:-2] ~ '- ' if first else indent %}
{%- if value is iterable and value is not string and value is not mapping %}
{%- if attr %}{{- line }}{{ attr }}:{%- endif %}
{{- builditerable(indent, value) }}
{%- elif value is mapping %}
{%- if attr %}{{- line }}{{ attr }}:{%- endif %}
{{- buildmapping(indent, value, builditerable) }}
{%- elif value %}
{{- line }}{{ attr }}: {{ value }}
{%- endif %}
{%- endmacro %}
- !include
- base.yaml
{{ toyaml(' ', 'user_view_config', _global.view_config_owner, True) }}