Startup error on sensor statistics, and who causes it?

On startup this in always the log:

2018-09-05 09:25:40 ERROR (MainThread) [homeassistant.components.sensor.statistics] variance requires at least two data points

Wasn’t even aware to be using this sensor…still,

checking the source on for the error, it’s not there…

tried the history_stats (which I am using), but that doesn’t use the euro either. Nor does the trend sensor, also being used in the configuration.

which component could cause this error?

The error is ultimately coming from here. Notice especially how it says, “Raises StatisticsError if data has fewer than two values.”

In the HA statistics sensor code, it’s coming from here.

So, you must have a statistics sensor configured somewhere.

1 Like

found it…

- platform: statistics
  entity_id: sensor.gas_actueel_verbruik
  name: Gas uur gemiddelde
  icon: mdi:fire
    minutes: 60
  unit_of_measurement: '/m3'

now why would this error. Could it be it has no value yet on startup? I would think none of these kind of sensors does, and need to be initialized first by reading the sensor they are based on.

Is this error doing any harm? I assume it disappears after you have enough data?

yes, it does.
It shouldn’t be there in the first place, and if so, should have been a warning, not an error.

As you can see from the screenshot, it apparently reads from the recorder, so takes several values, and shouldn’t need to complain about having not enough data-points, which it has.

and maybe not a life threatening situation, but ultimately I strive for an error free HA setup.

1 Like