Anybody have a yaml files that I can load into Esphome with the Davis Instruments Anemometer.
I have found this page but I’m stocked because it only sketch files and I don’t know how to convert them into my Yaml file.
Best regards
Soren
Anybody have a yaml files that I can load into Esphome with the Davis Instruments Anemometer.
I have found this page but I’m stocked because it only sketch files and I don’t know how to convert them into my Yaml file.
Best regards
Soren
Did you find int ?
I got a davis anemometer and I tried to get value.
I have a problem on the wind speed.
Here’s my code
- platform: pulse_meter
pin:
number: GPIO33
mode: INPUT_PULLUP # ???
#update_interval: 60s
id: wind_speed
unit_of_measurement: 'm/s'
name: 'Vitesse du vent'
#name: "${friendly_name} wind speed"
accuracy_decimals: 1
internal_filter: 13us
timeout: 3s
filters:
# periode de refernce 3s
# V (mph) = P * (2.25/T) (V = speed in mph, P = no. of pulses per sample period, T = sample period in seconds)
# V (mph) = P * (2.25/3)
- multiply: 0.75 # 0.005560619
- multiply: 0.44704 # convert mph in m/s
- sliding_window_moving_average:
window_size: 5 #20 PLUTOT DANS LE CODE EXEMPLE
send_every: 2 #20
you pin looks different …
- platform: pulse_meter
pin: GPIO16
unit_of_measurement: 'Knts'
name: "Wind Base"
id: wind
internal_filter: 13us
internal_filter_mode: edge
accuracy_decimals: 0
icon: 'mdi:weather-windy'
filters:
- throttle_average: 1s
# - max:
# window_size: 3
# send_every: 1
# - sliding_window_moving_average:
# window_size: 30
# send_every: 10
- multiply: 0.0325866
- calibrate_linear:
- 0.0 -> 0.0
- 5.0 -> 7.0
- 8.0 -> 10.0
- 10.0 -> 13.0
- 15.0 -> 19.0
- 20.0 -> 25.0
- 25.0 -> 31.0
- filter_out: nan
#- lambda: if (isnan(x)) { return 1.0; } return x;
Hi @loic69. The pulse meter generates a number which is pulses per minute. This is fixed and does not change whether it is updated every 1 second or every 3 seconds. So therefore I think for m/s the correct multiplier is 0.0375 (mph per min = 2.25/ 60 ) x 0.447027 = 0.016763
Yes @JulianDH
I read again and again the doc.
The timeout is just only for return to 0 if no pulse.
So Here’s my new code. For now there is no wind, I have to wait to test
- platform: pulse_meter
pin:
number: GPIO33
mode: INPUT_PULLUP
id: wind_speed_ms
unit_of_measurement: 'm/s'
name: 'Vitesse du vent' # "${friendly_name} wind speed"
#internal: true
accuracy_decimals: 1
internal_filter: 13us
timeout: 30s # after this period, pulse_meter is set to 0
filters:
# V (mph) = P * (2.25/T) (V = speed in mph, P = no. of pulses per sample period, T = sample period in seconds)
#- filter_out: nan # should not have nan value here ???
- multiply: 0.0375 # (2.25 / 60) => pulse meter scale out is 1 pulse / min by default
- multiply: 0.44704 # convert mph in m/s
- sliding_window_moving_average:
window_size: 10
send_every: 5
Otherwise I don’t know how to average the value… throttle_average or sliding_window_moving_average.
I have another sensor which compute a long term average with that
filters:
- throttle_average: 30s
- filter_out: nan
The throttle and sliding-average have one problem. If pulse counter return to 0 with the reset value, the update of the sensor is not OK because the filters wait for other value… So the wind speed keep 1 or 2 m/s instead of 0
Hello I have used many many different settings to see whether I can match my local weather station. I concluded that you need a 1 second throttle delivered a base value which I can then use in many other calculations; for example I calculate both Lulls, Average and Gusts.
Because I do not use the reset value, and do not understand why I need it, I have not had your problem. My base sensor is always providing a value; and with “filter_out: nan” when the anemometer stops moving I still get a zero out of the sensor.
I have pasted my entire yaml.
- platform: pulse_meter
pin: GPIO16
unit_of_measurement: 'Knts'
name: "Wind Base"
id: wind
internal_filter: 13us
internal_filter_mode: edge
accuracy_decimals: 0
icon: 'mdi:weather-windy'
filters:
- throttle_average: 1s
# - max:
# window_size: 3
# send_every: 1
# - sliding_window_moving_average:
# window_size: 30
# send_every: 10
- multiply: 0.0325866
- calibrate_linear:
- 0.0 -> 0.0
- 5.0 -> 7.0
- 8.0 -> 10.0
- 10.0 -> 13.0
- 15.0 -> 19.0
- 20.0 -> 25.0
- 25.0 -> 31.0
- filter_out: nan
#- lambda: if (isnan(x)) { return 1.0; } return x;
- platform: template
name: "Wind Speed"
unit_of_measurement: 'Knts'
icon: 'mdi:weather-windy'
lambda: |-
return 1*id(wind).state;
accuracy_decimals: 0
update_interval: 1s
filters:
# - max:
# window_size: 5
# send_every: 1
# send_first_at: 1
- median:
window_size: 20
send_every: 20
send_first_at: 10
- platform: template
name: "Wind Gusts"
unit_of_measurement: 'Knts'
icon: 'mdi:weather-windy'
lambda: |-
return 1*id(wind).state;
accuracy_decimals: 0
update_interval: 1s
filters:
- max:
window_size: 20
send_every: 20
send_first_at: 10
- platform: template
name: "Wind Lulls"
unit_of_measurement: 'Knts'
icon: 'mdi:weather-windy'
lambda: |-
return 1*id(wind).state;
accuracy_decimals: 0
update_interval: 1s
filters:
- min:
window_size: 20
send_every: 20
send_first_at: 10
So it’s ok for now
Timeout value is implicit and a default value fixed at 5 minutes.
The pulse_meter is different as a pulse_counter. The pulse_meter give you the frequency at each edge. So if you not have edge (no wind) the last edge (last wind) if persistant. So the timeout is essential to set the counter to 0. In my case I prefer timeout after 10 seconds without edge for more accuracy.
Thanks a lot for your help. The Throttle average of 1s is very good.
Here’s my code
- platform: pulse_meter
pin:
number: GPIO33
mode: INPUT_PULLUP
id: weatherstation_wind_speed_ms
unit_of_measurement: 'm/s'
name: 'Vitesse du vent (m/s)' # "${friendly_name} wind speed"
internal: true
accuracy_decimals: 1
internal_filter: 13us
timeout: 10s # after this period, pulse_meter is set to 0. default to 5 m
filters:
- throttle_average: 1s
# V (mph) = P * (2.25/T) (V = speed in mph, P = no. of pulses per sample period, T = sample period in seconds)
- multiply: 0.0375 # (2.25 / 60) => pulse meter out = 1 pulse / min
- multiply: 0.44704 # convert mph in m/s
#- sliding_window_moving_average:
# window_size: 10 #20 PLUTOT DANS LE CODE EXEMPLE
# send_every: 5 #20
- filter_out: nan
- platform: copy
name: 'Vitesse du vent' #'${friendly_name} wind speed (km/h)'
id: weatherstation_wind_speed_kmh
source_id: weatherstation_wind_speed_ms
unit_of_measurement: 'km/h'
accuracy_decimals: 0
icon: 'mdi:weather-windy'
filters:
- multiply: 3.6
# Moyenne du vent
- platform: copy
name: 'Vitesse moyenne du vent (m/s)'#'${friendly_name} wind speed average'
icon: 'mdi:weather-windy'
internal: true
id: weatherstation_wind_speed_avg_ms
source_id: weatherstation_wind_speed_ms
unit_of_measurement: 'm/s'
filters:
- throttle_average: 5min # 10 min average as meteo france quality
- filter_out: nan
#- sliding_window_moving_average
# window_size: 10
# send_every: 10
- platform: copy
name: 'Vitesse moyenne du vent' #'${friendly_name} wind speed average (km/h)'
icon: 'mdi:weather-windy'
id: weatherstation_wind_speed_avg_kmh
source_id: weatherstation_wind_speed_avg_ms
unit_of_measurement: 'km/h'
accuracy_decimals: 0
filters:
- multiply: 3.6
- filter_out: nan
on_value:
lambda: |-
if (x < 1) {
id(weatherstation_wind_scale_code).publish_state("0");
id(weatherstation_wind_scale).publish_state("Calme"); //Calm
} else if (x >= 1 && x < 6) {
id(weatherstation_wind_scale_code).publish_state("1");
id(weatherstation_wind_scale).publish_state("Très légère brise"); //Light Air
} else if (x >= 6 && x < 12) {
id(weatherstation_wind_scale_code).publish_state("2");
id(weatherstation_wind_scale).publish_state("Légère brise"); //Light Breeze
} else if (x >= 12 && x < 20) {
id(weatherstation_wind_scale_code).publish_state("3");
id(weatherstation_wind_scale).publish_state("Petite brise"); // Gentle Breeze
} else if (x >= 20 && x < 29) {
id(weatherstation_wind_scale_code).publish_state("4");
id(weatherstation_wind_scale).publish_state("Jolie brise"); // Moderate Breeze
} else if (x >= 29 && x < 39) {
id(weatherstation_wind_scale_code).publish_state("5");
id(weatherstation_wind_scale).publish_state("Bonne brise"); // Fresh Breeze
} else if (x >= 39 && x < 50) {
id(weatherstation_wind_scale_code).publish_state("6");
id(weatherstation_wind_scale).publish_state("Vent frais"); // Strong Breeze
} else if (x >= 50 && x < 62) {
id(weatherstation_wind_scale_code).publish_state("7");
id(weatherstation_wind_scale).publish_state("Grand frais"); // Near Gale
} else if (x >= 62 && x < 75) {
id(weatherstation_wind_scale_code).publish_state("8");
id(weatherstation_wind_scale).publish_state("Coup de vent"); //Gale
} else if (x >= 75 && x < 89) {
id(weatherstation_wind_scale_code).publish_state("9");
id(weatherstation_wind_scale).publish_state("Fort coup de vent"); // Severe Gale
} else if (x >= 89 && x < 103) {
id(weatherstation_wind_scale_code).publish_state("10");
id(weatherstation_wind_scale).publish_state("Tempête"); // Storm
} else if (x >= 103 && x < 118) {
id(weatherstation_wind_scale_code).publish_state("11");
id(weatherstation_wind_scale).publish_state("Violente tempête"); // Violent Storm
} else if (x >= 118) {
id(weatherstation_wind_scale_code).publish_state("12");
id(weatherstation_wind_scale).publish_state("Ouragan"); // Hurricane Force
} else {
ESP_LOGD("main", "It shouldn't happen (weatherstation_wind_speed_kmh_avg: %f)", x);
}
Thank you @loic69 . I will use timeout … but i hadn’t really noticed a problem…1 pulse per minute is virtually zero!
I did have a fundamental problem that the pulses were very very erratic and included zero values every now and then. I switched to ESP32, but I still have to resolve this; power supply and perhaps stepping voltage up is my next tests. It might be that the I have just have the wrong placement of my Davis.
I don’t understand your problem.
Can your explain it again ?
@loic69 the raw pulses are very erratic; more than I would have expected. So it can go from say 800 pulses to zero for next second and then 600 pulses. This is not possible as the the cups rotate freely and I can seem them spinning! I see another conversation mentions capacitor and diode to remove spikes; but I need to look at my up resistor strength and another power supply. My cable is only 3 metres long. Welcome any comments but I put this problem on hold whilst I finished building my house.
Hi
Do you ok now ?
Yes. Lot of fiddling. But managed to get speed uploaded to Windguru for my part of the coast
Did you resolve your glitch and spikes ?
I have same randomly