Min/max sensor produces junk data around HASS restart


I have a bunch of scrape sensors to calculation an air pollution index from some station raw data (scaped once every 15 minutes) and a min/max sensor to pick the largest of these values, defined just beneath in config.yaml.

Whenever I restart HASS, the min-max sensor produces some junk data before it settles onto the correct value. I am guessing that it is evaluating the min/max while the sensors are scraping. This produces spikes in my history chart and makes it ugly (have a look at the screnshot: the line is the max of the five sensors below, none of which has the junky spikes)

Is there some to prevent this? Maybe forcing min/max to wait until the scrape has finished, or something haven’t thought about?



Same here, I’m facing the same annoying thing since a while but never raised the point. I have several temperature sensors and the min/max sensor starts calculating after a restart while all sensors are not all updated, which translates to spikes like yours.

I already did some researches and the simplest way I found would be to introduce an arbitrary delay parameter that the sensor would wait before calculating. Another more complex approach would be to wait for all the sensors to have a “valid” value, but how to define what is a valid value? Not unknown or not unavailable?
In any case, that would require adapting the code.

Nothing related but that could also be very interesting to define weights for each base sensor. Like in my case bedroom temp is more important than the basement one. Anyway that would be for another topic.

This issue has been open for a while, very likely the same problem:

Add your information (don’t just say “me too”), i.e. is it just template sensors or do you have a different type? Include error logs if any.

I can almost guarantee that the template sensors aren’t set up properly. The min max sensor ignores ‘unknown’ values, but not values that the sensors produce. The templates most likely produce 0 on startup instead of having an unknown state with the availability template. The min max does wait until it’s sensor has started, so I’d start looking at the sensor that produces the values.

1 Like

Hmm I get this as well with my temperature average sensors.

EDIT: In the documentation it’s stated to use the statistic integration to stabilize sensor output. Will try that out.

- platform: min_max
  type: mean
  round_digits: 1
  name: Temperature kitchen average
    - sensor.temperature_kitchen_motion
    - sensor.temperature_kitchen_multi