Sensor Wind compass - up for grabs

windc

The wind compass consists of three sensors, wind_compass, wind_compass_point and wind_compass_abbreviation. Mix as you like.

For limited time only, zip-file with the pictures.

Cheers.

####################################################
# WIND COMPASS                                     #
####################################################

  - platform: template
    sensors: 
      wind_compass_abbreviation:
        value_template: >-
          {% if 354.38 <= states('sensor.weather_wind_direction')|float <= 5.62 %}
             N
          {% elif 5.63 <= states('sensor.weather_wind_direction')|float <= 16.87 %}
             NbE
          {% elif 16.88 <= states('sensor.weather_wind_direction')|float <= 28.12 %}
             NNE
          {% elif 28.13 <= states('sensor.weather_wind_direction')|float <= 39.37 %}
             NEbN
          {% elif 39.38 <= states('sensor.weather_wind_direction')|float <= 50.62 %}
             NE
          {% elif 50.63 <= states('sensor.weather_wind_direction')|float <= 61.87 %}
             NEbE
          {% elif 61.88 <= states('sensor.weather_wind_direction')|float <= 73.12 %}
             ENE
          {% elif 73.13 <= states('sensor.weather_wind_direction')|float <= 84.37 %}
             EbN
          {% elif 84.38 <= states('sensor.weather_wind_direction')|float <= 95.62 %}
             E
          {% elif 95.63 <= states('sensor.weather_wind_direction')|float <= 106.87 %}
             EbS
          {% elif 106.88 <= states('sensor.weather_wind_direction')|float <= 118.12 %}
             ESE
          {% elif 118.13 <= states('sensor.weather_wind_direction')|float <= 129.37 %}
             SEbE
          {% elif 129.38 <= states('sensor.weather_wind_direction')|float <= 140.62 %}
             SE
          {% elif 140.63 <= states('sensor.weather_wind_direction')|float <= 151.87 %}
             SEbS
          {% elif 151.88 <= states('sensor.weather_wind_direction')|float <= 163.12 %}
             SSE
          {% elif 163.13 <= states('sensor.weather_wind_direction')|float <= 174.37 %}
             SbE
          {% elif 174.38 <= states('sensor.weather_wind_direction')|float <= 185.62 %}
             S
          {% elif 185.63 <= states('sensor.weather_wind_direction')|float <= 196.87 %}
             SbW
          {% elif 196.88 <= states('sensor.weather_wind_direction')|float <= 208.12 %}
             SSW
          {% elif 208.13 <= states('sensor.weather_wind_direction')|float <= 219.37 %}
             SWbS
          {% elif 219.38 <= states('sensor.weather_wind_direction')|float <= 230.62 %}
             SW
          {% elif 230.63 <= states('sensor.weather_wind_direction')|float <= 241.87 %}
             SWbW
          {% elif 241.88 <= states('sensor.weather_wind_direction')|float <= 253.12 %}
             WSW
          {% elif 253.13 <= states('sensor.weather_wind_direction')|float <= 264.37 %}
             WbS
          {% elif 264.38 <= states('sensor.weather_wind_direction')|float <= 275.62 %}
             W
          {% elif 275.63 <= states('sensor.weather_wind_direction')|float <= 286.87 %}
             WbN
          {% elif 286.88 <= states('sensor.weather_wind_direction')|float <= 298.12 %}
             WNW
          {% elif 298.13 <= states('sensor.weather_wind_direction')|float <= 309.37 %}
             NWbW
          {% elif 309.38 <= states('sensor.weather_wind_direction')|float <= 320.62 %}
             NW
          {% elif 320.63 <= states('sensor.weather_wind_direction')|float <= 331.87 %}
             NWbN
          {% elif 331.88 <= states('sensor.weather_wind_direction')|float <= 343.12 %}
             NNW
          {% elif 343.13 <= states('sensor.weather_wind_direction')|float <= 354.37 %}
             NbW
          {% endif %}

  - platform: template
    sensors: 
      wind_compass_point:
        value_template: >-
          {% if 354.38 <= states('sensor.weather_wind_direction')|float <= 5.62 %}
             North 
          {% elif 5.63 <= states('sensor.weather_wind_direction')|float <= 16.87 %}
             North by east 
          {% elif 16.88 <= states('sensor.weather_wind_direction')|float <= 28.12 %}
             North-northeast
          {% elif 28.13 <= states('sensor.weather_wind_direction')|float <= 39.37 %}
             Northeast by north
          {% elif 39.38 <= states('sensor.weather_wind_direction')|float <= 50.62 %}
             Northeast
          {% elif 50.63 <= states('sensor.weather_wind_direction')|float <= 61.87 %}
             Northeast by east 
          {% elif 61.88 <= states('sensor.weather_wind_direction')|float <= 73.12 %}
             East-northeast 
          {% elif 73.13 <= states('sensor.weather_wind_direction')|float <= 84.37 %}
             East by north 
          {% elif 84.38 <= states('sensor.weather_wind_direction')|float <= 95.62 %}
             East 
          {% elif 95.63 <= states('sensor.weather_wind_direction')|float <= 106.87 %}
             East by south
          {% elif 106.88 <= states('sensor.weather_wind_direction')|float <= 118.12 %}
             East-southeast 
          {% elif 118.13 <= states('sensor.weather_wind_direction')|float <= 129.37 %}
             Southeast by east
          {% elif 129.38 <= states('sensor.weather_wind_direction')|float <= 140.62 %}
             Southeast
          {% elif 140.63 <= states('sensor.weather_wind_direction')|float <= 151.87 %}
             Southeast by south
          {% elif 151.88 <= states('sensor.weather_wind_direction')|float <= 163.12 %}
             South-southeast 
          {% elif 163.13 <= states('sensor.weather_wind_direction')|float <= 174.37 %}
             South by east
          {% elif 174.38 <= states('sensor.weather_wind_direction')|float <= 185.62 %}
             South
          {% elif 185.63 <= states('sensor.weather_wind_direction')|float <= 196.87 %}
             South by west 
          {% elif 196.88 <= states('sensor.weather_wind_direction')|float <= 208.12 %}
             South-southwest
          {% elif 208.13 <= states('sensor.weather_wind_direction')|float <= 219.37 %}
             Southwest by south
          {% elif 219.38 <= states('sensor.weather_wind_direction')|float <= 230.62 %}
             Southwest
          {% elif 230.63 <= states('sensor.weather_wind_direction')|float <= 241.87 %}
             Southwest by west
          {% elif 241.88 <= states('sensor.weather_wind_direction')|float <= 253.12 %}
             West-southwest 
          {% elif 253.13 <= states('sensor.weather_wind_direction')|float <= 264.37 %}
             West by south 
          {% elif 264.38 <= states('sensor.weather_wind_direction')|float <= 275.62 %}
             West
          {% elif 275.63 <= states('sensor.weather_wind_direction')|float <= 286.87 %}
             West by north
          {% elif 286.88 <= states('sensor.weather_wind_direction')|float <= 298.12 %}
             West-northwest
          {% elif 298.13 <= states('sensor.weather_wind_direction')|float <= 309.37 %}
             Northwest by west
          {% elif 309.38 <= states('sensor.weather_wind_direction')|float <= 320.62 %}
             Northwest 
          {% elif 320.63 <= states('sensor.weather_wind_direction')|float <= 331.87 %}
             Northwest by north
          {% elif 331.88 <= states('sensor.weather_wind_direction')|float <= 343.12 %}
             North-northwest
          {% elif 343.13 <= states('sensor.weather_wind_direction')|float <= 354.37 %}
             North by west
          {% endif %}

      wind_compass: 
        friendly_name: "Wind direction"
        value_template: '{{ states.sensor.weather_wind_direction.state }}'
        friendly_name_template: "Wind direction - {{ states.sensor.wind_compass_point.state }}"
        unit_of_measurement: '°'
        entity_picture_template: >-
          {% if 354.38 <= states('sensor.weather_wind_direction')|float <= 5.62 %}
             /local/Pictures/WindCompass/0.png
          {% elif 5.63 <= states('sensor.weather_wind_direction')|float <= 16.87 %}
              /local/Pictures/WindCompass/11.png
          {% elif 16.88 <= states('sensor.weather_wind_direction')|float <= 28.12 %}
              /local/Pictures/WindCompass/22.png
          {% elif 28.13 <= states('sensor.weather_wind_direction')|float <= 39.37 %}
              /local/Pictures/WindCompass/33.png
          {% elif 39.38 <= states('sensor.weather_wind_direction')|float <= 50.62 %}
              /local/Pictures/WindCompass/45.png
          {% elif 50.63 <= states('sensor.weather_wind_direction')|float <= 61.87 %}
              /local/Pictures/WindCompass/56.png
          {% elif 61.88 <= states('sensor.weather_wind_direction')|float <= 73.12 %}
              /local/Pictures/WindCompass/67.png
          {% elif 73.13 <= states('sensor.weather_wind_direction')|float <= 84.37 %}
              /local/Pictures/WindCompass/78.png
          {% elif 84.38 <= states('sensor.weather_wind_direction')|float <= 95.62 %}
              /local/Pictures/WindCompass/90.png
          {% elif 95.63 <= states('sensor.weather_wind_direction')|float <= 106.87 %}
              /local/Pictures/WindCompass/101.png
          {% elif 106.88 <= states('sensor.weather_wind_direction')|float <= 118.12 %}
              /local/Pictures/WindCompass/112.png
          {% elif 118.13 <= states('sensor.weather_wind_direction')|float <= 129.37 %}
              /local/Pictures/WindCompass/123.png
          {% elif 129.38 <= states('sensor.weather_wind_direction')|float <= 140.62 %}
              /local/Pictures/WindCompass/135.png
          {% elif 140.63 <= states('sensor.weather_wind_direction')|float <= 151.87 %}
              /local/Pictures/WindCompass/146.png
          {% elif 151.88 <= states('sensor.weather_wind_direction')|float <= 163.12 %}
              /local/Pictures/WindCompass/157.png
          {% elif 163.13 <= states('sensor.weather_wind_direction')|float <= 174.37 %}
              /local/Pictures/WindCompass/168.png
          {% elif 174.38 <= states('sensor.weather_wind_direction')|float <= 185.62 %}
              /local/Pictures/WindCompass/180.png
          {% elif 185.63 <= states('sensor.weather_wind_direction')|float <= 196.87 %}
              /local/Pictures/WindCompass/191.png
          {% elif 196.88 <= states('sensor.weather_wind_direction')|float <= 208.12 %}
              /local/Pictures/WindCompass/202.png
          {% elif 208.13 <= states('sensor.weather_wind_direction')|float <= 219.37 %}
              /local/Pictures/WindCompass/213.png
          {% elif 219.38 <= states('sensor.weather_wind_direction')|float <= 230.62 %}
              /local/Pictures/WindCompass/225.png
          {% elif 230.63 <= states('sensor.weather_wind_direction')|float <= 241.87 %}
              /local/Pictures/WindCompass/236.png
          {% elif 241.88 <= states('sensor.weather_wind_direction')|float <= 253.12 %}
              /local/Pictures/WindCompass/247.png
          {% elif 253.13 <= states('sensor.weather_wind_direction')|float <= 264.37 %}
              /local/Pictures/WindCompass/258.png
          {% elif 264.38 <= states('sensor.weather_wind_direction')|float <= 275.62 %}
              /local/Pictures/WindCompass/270.png
          {% elif 275.63 <= states('sensor.weather_wind_direction')|float <= 286.87 %}
              /local/Pictures/WindCompass/281.png
          {% elif 286.88 <= states('sensor.weather_wind_direction')|float <= 298.12 %}
              /local/Pictures/WindCompass/292.png
          {% elif 298.13 <= states('sensor.weather_wind_direction')|float <= 309.37 %}
              /local/Pictures/WindCompass/303.png
          {% elif 309.38 <= states('sensor.weather_wind_direction')|float <= 320.62 %}
              /local/Pictures/WindCompass/315.png
          {% elif 320.63 <= states('sensor.weather_wind_direction')|float <= 331.87 %}
              /local/Pictures/WindCompass/326.png
          {% elif 331.88 <= states('sensor.weather_wind_direction')|float <= 343.12 %}
              /local/Pictures/WindCompass/337.png
          {% elif 343.13 <= states('sensor.weather_wind_direction')|float <= 354.37 %}
             /local/Pictures/WindCompass/348.png
          {% endif %}
