Why are the int filter required for tests?
I’d like to achieve something like this, without having to include the |int in every test:
{% set s = states.sensor.foobar.state|int %}
{% if s == 1 %}
Hey!
{% endif %}
Also: Is it possible to use ranges to shorten a list? E.g.:
{% if s in [1,2,5,6,7,8,9] %}
To something like this:
{% if s in [1,2,5-9] %}
The current solution, which I want to write somewhat more compact, if possible:
{% set s = states.sensor.yr_symbol.state|int %}
{% if s|int == 1 %}
mdi:weather-sunny
{% elif s|int in [2,3] %}
mdi:weather-partlycloudy
{% elif s|int == 4 %}
mdi:weather-cloudy
{% elif s|int in [5,9,40,46] %}
mdi:weather-rainy
{% elif s|int in [10,41] %}
mdi:weather-pouring
{% elif s|int in [8,13,44,45,49,50] %}
mdi:weather-snowy
{% elif s|int in [7,12,42,43,47,48] %}
mdi:weather-snowy-rainy
{% elif s|int in [6,11,14,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34] %}
mdi:weather-lightning-rainy
{% elif s|int == 15 %}
mdi:weather-fog
{% else %}
mdi:help-circle-outline
{% endif %}