thomasloven / hass-lovelace_gen

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

Problem with decluttering card and lovelace_gen together #47

Closed Aleborg closed 1 year ago

Aleborg commented 1 year ago

I'm trying to use decluttering card and lovelace_gen together but ran in to a problem where variables from the decluttering card isn't parsed the way they're supposed to with lovelace_gen.

I have this declaration: decluttering_templates: !include test_template.yaml

test_template.yaml:

# lovelace_gen
test_template:
  card:
    {% set showIt = '[[showMe]]' %}
    {% if showIt == 'a' %}
    type: custom:mushroom-title-card
    title: '{{showIt}} - a'
    {% elif showIt == 'b' %}
    type: custom:mushroom-entity-card
    entity: sensor.my_sensor
    {% else %}
    type: custom:mushroom-title-card
    title: '{{showIt}} - failed'
    {% endif %}

and my decluttering-card:

- type: custom:decluttering-card
  template: test_template
  variables:
    - showMe: 'a'

- type: custom:decluttering-card
  template: test_template
  variables:
    - showMe: 'b'

the problem is that lovelace_gen seems to interpret [[showMe]] as 'showMe' instead of 'a' or 'b'. The output becomes a - failed or b - failed.

Is there a way to solve this?

Aleborg commented 1 year ago

Solved: https://community.home-assistant.io/t/problem-with-decluttering-card-and-lovelace-gen-together/548789