8 Likes

Here are the pictures:
01122337845671015611213590168157123146

180225281191326236202270213292303348315247258337

Wow. Nice tip. Thanks for sharing.

Very nice work @Tomahawk

For those interested, I created a Dutch version using a sensor based on Wunderground:

sensor:
  - platform: template
    sensors:
      wind_compass_abbreviation:
        friendly_name: Windrichting Afkorting
        icon_template: mdi:compass
        value_template: >-
          {% if 354.38 <= states('sensor.pws_wind_degrees')|float <= 5.62 %}
             N
          {% elif 5.63 <= states('sensor.pws_wind_degrees')|float <= 16.87 %}
             NNNO
          {% elif 16.88 <= states('sensor.pws_wind_degrees')|float <= 28.12 %}
             NNO
          {% elif 28.13 <= states('sensor.pws_wind_degrees')|float <= 39.37 %}
             ONNO
          {% elif 39.38 <= states('sensor.pws_wind_degrees')|float <= 50.62 %}
             NO
          {% elif 50.63 <= states('sensor.pws_wind_degrees')|float <= 61.87 %}
             NONO
          {% elif 61.88 <= states('sensor.pws_wind_degrees')|float <= 73.12 %}
             ONO
          {% elif 73.13 <= states('sensor.pws_wind_degrees')|float <= 84.37 %}
             OONO
          {% elif 84.38 <= states('sensor.pws_wind_degrees')|float <= 95.62 %}
             O
          {% elif 95.63 <= states('sensor.pws_wind_degrees')|float <= 106.87 %}
             OOZO
          {% elif 106.88 <= states('sensor.pws_wind_degrees')|float <= 118.12 %}
             OZO
          {% elif 118.13 <= states('sensor.pws_wind_degrees')|float <= 129.37 %}
             ZOZO
          {% elif 129.38 <= states('sensor.pws_wind_degrees')|float <= 140.62 %}
             ZO
          {% elif 140.63 <= states('sensor.pws_wind_degrees')|float <= 151.87 %}
             OZZO
          {% elif 151.88 <= states('sensor.pws_wind_degrees')|float <= 163.12 %}
             ZZO
          {% elif 163.13 <= states('sensor.pws_wind_degrees')|float <= 174.37 %}
             ZZZO
          {% elif 174.38 <= states('sensor.pws_wind_degrees')|float <= 185.62 %}
             Z
          {% elif 185.63 <= states('sensor.pws_wind_degrees')|float <= 196.87 %}
             ZZZW
          {% elif 196.88 <= states('sensor.pws_wind_degrees')|float <= 208.12 %}
             ZZW
          {% elif 208.13 <= states('sensor.pws_wind_degrees')|float <= 219.37 %}
             ZZW
          {% elif 219.38 <= states('sensor.pws_wind_degrees')|float <= 230.62 %}
             ZW
          {% elif 230.63 <= states('sensor.pws_wind_degrees')|float <= 241.87 %}
             ZWZW
          {% elif 241.88 <= states('sensor.pws_wind_degrees')|float <= 253.12 %}
             WZW
          {% elif 253.13 <= states('sensor.pws_wind_degrees')|float <= 264.37 %}
             WWZW
          {% elif 264.38 <= states('sensor.pws_wind_degrees')|float <= 275.62 %}
             W
          {% elif 275.63 <= states('sensor.pws_wind_degrees')|float <= 286.87 %}
             WWNW
          {% elif 286.88 <= states('sensor.pws_wind_degrees')|float <= 298.12 %}
             WNW
          {% elif 298.13 <= states('sensor.pws_wind_degrees')|float <= 309.37 %}
             NWNW
          {% elif 309.38 <= states('sensor.pws_wind_degrees')|float <= 320.62 %}
             NW
          {% elif 320.63 <= states('sensor.pws_wind_degrees')|float <= 331.87 %}
             WNNW
          {% elif 331.88 <= states('sensor.pws_wind_degrees')|float <= 343.12 %}
             NNW
          {% elif 343.13 <= states('sensor.pws_wind_degrees')|float <= 354.37 %}
             NNNW
          {% endif %}
      wind_compass_point:
        friendly_name: Windrichting
        icon_template: mdi:compass
        value_template: >-
          {% if 354.38 <= states('sensor.pws_wind_degrees')|float <= 5.62 %}
             Noord
          {% elif 5.63 <= states('sensor.pws_wind_degrees')|float <= 16.87 %}
             Noord Ten Oosten
          {% elif 16.88 <= states('sensor.pws_wind_degrees')|float <= 28.12 %}
             Noordnoordoost
          {% elif 28.13 <= states('sensor.pws_wind_degrees')|float <= 39.37 %}
             Noordoost Ten Noorden
          {% elif 39.38 <= states('sensor.pws_wind_degrees')|float <= 50.62 %}
             Noordoost
          {% elif 50.63 <= states('sensor.pws_wind_degrees')|float <= 61.87 %}
             Noordoost Ten Oosten
          {% elif 61.88 <= states('sensor.pws_wind_degrees')|float <= 73.12 %}
             Oostnoordoost
          {% elif 73.13 <= states('sensor.pws_wind_degrees')|float <= 84.37 %}
             Oost Ten Noorden
          {% elif 84.38 <= states('sensor.pws_wind_degrees')|float <= 95.62 %}
             Oost
          {% elif 95.63 <= states('sensor.pws_wind_degrees')|float <= 106.87 %}
             Oost Ten Zuiden
          {% elif 106.88 <= states('sensor.pws_wind_degrees')|float <= 118.12 %}
             Oostzuidoost
          {% elif 118.13 <= states('sensor.pws_wind_degrees')|float <= 129.37 %}
             Zuidoost Ten Oosten
          {% elif 129.38 <= states('sensor.pws_wind_degrees')|float <= 140.62 %}
             Zuidoost
          {% elif 140.63 <= states('sensor.pws_wind_degrees')|float <= 151.87 %}
             Zuidoost Ten Zuiden
          {% elif 151.88 <= states('sensor.pws_wind_degrees')|float <= 163.12 %}
             Zuidzuidoost
          {% elif 163.13 <= states('sensor.pws_wind_degrees')|float <= 174.37 %}
             Zuid Ten Oosten
          {% elif 174.38 <= states('sensor.pws_wind_degrees')|float <= 185.62 %}
             Zuid
          {% elif 185.63 <= states('sensor.pws_wind_degrees')|float <= 196.87 %}
             Zuid Ten Westen
          {% elif 196.88 <= states('sensor.pws_wind_degrees')|float <= 208.12 %}
             Zuidzuidwest
          {% elif 208.13 <= states('sensor.pws_wind_degrees')|float <= 219.37 %}
             Zuidwest Ten Zuiden
          {% elif 219.38 <= states('sensor.pws_wind_degrees')|float <= 230.62 %}
             Zuidwest
          {% elif 230.63 <= states('sensor.pws_wind_degrees')|float <= 241.87 %}
             Zuidwest Ten Westen
          {% elif 241.88 <= states('sensor.pws_wind_degrees')|float <= 253.12 %}
             Westzuidwest
          {% elif 253.13 <= states('sensor.pws_wind_degrees')|float <= 264.37 %}
             West Ten Zuiden
          {% elif 264.38 <= states('sensor.pws_wind_degrees')|float <= 275.62 %}
             West
          {% elif 275.63 <= states('sensor.pws_wind_degrees')|float <= 286.87 %}
             West Ten Noorden
          {% elif 286.88 <= states('sensor.pws_wind_degrees')|float <= 298.12 %}
             Westnoordwest
          {% elif 298.13 <= states('sensor.pws_wind_degrees')|float <= 309.37 %}
             Noordwest Ten Westen
          {% elif 309.38 <= states('sensor.pws_wind_degrees')|float <= 320.62 %}
             Noordwest
          {% elif 320.63 <= states('sensor.pws_wind_degrees')|float <= 331.87 %}
             Noordwest Ten Noorden
          {% elif 331.88 <= states('sensor.pws_wind_degrees')|float <= 343.12 %}
             Noordnoordwest
          {% elif 343.13 <= states('sensor.pws_wind_degrees')|float <= 354.37 %}
             Noord Ten Westen
          {% endif %}
      wind_compass:
        friendly_name: Windrichting
        value_template: '{{ states.sensor.pws_wind_degrees.state }}'
        friendly_name_template: "Windrichting - {{ states.sensor.wind_compass_point.state }}"
        unit_of_measurement: '°'
        entity_picture_template: >-
          {% if 354.38 <= states('sensor.pws_wind_degrees')|float <= 5.62 %}
             /local/wind_compass/0.png
          {% elif 5.63 <= states('sensor.pws_wind_degrees')|float <= 16.87 %}
              /local/wind_compass/11.png
          {% elif 16.88 <= states('sensor.pws_wind_degrees')|float <= 28.12 %}
              /local/wind_compass/22.png
          {% elif 28.13 <= states('sensor.pws_wind_degrees')|float <= 39.37 %}
              /local/wind_compass/33.png
          {% elif 39.38 <= states('sensor.pws_wind_degrees')|float <= 50.62 %}
              /local/wind_compass/45.png
          {% elif 50.63 <= states('sensor.pws_wind_degrees')|float <= 61.87 %}
              /local/wind_compass/56.png
          {% elif 61.88 <= states('sensor.pws_wind_degrees')|float <= 73.12 %}
              /local/wind_compass/67.png
          {% elif 73.13 <= states('sensor.pws_wind_degrees')|float <= 84.37 %}
              /local/wind_compass/78.png
          {% elif 84.38 <= states('sensor.pws_wind_degrees')|float <= 95.62 %}
              /local/wind_compass/90.png
          {% elif 95.63 <= states('sensor.pws_wind_degrees')|float <= 106.87 %}
              /local/wind_compass/101.png
          {% elif 106.88 <= states('sensor.pws_wind_degrees')|float <= 118.12 %}
              /local/wind_compass/112.png
          {% elif 118.13 <= states('sensor.pws_wind_degrees')|float <= 129.37 %}
              /local/wind_compass/123.png
          {% elif 129.38 <= states('sensor.pws_wind_degrees')|float <= 140.62 %}
              /local/wind_compass/135.png
          {% elif 140.63 <= states('sensor.pws_wind_degrees')|float <= 151.87 %}
              /local/wind_compass/146.png
          {% elif 151.88 <= states('sensor.pws_wind_degrees')|float <= 163.12 %}
              /local/wind_compass/157.png
          {% elif 163.13 <= states('sensor.pws_wind_degrees')|float <= 174.37 %}
              /local/wind_compass/168.png
          {% elif 174.38 <= states('sensor.pws_wind_degrees')|float <= 185.62 %}
              /local/wind_compass/180.png
          {% elif 185.63 <= states('sensor.pws_wind_degrees')|float <= 196.87 %}
              /local/wind_compass/191.png
          {% elif 196.88 <= states('sensor.pws_wind_degrees')|float <= 208.12 %}
              /local/wind_compass/202.png
          {% elif 208.13 <= states('sensor.pws_wind_degrees')|float <= 219.37 %}
              /local/wind_compass/213.png
          {% elif 219.38 <= states('sensor.pws_wind_degrees')|float <= 230.62 %}
              /local/wind_compass/225.png
          {% elif 230.63 <= states('sensor.pws_wind_degrees')|float <= 241.87 %}
              /local/wind_compass/236.png
          {% elif 241.88 <= states('sensor.pws_wind_degrees')|float <= 253.12 %}
              /local/wind_compass/247.png
          {% elif 253.13 <= states('sensor.pws_wind_degrees')|float <= 264.37 %}
              /local/wind_compass/258.png
          {% elif 264.38 <= states('sensor.pws_wind_degrees')|float <= 275.62 %}
              /local/wind_compass/270.png
          {% elif 275.63 <= states('sensor.pws_wind_degrees')|float <= 286.87 %}
              /local/wind_compass/281.png
          {% elif 286.88 <= states('sensor.pws_wind_degrees')|float <= 298.12 %}
              /local/wind_compass/292.png
          {% elif 298.13 <= states('sensor.pws_wind_degrees')|float <= 309.37 %}
              /local/wind_compass/303.png
          {% elif 309.38 <= states('sensor.pws_wind_degrees')|float <= 320.62 %}
              /local/wind_compass/315.png
          {% elif 320.63 <= states('sensor.pws_wind_degrees')|float <= 331.87 %}
              /local/wind_compass/326.png
          {% elif 331.88 <= states('sensor.pws_wind_degrees')|float <= 343.12 %}
              /local/wind_compass/337.png
          {% elif 343.13 <= states('sensor.pws_wind_degrees')|float <= 354.37 %}
             /local/wind_compass/348.png
          {% endif %}

