Template |int filter not working

Hello everyone. I am having a strange behavior in my lovelace UI.

I am working with a decluttering card and I want to hand over a number as a variable:

  - type: custom:decluttering-card
    template: weather_now_template
      - coverage: '100'

Within the decluttering template I am storing the variable in a jinja variable and want the value to display:

    type: custom:stack-in-card
      - type: markdown
        content: >-
          {% set coverage  ='[[coverage]]'%}
          Value: "{{coverage}}"   
          Value: "{{coverage|int}}"

The output is:
Value: “100” Value: “0”

But there seems to be a problem to convert this to int. This expression is always 0. Why is this the case and how can I fix this?

Have you tested in Template section in Developer Tools?
It seems it’s not an issue regarding jinja2 functions

This works also.

Try removing one set of quotes, so either:

      - coverage: 100


          {% set coverage = [[coverage]] %}

When I change it to:

          {% set coverage  =[[coverage]]%}

I get:
Value: “[[Undefined]]” Value: “0”

When I change both without the quotes it is still undefined.

When I only change

      - coverage: 100

it is Value: “100” Value: “0” again.

yes. There is no problem.

Even when I change this code in my decluttering_card it is working:

          {% set coverage  ='100'%}
          Value: "{{coverage}}"
          Value: "{{coverage|int}}"

Both values are 100

Value: {{coverage}}

only {{coverage}} is working. But I need the value as an integer, because i want to do something like this:

      Value: "{{coverage<20}}"

that a test and would be between {% %}
in regards of these statement:

{% set coverage =‘[[coverage]]’%}
Value: “{{coverage}}”
Value: “{{coverage|int}}”

Where are you getting [[coverage]] from?
If it’s an entity, you should get it from something likethat: states(‘number.entity_name’)

{% set coverage = states(‘input_number.flowers_shifted’) %}
Value: “{{coverage}}”
Value: “{{coverage|int}}”

Read the top of the topic: it’s coming from the decluttering card. Something odd is happening in the way it’s being brought across.

No, it’s a statement that returns true or false.