Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # _ ___ __ ____ _ __ _
- #| | / (_)___ ____/ / / __ \(_)_______ _____/ /_(_)___ ____
- #| | /| / / / __ \/ __ /_____/ / / / / ___/ _ \/ ___/ __/ / __ \/ __ \
- #| |/ |/ / / / / / /_/ /_____/ /_/ / / / / __/ /__/ /_/ / /_/ / / / /
- #__/|__/_/_/ /_/\__,_/ /_____/_/_/ \___/\___/\__/_/\____/_/ /_/
- # by Jason Robert Hill
- wind_direction:
- #Requirements: None
- sensor:
- - platform: template
- sensors:
- #takes wind bearing attribute from weather.hjem and makes it to a sensor
- wind_bearing_degrees:
- friendly_name: "Vind Bearing"
- unit_of_measurement: 'degrees'
- icon_template: mdi:weather-windy
- value_template: "{{ state_attr('weather.hjem', 'wind_bearing') }}"
- #takes wind speed attribute from weather.hjem and makes it to a sensor
- wind_speed:
- friendly_name: "Vind hastighed"
- unit_of_measurement: m/s
- value_template: "{{ ((state_attr('weather.hjem', 'wind_speed') |float ) * 0.2778) | round(1) }}"
- #Converts sensor.wind_bearing from degrees to compass orientation.
- wind_bearing_compass_direction:
- friendly_name: "Vindretning"
- icon_template: mdi:weather-windy
- value_template: >-
- {% set direction = ['NORD ↑','Nord-Nordøst ↗','Nordøst ↗','Øst-Nordøst ↗','Øst →','Øst-Sydøst ↘','Sødøst ↘','Syd-Sydøst ↘','Syd ↓','Syd-Sydvest ↙','Sydvest ↙','vest-Sydvest ↙','Vest ←','Vest-Nordvest ↖','Nordvest ↖','Nord-Nordvest ↖','Nord ↑'] %}
- {{ direction[(((state_attr('weather.hjem', 'wind_bearing')|float)+11.25)/22.5)|int] }}
- # Cardinal Direction Degree Direction
- # N 348.75 - 11.25
- # NNE 11.25 - 33.75
- # NE 33.75 - 56.25
- # ENE 56.25 - 78.75
- # E 78.75 - 101.25
- # ESE 101.25 - 123.75
- # SE 123.75 - 146.25
- # SSE 146.25 - 168.75
- # S 168.75 - 191.25
- # SSW 191.25 - 213.75
- # SW 213.75 - 236.25
- # WSW 236.25 - 258.75
- # W 258.75 - 281.25
- # WNW 281.25 - 303.75
- # NW 303.75 - 326.25
- # NNW 326.25 - 348.75
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement