Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sensor:
- - platform: template
- sensors:
- weather_wind_dir:
- friendly_name: Vind Retning
- value_template: >
- {% set dir = states('sensor.openweathermap_harboore_wind_bearing')|float %}
- {% if 11.25 < dir <= 33.75 %} NNOE
- {% elif 33.75 < dir <= 56.25 %} NOE
- {% elif 56.25 < dir <= 78.75 %} OENOE
- {% elif 78.75 < dir <= 101.25 %} OE
- {% elif 101.25 < dir <= 123.75 %} OESOE
- {% elif 123.75 < dir <= 146.25 %} SOE
- {% elif 146.25 < dir <= 168.75 %} SSOE
- {% elif 168.75 < dir <= 191.25 %} S
- {% elif 191.25 < dir <= 213.75 %} SSV
- {% elif 213.75 < dir <= 236.25 %} SV
- {% elif 236.25 < dir <= 258.75 %} VSV
- {% elif 258.75 < dir <= 281.25 %} V
- {% elif 281.25 < dir <= 303.75 %} VNV
- {% elif 303.75 < dir <= 326.25 %} NV
- {% elif 326.25 < dir <= 348.75 %} NNV
- {% else %} N
- {% endif %}
- # and this one adds dynamic icons to states
- weather_wind_dir_gui:
- entity_id: sensor.weather_wind_dir
- friendly_name_template: "{{ state_attr('sensor.weather_wind_dir', 'friendly_name') }}"
- value_template: "{{ states('sensor.weather_wind_dir') }}"
- icon_template: >
- {% set state = states('sensor.weather_wind_dir')|float %}
- {% if 11.25 < state <= 33.75 %}
- mdi:weather-windy
- {% else %}
- mdi:weather-windy
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement