Shelly WS90 Weather Station

A bit shorter code would be something like below showing NNE as well but this can be changed by dividing by 45 and remove the 3 character winddirections to get only NE. It’s using an array for with the index calculated from the degrees.

{% set directions = [ 'N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW', 'N'] -%}
{% set bearing = directions[ ((states("sensor.gw2000a_wind_direction") | int(0) / 22.5) | round(0) | int) ] %}
{{ bearing }}

You can try it inside the template editor in the DevTools.