1 Like

Thanks for this excellent share, works great.

Just comparing readings from your config to readings from Weather Underground which doesn’t match, any ideas?

sensor.wind_compass 221.6
sensor.weather_wind_direction 221.6
sensor.dark_sky_wind_bearing 158
sensor.pws_wind_dir West

I use Yr.no as the source for wind data. Which is the preferred weather data provider where I live.

Weather underground, I think, uses other sources like private weather stations for collecting waether data.

Find your source sensor from HA, which is as local for you. Then use it with the wind compass.

Great work! I have the new sensors with the wind information, but I am not able to get the image to load.

I am using hass.io.
Uploaded all images to my directory: config/www/wind_compass

I am using this code (see file information, is that the right address)?

{% elif 28.13 <= states('sensor.yr_wind_direction')|float <= 39.37 %}
`              /local/wind_compass/33.png`

Remove the apostrophe
feil

1 Like

cool. nice work.
Ive set it up using Buienradar as follows:

    wind_compass:
    friendly_name: Windrichting
    value_template: >
      {{ states('sensor.br_wind_direction_azimuth') }}
    friendly_name_template: >
      {{ states('sensor.wind_compass_abbreviation') }}
    unit_of_measurement: '°'
    entity_picture_template: >
      {% set degrees = states('sensor.br_wind_direction_azimuth')|float %}
      {% if 354.38 <= degrees <= 5.62 %} /local/weather/wind_compass/0.png
      {% elif degrees <= 16.87 %} /local/weather/wind_compass/11.png
      {% elif degrees <= 28.12 %} /local/weather/wind_compass/22.png
      {% elif degrees <= 39.37 %} /local/weather/wind_compass/33.png
      {% elif degrees <= 50.62 %} /local/weather/wind_compass/45.png
      {% elif degrees <= 61.87 %} /local/weather/wind_compass/56.png
      {% elif degrees <= 73.12 %} /local/weather/wind_compass/67.png
      {% elif degrees <= 84.37 %} /local/weather/wind_compass/78.png
      {% elif degrees <= 95.62 %} /local/weather/wind_compass/90.png
      {% elif degrees <= 106.87 %} /local/weather/wind_compass/101.png
      {% elif degrees <= 118.12 %} /local/weather/wind_compass/112.png
      {% elif degrees <= 129.37 %} /local/weather/wind_compass/123.png
      {% elif degrees <= 140.62 %} /local/weather/wind_compass/135.png
      {% elif degrees <= 151.87 %} /local/weather/wind_compass/146.png
      {% elif degrees <= 163.12 %} /local/weather/wind_compass/157.png
      {% elif degrees <= 174.37 %} /local/weather/wind_compass/168.png
      {% elif degrees <= 185.62 %} /local/weather/wind_compass/180.png
      {% elif degrees <= 196.87 %} /local/weather/wind_compass/191.png
      {% elif degrees <= 208.12 %} /local/weather/wind_compass/202.png
      {% elif degrees <= 219.37 %} /local/weather/wind_compass/213.png
      {% elif degrees <= 230.62 %} /local/weather/wind_compass/225.png
      {% elif degrees <= 241.87 %} /local/weather/wind_compass/236.png
      {% elif degrees <= 253.12 %} /local/weather/wind_compass/247.png
      {% elif degrees <= 264.37 %} /local/weather/wind_compass/258.png
      {% elif degrees <= 275.62 %} /local/weather/wind_compass/270.png
      {% elif degrees <= 286.87 %} /local/weather/wind_compass/281.png
      {% elif degrees <= 298.12 %} /local/weather/wind_compass/292.png
      {% elif degrees <= 309.37 %} /local/weather/wind_compass/303.png
      {% elif degrees <= 320.62 %} /local/weather/wind_compass/315.png
      {% elif degrees <= 331.87 %} /local/weather/wind_compass/326.png
      {% elif degrees <= 343.12 %} /local/weather/wind_compass/337.png
      {% elif degrees <= 354.37 %} /local/weather/wind_compass/348.png
      {% endif %}

