Set label with template

I try to set the lable depending on a sensor value. This does not work. Can someone help me how this is wright.

  label: >
      {% if is_state('sensor.tursensor_status', 'door closed') %}
      {% elif is_state('sensor.tursensor_status', 'door opened')%}
      {% else %}
      {% endif %}

Hi, @JayR - can you offer a bit more context? Specifically, what UI card are you using? It appears you might be mixing two different languages (the [[[ ]]] is used in custom:button-card for templates and maybe other places, and Jinja2 (which is indicated by the {% %} is used in HA sensor, binary_sensor, etc templates). If you happen to be using the custom:button-card, then the syntax looks more like this:

label: >
      var door_state = (states['sensor.tursensor_status'].state
      if (door_state == 'door closed')
                      {return 'Geschlossem'}
      else if (door_state == 'door open')
                      {return 'Offen'}
                      {return 'Fehler'}

Let me know if your question applies to something different, or if you are using a different card.