The next problem. I use Netatmo sensors and I want to use the wind_angle to produce some nice pictures with a wind compass. Therefore I wanted to use the following sentences:
wind_compass:
value_template: >-
{% if 0.00 <= states('sensor.netatmo_wind_angle') | float <= 11.25 %}
N
{% elif 11.26 <= states('sensor.netatmo_wind_angle') |float <= 33.75 %}
NNE
{% elif 33.76 <= states('sensor.netatmo_wind_angle') | float <= 56.25 %}
NE
{% elif 56.26 <= states('sensor.netatmo_wind_angle') | float <= 78.75 %}
ENE
{% elif 78.76 <= states('sensor.netatmo_wind_angle') | float <= 101.25 %}
E
{% elif 101.26 <=states('sensor.netatmo_wind_angle') | float <= 123.75 %}
ESE
{% elif 123.76 <= sstates('sensor.netatmo_wind_angle') | float <= 146.25 %}
SE
{% elif 146.26 <= states('sensor.netatmo_wind_angle') | float <= 168.75 %}
SSE
{% elif 168.76 <= states('sensor.netatmo_wind_angle') | float <= 191.25 %}
S
{% elif 191.26 <= states('sensor.netatmo_wind_angle') | float <= 213.75 %}
SSW
{% elif 213.76 <= states('sensor.netatmo_wind_angle') | float <= 236.25 %}
SW
{% elif 236.26 <= states('sensor.netatmo_wind_angle') | float <= 258.75 %}
WSW
{% elif 258.76 <= states('sensor.netatmo_wind_angle') | float <= 281.25 %}
W
{% elif 281.26 <= states('sensor.netatmo_wind_angle') | float <= 303.75 %}
WNW
{% elif 303.76 <= states('sensor.netatmo_wind_angle') | float <= 326.25 %}
NW
{% elif 326.26 <= states('sensor.netatmo_wind_angle') | float <= 348.75%}
NNW
{% elif 348.76 <= states('sensor.netatmo_wind_angle') | float <= 360.00 %}
N
{% endif %}"
I always get back ‘N’. Even if I know the wind is blowing from the South. It must have something to do with the attributes of sensor.netatmo_wind-angle because the reading of this sensor is: SE(132°) But how do I split that up? Can someone help me with the correct code?