Invalid output from Template

I’m trying to define a template, which Output ‘None’ if the value is zero, else the numberic value. But it just returns “Unknown”!

- name: weatherWarning
      state: >
        {% if is_state('sensor.dwd_weather_warnings_106439000_advance_warning_level', '0') %}
          None
        {% else %}
          There are {{ states('sensor.dwd_weather_warnings_106439000_advance_warning_level') }} warnings!
        {% endif %}

What have I done wrong?

Here’s what I think is happening:
None is a reserved word; it means null which cannot be displayed so unknown is reported.

Change the word None to something else like No Warnings.

Ha! Yes, that has worked.

Couldn’t for the life of me work out what was wrong, being new and all.

Thanks for your help.

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.