Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing a jinjia template causes an error #60

Open
ildar170975 opened this issue Feb 20, 2023 · 1 comment
Open

Passing a jinjia template causes an error #60

ildar170975 opened this issue Feb 20, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@ildar170975
Copy link

Checklist:

  • [ x] I updated to the latest version available
  • [ x] I cleared the cache of my browser

Release with the issue: 0.6.3

Last working release (if known):

Browser and Operating System: Chrome, Win10

Description of problem:

Consider this template:

  decl_test_var_template:
    default:
      - VALUE: xxx
    card:
      type: markdown
      content: '[[VALUE]]'

and a card:

type: vertical-stack
cards:
  - type: custom:decluttering-card
    template: decl_test_var_template
    variables:
      - VALUE: '{{ states(''sun.sun'') }}'
  - type: custom:decluttering-card
    template: decl_test_var_template
    variables:
      - VALUE: >-
          {{ states('sun.sun') }}
  - type: custom:decluttering-card
    template: decl_test_var_template
    variables:
      - VALUE: >-
          {% if false -%}
          {{states('zone.home')}}
          {%- else -%}
          {{states('sun.sun')}}
          {%- endif %}
  - type: custom:decluttering-card
    template: decl_test_var_template
    variables:
      - VALUE: >-
          {% if false -%}
            {{states('zone.home')}}
          {%- else -%}
            {{states('sun.sun')}}
          {%- endif %}

image

Here the indented template does NOT work:

      - VALUE: >-
          {% if false -%}
            {{states('zone.home')}}
          {%- else -%}
            {{states('sun.sun')}}
          {%- endif %}

Javascript errors shown in the web inspector (if applicable):


Additional information:

@ildar170975
Copy link
Author

ildar170975 commented Feb 20, 2023

Found a solution:

    type: custom:decluttering-card
    template: decl_test_var_template
    variables:
      - VALUE: "
          {% if false -%}
            {{states('zone.home')}}
          {%- else -%}
            {{states('sun.sun')}}
          {%- endif %}
          "

or just a workaround...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant