Change direction of wind - template sensor

value_template is used in the legacy template sensor method, it is not a valid configuration variable for the current method.

Also, it would probably be better if your state and availability templates are based on the same source:

  - name: "tmpl_weather_wind_dir"
    unique_id: "tmpl_weather_wind_dir"
    state_class: measurement
    icon: mdi:sign-direction
    state: >
      {% set direction = ['N','NNE','NE','ENE','E','ESE','SE','SSE','S','SSW','SW','WSW','W','WNW','NW','NNW','N'] %}
      {% set degree = states('sensor.weather_wind_bearing')|float(0) %}
      {{ degree }}
      {{ direction[ (( degree + 11.25) / 22.5) | int] }}
    availability: >
      {{ states('sensor.weather_wind_bearing') not in [ 'unknown', 'unavailable', '', none] }}