thomasloven / hass-lovelace_gen

🔹 Improve the lovelace yaml parser for Home Assistant
MIT License
209 stars 22 forks source link

Using `{%...%}` causes error and breaks dashboards #45

Closed d2kagw closed 1 year ago

d2kagw commented 1 year ago

I'm on a new install of HASS and am using lovelace_gen to build up my dashboards.

When I include any special jinja capabilities, I get the following error: while scanning for the next token found character '%' that cannot start any token ...

here's the code from my file climate.yaml:

# lovelace_gen

{% set acs = [
    "climate.bedroom_air_conditioner",
    "climate.daikin_192_168_1_202",
    "climate.office_air_conditioner",
    "climate.pool_house_air_conditioner",
    "climate.theatre_air_conditioner"
  ]
%}

- type: custom:muto-layout-card
  columns:
    - !include ./_alert-column.yaml

    - flex: 2 2 40%
      cards:
        - type: custom:muto-layout-column-card
          cards:
            - type: custom:mini-media-player
              artwork: full-cover
              hide:
                icon: true
                power: true
                source: true
                sound_mode: true
                volume: true
              entity: media_player.lounge

    - flex: 2 2 40%
      cards:
        - type: custom:muto-layout-column-card
          cards:
            {% for entity in acs %}
              - type: custom:muto-slider-control-card
                status_entity: {{entity}}
                action:
                  type: toggle
                  entity: {{entity}}
                sensor_entity: {{entity}}
            {% endfor %}

if I remove all the {%...%} related code, the dashboard works fine.

I've used lovelace_gen before without this issue, and have checked on my other HASS both are running the same version of HASS and lovelace_gen. Different entities/devices/etc, but same setup.

Any ideas?

d2kagw commented 1 year ago

Problem between keyboard and chair.

Marking as resolved. Turns out the configuration.yaml file had the lovelace_gen: statement indented in a sibling object.