Template sensor translate log error

Hi everyone,
can you tell me what i did wrong?
the sensor works, only i get the error messages.
Thank you.




- platform: template
  sensors:
    wasser_filter:
      friendly_name: Wasserfilter
      value_template: >- 
          {% set days = (states.sensor.erinnerung_wasserfilter.state | int) | int %}       
          {% if days == 0 %}
            heute
          {% elif days == 1 %}
            morgen
          {% else %}
            in {{ days }} Tagen
          {% endif %}

Please dont post pictures of text. Post the text and format it correctly.

A screenshot of dark red text on a dark gray background is illegible.

You are not using the states() method. So the template generates errors when the sensor isn’t ready.

See the warning here: https://www.home-assistant.io/docs/configuration/templating/#states

Also your sensor has too many |int filters. This will do:

 {% set days = states('sensor.erinnerung_wasserfilter') | int %}

thank you worked out great.

- platform: template
  sensors:
    wasser_filter:
      friendly_name: Wasserfilter
      value_template: >- 
          {% set days = states('sensor.erinnerung_wasserfilter') | int %}      
          {% if days == 0 %}
            heute
          {% elif days == 1 %}
            morgen
          {% else %}
            in {{ days }} Tagen
          {% endif %}