or shorter:

    entity_picture_template: >
      {% set degrees = states('sensor.br_wind_direction_azimuth')|float %}
      {% set path = '/local/weather/wind_compass/' %}
      {% set ext = '.png' %}
      {{path-}}
      {%- if degrees <= 5.62 -%} 0
      {%- elif degrees <= 16.87 -%} 11
      {%- elif degrees <= 28.12 -%} 22
      {%- elif degrees <= 39.37 -%} 33
      {%- elif degrees <= 50.62 -%} 45
      {%- elif degrees <= 61.87 -%} 56
      {%- elif degrees <= 73.12 -%} 67
      {%- elif degrees <= 84.37 -%} 78
      {%- elif degrees <= 95.62 -%} 90
      {%- elif degrees <= 106.87 -%} 101
      {%- elif degrees <= 118.12 -%} 112
      {%- elif degrees <= 129.37 -%} 123
      {%- elif degrees <= 140.62 -%} 135 
      {%- elif degrees <= 151.87 -%} 146
      {%- elif degrees <= 163.12 -%} 157
      {%- elif degrees <= 174.37 -%} 168
      {%- elif degrees <= 185.62 -%} 180
      {%- elif degrees <= 196.87 -%} 191
      {%- elif degrees <= 208.12 -%} 202
      {%- elif degrees <= 219.37 -%} 213
      {%- elif degrees <= 230.62 -%} 225
      {%- elif degrees <= 241.87 -%} 236
      {%- elif degrees <= 253.12 -%} 247
      {%- elif degrees <= 264.37 -%} 258
      {%- elif degrees <= 275.62 -%} 270
      {%- elif degrees <= 286.87 -%} 281
      {%- elif degrees <= 298.12 -%} 292
      {%- elif degrees <= 309.37 -%} 303
      {%- elif degrees <= 320.62 -%} 315
      {%- elif degrees <= 331.87 -%} 326
      {%- elif degrees <= 343.12 -%} 337
      {%- elif degrees <= 354.37 -%} 348
      {%- endif -%}
      {{-ext-}}

not sure we need the abbreviation template, since Buienradar has that built-in:

48

But, this template might be more precise, so Ill leave it in for the moment :wink:

Nice little dashboard in the frontend Weather page.
Thanks for the icons and work on this!

2 Likes

follow-up:
please have a look at How to shorten/join this template?

how @datamonkey helped me create this even shorter and way more intelligent template:

  wind_compass:
    friendly_name: Windrichting
    value_template: >
      {{ states('sensor.br_wind_direction_azimuth') }}
    friendly_name_template: >
      {{ states('sensor.wind_compass_abbreviation') }}
    unit_of_measurement: '°'
    entity_picture_template: >
      {% set degrees = states('sensor.br_wind_direction_azimuth')|float %}
      {% set path = '/local/weather/wind_compass/' %}
      {% set ext = '.png' %}
      {{path-}}
      {%- if 354.38 <= degrees or degrees <= 5.62 -%} 0
      {%- else -%}
      {{ ( ((degrees/11.25)|round )*11.25 )| round}}
      {%- endif -%}
      {{-ext-}}

so cool.

3 Likes

Wow. Nifty : )

I saw your full solution here.
Maybe you can define an array of jsons and have all your mappings in one place.
Not sure if you can share it between template sensors, you would need to try.

{% set dir = [
  {"abr": "N" ,   "friendly" : "North"} ,
  {"abr": "NbE",  "friendly" : "North by East"},
  {"abr": "NNE",  "friendly" : "North North East"},
  {"abr": "NEbN", "friendly" : "North East by North"},
  ...
  {"abr": "N" ,   "friendly" : "North"} 
] %}

{% set degrees = 7  %}
{% set d = (degrees/11.25)|round  %}

Abbreviation = {{dir[d].abr}}
Friendly = {{dir[d].friendly}}
Picture =  {{dir[d].abr|lower}}.png

returns

Abbreviation = NbE
Friendly = North by East
Picture = nbe.png

this would require you to rename the pictures, or you add another pair in the array to link to the picture name

thanks to @petro its getting even better:

  wind_compass_abbreviation:
    friendly_name: Windrichting Afkorting
    value_template: >
      {% set degrees = states('sensor.br_wind_direction_azimuth')|float %}
      {% set abbr = ['N','NNNO','NNO','ONNO','NO','NONO','ONO','OONO','O','OOZO','OZO','ZOZO','ZO',
                     'OZZO','ZZO','ZZZO','Z','ZZZW','ZZW','ZZW','ZW','ZWZW','WZW','WWZW','W','WWNW',
                     'WNW','NWNW','NW','WNNW','NNW','NNNW' ] %}
      {%- set i = ((degrees / 11.25) | round(0)) | int %}
      {%- set i = 0 if i == 32 else i %}
      {{ abbr[i] }}

  wind_compass_direction:
    friendly_name: Windrichting
    value_template: >
      {% set degrees = states('sensor.br_wind_direction_azimuth')|float %}
      {% set direction = ['Noord','Noord Ten Oosten','Noordnoordoost','Noordoost Ten Noorden','Noordoost',
                          'Noordoost Ten Oosten','Oostnoordoost','Oost Ten Noorden','Oost',
                          'Oost Ten Zuiden','Oostzuidoost','Zuidoost Ten Oosten','Zuidoost',
                          'Zuidoost Ten Zuiden','Zuidzuidoost','Zuid Ten Oosten','Zuid',
                          'Zuid Ten Westen','Zuidzuidwest','Zuidwest Ten Zuiden','Zuidwest',
                          'Zuidwest Ten Westen','Westzuidwest','West Ten Zuiden','West',
                          'West Ten Noorden','Westnoordwest','Noordwest Ten Westen','Noordwest',
                          'Noordwest Ten Noorden','Noordnoordwest','Noord Ten Westen'] %}
      {%- set i = ((degrees / 11.25) | round(0)) | int %}
      {%- set i = 0 if i == 32 else i %}
      {{ direction[i] }}
