How to display wind in a more friendly way with Neatmo

Hello,
Here to share my experience with Neatmo integration.
When you use netatmo, HomeAssistant uses perfectly https://www.home-assistant.io/integrations/netatmo/
For wind, the sensors give the value of direction (e.g. S) with the value (e.g. 180 or 181 …).
For instant display, it’s convenient.
But when you want to display history, you get a bar with lot of changes (e.g. “S 180” “S 181” …)

Hereafter, the solution to get direction and value into 2 separate ‘states’ :
(Please change the name of netatmo sensor by the name you have given within your house)

#Netatmo wind
  - platform: template
    sensors:
      wind_angle:
        friendly_name: "Wind angle"
        unit_of_measurement: 'degrees'
        value_template: "{{ states('sensor.netatmo_netatmo_sceaux_anemometre_balcon_angle') | regex_findall_index('([0-9]+)',index=0,ignorecase=TRUE)  }}"
      wind_gust_angle:
        friendly_name: "Wind gust angle"
        unit_of_measurement: 'degrees'
        value_template: "{{ states('sensor.netatmo_netatmo_sceaux_anemometre_balcon_gust_angle') | regex_findall_index('([0-9]+)',index=0,ignorecase=TRUE)  }}"
      wind_angle_direction_name:
        friendly_name: "Wind angle direction name"
#        unit_of_measurement: 'compass'
        value_template: "{{ states('sensor.netatmo_netatmo_sceaux_anemometre_balcon_angle') | regex_findall_index('([NSWE]+)',index=0,ignorecase=TRUE)  }}"
      wind_gust_angle_direction_name:
        friendly_name: "Wind gust angle direction name"
#        unit_of_measurement: 'compass'
        value_template: "{{ states('sensor.netatmo_netatmo_sceaux_anemometre_balcon_gust_angle') | regex_findall_index('([NSWE]+)',index=0,ignorecase=TRUE)  }}"

The sensors wind_angle or wind_gust_angle can be displayed through curve within history graph.

Hope it can help someone.
Philippe

1 Like

Besides, in my home, the wind is more towards north. The wind angle is between 0 and 360 degree.
In my case , for the display angle between -180 and 180 is better.
Here a solution with the sensors describe hereabove

  - platform: template
    sensors:
      wind_angle_180180:
        unit_of_measurement: 'degrees'
        value_template: >-
           {% if states('sensor.wind_angle') | int > 180 %}
              {{ states('sensor.wind_angle')  | int - 360 }}
            {% else %}
              {{ states('sensor.wind_angle') | int  }}
            {% endif %}
      wind_gust_angle_180180:
        unit_of_measurement: 'degrees'
        value_template: >-
           {% if states('sensor.wind_gust_angle') | int > 180 %}
              {{ states('sensor.wind_gust_angle')  | int - 360 }}
            {% else %}
              {{ states('sensor.wind_gust_angle') | int  }}
            {% endif %}

1 Like

Hi,
THanks for sharing really usefull.
But I am wondering, where do i implement this code, is it in the Configuration file ?

Exactly in configuration.yaml