How to set up this sensor?

I just install an anemometer (reports values through mqtt)

  - platform: mqtt
    name: "Wind Speed"
    state_topic: "anemometer/wind"
    unit_of_measurement: 'km/h'

Since it reports values very often I added the below sensor in order to have a better sample

  - platform: statistics
    entity_id: sensor.wind_speed
    name: wind speed average 1 minute
    #unit_of_measurement: 'km/h'
    sampling_size: 30
    max_age:
      minutes: 2

I am getting the wind speed from other sources too (comparison) so I have the following (final for my automation) sensor

  - platform: min_max
    #type: max
    name: Wind Speed Automation
    entity_ids:
      - sensor.marousi
      - sensor.dark_sky_wind_speed
      - sensor.ha_wind_speed
      #- sensor.wind_speed_average_1_minute

As you can see I tried to add my personal stats (sensor.wind_speed_average_1_minute) but I am getting value unknown.

In logs said something like “different measurement” that’s why I tried to add the “km/h” but it wouldn’t pass the configuration validation.

Any ideas how I could have the max value from these sensors?

Annotation 2020-05-03 204232

Why did you call it a 1 minute average if you are using 2 minutes of data (max age)?

What was the unit of the statistics sensor?

It should be the same as the sensor it consumes.

I am trying to calibrate it it right now. I started with 1 minute and trying to see what it does in 2 minutes. I will change the name when I decide what’s working better.
They are all formatted in km/h as in the picture and the conf files.
I don’t see what more I should do.

if I try to add units of measurement in statistics sensor it gives me the following

Invalid config for [sensor.statistics]: [unit_of_measurement] is an invalid option for [sensor.statistics]. Check: sensor.statistics->unit_of_measurement. ```

You can’t just add any option you feel is required to an integration. They clearly show what options are available in the documents.

unit_of_measurement is not one for the statistics sensor as it uses whatever unit the sensor it consumes is set up with. Which should have been km/h in your case. Which was why I asked what it appeared to be.

Just tried. Is there any other way to get the desired outcome?

You could start by answering the question I have asked twice.

Probably I am confused. What is the question?
the statistics sensor reads the values from the below sensor (1st in my original post) which is in km/h

  - platform: mqtt
    name: "Wind Speed"
    state_topic: "anemometer/wind"
    unit_of_measurement: 'km/h'

Look the statistics sensor up in the developer tools states menu. What are its units?

Annotation 2020-05-03 230156

That’s not the statistics sensor. I give up.

Please don’t.

Annotation 2020-05-03 232056

@Makis May I ask which hardware do you use?

I have an intel nuc = NUC7PJYH

Thanks for your fast reply.
Sorry, I was unprecise, I wanted to know hardware of the anemometer :innocent:

1 Like

I am interested on installing a wind sensor that needs to give readings to HA. How did you connect this one to HA?

Hi
I followed this
Update README.md · sbiermann/esp8266-anemometer@b33ec6b (github.com)