#wind direction
1 messages · Page 1 of 1 (latest)
Please post what you've tried and your existing sensors. Also post information about what you'd expect each degree to be
i have zero idea
With a routine like this, it's better to turn to LLM.
{%- set degrees = states('sensor.your_wind_bearing') | float(0) -%}
{%- set directions = ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"] -%}
{%- if degrees < 0 or degrees > 360 -%}
Invalid value
{%- else -%}
{%- set index = ((degrees / 22.5) + 0.5) | int % 16 -%}
{{- directions[index] -}}
{%- endif -%}
THIS IS WHATI FOUND BUT HAVE NO IDEZA WHAT TO DO TO IMPLIMENT IT
- platform: template
sensors:
weather_wind_dir:
friendly_name: 'Wind Direction'
value_template: >
{% set direction = ['N','NNE','NE','ENE','E','ESE','SE','SSE','S','SSW','SW','WSW','W','WNW','NW','NNW','N'] %}
{% set degree = states('sensor.wind_dir')|float %}
{{ direction[((degree+11.25)/22.5)|int] }}
sorry for caps
i have zero idea how to impliment any of this
First you need to clarify the name of your sensor or attribute from it. After that, read this article
https://www.home-assistant.io/integrations/template/#state-based-template-binary-sensors-buttons-covers-images-lights-numbers-selects-sensors-switches-and-weathers
sensor.st_00137020_wind_direction
you will need to change the value at this location {% set degree = states('sensor.wind_dir')|float %}
again i have zero idea on any foundation on how to code this
i have zero experience with writing any formula or code i know how to copy and paste into the config file or find somnethign to copy and paste thats as far as i can really figure
ok, and what does 0° represent, north south east or west?
without that info, we can't help
literally
with numbers, you need a point of reference, otherwise the numbers are meaningless
o is north
alright, then what @azure pagoda posted is what you should use in a template sensor
Go to settings > Devices & Services > Helpers and then press the button to create a new helper
Select Template > Template a sensor
paste this in the field for the template:
{% set direction = ['N','NNE','NE','ENE','E','ESE','SE','SSE','S','SSW','SW','WSW','W','WNW','NW','NNW','N'] %}
{% set degree = states('sensor.st_00137020_wind_direction') %}
{{ direction[((degree | float + 11.25) / 22.5) | int] if degree | is_number else 'unknown' }}
don't set a state class/device class/unit of measurement
no, I'd rather help you right here
you need to update the sensor entity_id, as she claims she's incapable of altering code.
already did 🙂 based on the info provided here #1370399338328621056 message
wrongly I see now
now It should be correct
you are a god fes i would like to work with you more would you be open to helping me our if i could direct message you i would pay for your time and knowledge