2 Likes

now this I must study :wink:

have a look at the post above for 2 separate sensors with comparable lists. Is already really very nice.
Combining those into 1 is the next challenge…
thanks for the suggestion , and please don’t hold back ;

meanwhile, here’s a sensor with all info in 1:

  wind_compass_direction:
    friendly_name_template: >
      {% set degrees = states('sensor.br_wind_direction_azimuth')|float %}
      {% set abbr = states('sensor.wind_compass_abbreviation') %}
      {{abbr}} : {{degrees}} °
    value_template: >
      {% set degrees = states('sensor.br_wind_direction_azimuth')|float %}
      {% set direction = ['Noord','Noord Ten Oosten','Noordnoordoost','Noordoost Ten Noorden','Noordoost',
                          'Noordoost Ten Oosten','Oostnoordoost','Oost Ten Noorden',
                          'Oost','Oost Ten Zuiden','Oostzuidoost','Zuidoost Ten Oosten','Zuidoost',
                          'Zuidoost Ten Zuiden','Zuidzuidoost','Zuid Ten Oosten',
                          'Zuid','Zuid Ten Westen','Zuidzuidwest','Zuidwest Ten Zuiden','Zuidwest',
                          'Zuidwest Ten Westen','Westzuidwest','West Ten Zuiden',
                          'West','West Ten Noorden','Westnoordwest','Noordwest Ten Westen','Noordwest',
                          'Noordwest Ten Noorden','Noordnoordwest','Noord Ten Westen'] %}
      {%- set i = ((degrees / 11.25) | round(0)) | int %}
      {%- set i = 0 if i == 32 else i %}
      {{ direction[i] }}
    entity_picture_template: >
      {%- set degrees = states('sensor.br_wind_direction_azimuth')|float %}
      {%- set path = '/local/weather/wind_compass/' %}
      {%- set ext = '.png' %}
      {%- set num = ((degrees // 11.25) * 11.25 // 1) | int %}
      {%- set num  = 0 if num  == 360 else num %}
      {{ "{}{}{}".format(path,num,ext) }}

42

2 Likes

Is it possible to show this on the map component in Home assistant ?

I have not tried putting this sensor on the map. Think that sensor need latitude and longitude attributes, and it will display automatically.

Thanks guys for the job, work well to track ISS.

entities:
  - entity: sensor.iss_compass_direction
style: |
  ha-card {
    background: url(/local/pictures/WindCompass/windrose2.png);
    color: red;
    text-shadow: 1px 1px 0 #FFF;
  }
type: glance

Sans%20titre

Can someone post how they setup the template? I tried but each time the Check Configuration it says something about format error in code. Now is this to be used under Sensor on the config or something else? I love the idea in using this but can’t seem to get the coding right. I see where some shorten it but I don’t think that works with the Yr.no sensor.

Hi!

I use Tomahawk’s code, and here is simple Lovelace Wind compass card:

Sensors:

  - platform: template
    sensors: 
      wind_compass_abbreviation:
        value_template: >-
          {% if 354.38 <= states('sensor.weather_wind_direction')|float <= 5.62 %}
             N
          {% elif 5.63 <= states('sensor.weather_wind_direction')|float <= 16.87 %}
             NbE
          {% elif 16.88 <= states('sensor.weather_wind_direction')|float <= 28.12 %}
             NNE
          {% elif 28.13 <= states('sensor.weather_wind_direction')|float <= 39.37 %}
             NEbN
          {% elif 39.38 <= states('sensor.weather_wind_direction')|float <= 50.62 %}
             NE
          {% elif 50.63 <= states('sensor.weather_wind_direction')|float <= 61.87 %}
             NEbE
          {% elif 61.88 <= states('sensor.weather_wind_direction')|float <= 73.12 %}
             ENE
          {% elif 73.13 <= states('sensor.weather_wind_direction')|float <= 84.37 %}
             EbN
          {% elif 84.38 <= states('sensor.weather_wind_direction')|float <= 95.62 %}
             E
          {% elif 95.63 <= states('sensor.weather_wind_direction')|float <= 106.87 %}
             EbS
          {% elif 106.88 <= states('sensor.weather_wind_direction')|float <= 118.12 %}
             ESE
          {% elif 118.13 <= states('sensor.weather_wind_direction')|float <= 129.37 %}
             SEbE
          {% elif 129.38 <= states('sensor.weather_wind_direction')|float <= 140.62 %}
             SE
          {% elif 140.63 <= states('sensor.weather_wind_direction')|float <= 151.87 %}
             SEbS
          {% elif 151.88 <= states('sensor.weather_wind_direction')|float <= 163.12 %}
             SSE
          {% elif 163.13 <= states('sensor.weather_wind_direction')|float <= 174.37 %}
             SbE
          {% elif 174.38 <= states('sensor.weather_wind_direction')|float <= 185.62 %}
             S
          {% elif 185.63 <= states('sensor.weather_wind_direction')|float <= 196.87 %}
             SbW
          {% elif 196.88 <= states('sensor.weather_wind_direction')|float <= 208.12 %}
             SSW
          {% elif 208.13 <= states('sensor.weather_wind_direction')|float <= 219.37 %}
             SWbS
          {% elif 219.38 <= states('sensor.weather_wind_direction')|float <= 230.62 %}
             SW
          {% elif 230.63 <= states('sensor.weather_wind_direction')|float <= 241.87 %}
             SWbW
          {% elif 241.88 <= states('sensor.weather_wind_direction')|float <= 253.12 %}
             WSW
          {% elif 253.13 <= states('sensor.weather_wind_direction')|float <= 264.37 %}
             WbS
          {% elif 264.38 <= states('sensor.weather_wind_direction')|float <= 275.62 %}
             W
          {% elif 275.63 <= states('sensor.weather_wind_direction')|float <= 286.87 %}
             WbN
          {% elif 286.88 <= states('sensor.weather_wind_direction')|float <= 298.12 %}
             WNW
          {% elif 298.13 <= states('sensor.weather_wind_direction')|float <= 309.37 %}
             NWbW
          {% elif 309.38 <= states('sensor.weather_wind_direction')|float <= 320.62 %}
             NW
          {% elif 320.63 <= states('sensor.weather_wind_direction')|float <= 331.87 %}
             NWbN
          {% elif 331.88 <= states('sensor.weather_wind_direction')|float <= 343.12 %}
             NNW
          {% elif 343.13 <= states('sensor.weather_wind_direction')|float <= 354.37 %}
             NbW
          {% endif %}

Lovelace:

  elements:
    - entity: sensor.wind_compass_abbreviation
      image: /local/WindCompass/E.png
      state_image:
        'N': /local/WindCompass/N.png
        NbE: /local/WindCompass/NbE.png
        NNE: /local/WindCompass/NNE.png
        NEbN: /local/WindCompass/NEbN.png
        NE: /local/WindCompass/NE.png
        NEbE: /local/WindCompass/NEbE.png
        ENE: /local/WindCompass/ENE.png
        EbN: /local/WindCompass/EbN.png
        E: /local/WindCompass/E.png
        EbS: /local/WindCompass/EbS.png
        ESE: /local/WindCompass/ESE.png
        SEbE: /local/WindCompass/SEbE.png
        SE: /local/WindCompass/SE.png
        SEbS: /local/WindCompass/SEbS.png
        SSE: /local/WindCompass/SSE.png
        SbE: /local/WindCompass/SbE.png
        S: /local/WindCompass/S.png
        SbW: /local/WindCompass/SbW.png
        SSW: /local/WindCompass/SSW.png
        SWbS: /local/WindCompass/SWbS.png
        SW: /local/WindCompass/SW.png
        SWbW: /local/WindCompass/SWbW.png
        WSW: /local/WindCompass/WSW.png
        WbS: /local/WindCompass/WbS.png
        W: /local/WindCompass/W.png
        WbN: /local/WindCompass/WbN.png
        WNW: /local/WindCompass/WNW.png
        NWbW: /local/WindCompass/NWbW.png
        NW: /local/WindCompass/NW.png
        NWbN: /local/WindCompass/NWbN.png
        NNW: /local/WindCompass/NNW.png
        NbW: /local/WindCompass/NbW.png
      style:
        left: 50%
        top: 50%
        width: 100%
      type: image
  image: /local/WindCompass/background.png
  type: picture-elements

:beers:

1 Like