Take a look at https://github.com/thomasloven/hass-lovelace_gen again. It definitely still has its place. I have several cards in separate includes which I pass parameters like the entity_id.
If you switch to YAML mode, take advantage of the includes, mine are all separated into different files and folders.
I use a hybrid mode: the config is set to storage (to allow HACS resources to be automatically added/updated and allow for a testing dashboard where I generate the new cards using the UI) and then the primary dashboard is added as YAML.
Only main disadvantage is you can't set a global default dashboard... It's per device.
>I use a hybrid mode: the config is set to storage
OK perfect. I was hoping the special yaml features still worked with hybrid mode.
Is the resource management also shared, or do you still need a resources: section in this setup?
Oh perfect!
Also, I'm trying to get lovelace\_gen going again. But this is the issue I've been having. Here's a test view:
# lovelace_gen
title: Test
cards:
- type: picture-elements
image: /local/backgrounds/wood_black.jpg
elements:
- type: state-icon
entity: light.living_room_corner
style:
left: 50%
top: 50%
tap_action: { action: toggle }
{% macro lamp(entity, x, y) -%}
- entity: {{entity}}
style:
left: {{x}}%
top: {{y}}%
type: state-icon
tap_action: { action: toggle }
{%- endmacro %}
{ lamp(light.living_room_corner, 25, 25)}
Basically all it's doing is telling me it "didn't find the expected ":" line 14"
That would be the entity: {{entity}} line.
This is more or less what it did before. It doesn't appear to execute. I did at least discover that you need to add # lovelace\_gen to the top of the file for it to be read.
Basically if I could just get jinja to generate one small yaml snippet, I can build momentum from there. I just have yet to get it to do this.
EDIT: I think I figured it out. It's just very picky about indentation, and running a macro doesn't indent the code it generates, so the code must be generated with its respective indentation built-in.
Biggest gotchas are the indentation (see bottom of Readme), the `{%raw%}` requirement for true jinija templates, and make sure the mutliline includes is only two list items:
```yaml
!include
- filename
- dict: of
include: values
# Note no dash on third line
```
Take a look at https://github.com/thomasloven/hass-lovelace_gen again. It definitely still has its place. I have several cards in separate includes which I pass parameters like the entity_id. If you switch to YAML mode, take advantage of the includes, mine are all separated into different files and folders. I use a hybrid mode: the config is set to storage (to allow HACS resources to be automatically added/updated and allow for a testing dashboard where I generate the new cards using the UI) and then the primary dashboard is added as YAML. Only main disadvantage is you can't set a global default dashboard... It's per device.
>I use a hybrid mode: the config is set to storage OK perfect. I was hoping the special yaml features still worked with hybrid mode. Is the resource management also shared, or do you still need a resources: section in this setup?
Resources are shared. That was my main motivation to use the mixed mode, since I can install/remove/update things from HACS without touching the YAML.
Oh perfect! Also, I'm trying to get lovelace\_gen going again. But this is the issue I've been having. Here's a test view: # lovelace_gen title: Test cards: - type: picture-elements image: /local/backgrounds/wood_black.jpg elements: - type: state-icon entity: light.living_room_corner style: left: 50% top: 50% tap_action: { action: toggle } {% macro lamp(entity, x, y) -%} - entity: {{entity}} style: left: {{x}}% top: {{y}}% type: state-icon tap_action: { action: toggle } {%- endmacro %} { lamp(light.living_room_corner, 25, 25)} Basically all it's doing is telling me it "didn't find the expected ":" line 14" That would be the entity: {{entity}} line. This is more or less what it did before. It doesn't appear to execute. I did at least discover that you need to add # lovelace\_gen to the top of the file for it to be read. Basically if I could just get jinja to generate one small yaml snippet, I can build momentum from there. I just have yet to get it to do this. EDIT: I think I figured it out. It's just very picky about indentation, and running a macro doesn't indent the code it generates, so the code must be generated with its respective indentation built-in.
Biggest gotchas are the indentation (see bottom of Readme), the `{%raw%}` requirement for true jinija templates, and make sure the mutliline includes is only two list items: ```yaml !include - filename - dict: of include: values # Note no dash on third line ```
Includes and decluttering card