G2A Many GEOs
SHARE
TWEET

DIYFUTURISM.COM - WIND DIRECTION SENSOR

diyfuturism Dec 17th, 2017 306 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #
  2. # DIYFUTURISM.COM
  3. #
  4. # USEFUL SENSOR FOR HOME ASSISTANT
  5. # WIND DIRECTION DEGREES TO CARDINAL
  6. #
  7.  
  8. # Convert the Wind Direction from degrees to cardinal
  9. - platform: template
  10.   sensors:
  11.     friendly_wind_direction:
  12.       friendly_name: 'Wind Direction'
  13.       value_template: >-
  14.         {%if states.sensor.dark_sky_wind_bearing.state | float<=11 %}N
  15.         {% elif states.sensor.dark_sky_wind_bearing.state | float>348 %}N
  16.         {% elif states.sensor.dark_sky_wind_bearing.state | float<=34 | float>11 %}NNE
  17.         {% elif states.sensor.dark_sky_wind_bearing.state | float<=56 | float>34 %}NE
  18.         {% elif states.sensor.dark_sky_wind_bearing.state | float<=79 | float>56 %}ENE
  19.         {% elif states.sensor.dark_sky_wind_bearing.state | float<=101 | float>79 %}E
  20.         {% elif states.sensor.dark_sky_wind_bearing.state | float<=124 | float>101 %}ESE
  21.         {% elif states.sensor.dark_sky_wind_bearing.state | float<=146 | float>124 %}SE
  22.         {% elif states.sensor.dark_sky_wind_bearing.state | float<=169 | float>146 %}SSE
  23.         {% elif states.sensor.dark_sky_wind_bearing.state | float<=191 | float>169 %}S
  24.         {% elif states.sensor.dark_sky_wind_bearing.state | float<=214 | float>191 %}SSW
  25.         {% elif states.sensor.dark_sky_wind_bearing.state | float<=236 | float>214 %}SW
  26.         {% elif states.sensor.dark_sky_wind_bearing.state | float<=259 | float>236 %}WSW
  27.         {% elif states.sensor.dark_sky_wind_bearing.state | float<=281 | float>259 %}W
  28.         {% elif states.sensor.dark_sky_wind_bearing.state | float<=304 | float>281 %}WNW
  29.         {% elif states.sensor.dark_sky_wind_bearing.state | float<=326 | float>304 %}NW
  30.         {% elif states.sensor.dark_sky_wind_bearing.state | float<=348 | float>326 %}NNW
  31.         {%- endif %}
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top