Strange Behavior in Average Statistics Sensor

I have a statistics sensor that takes an average of the value of another sensor over the last two hours. I then use that value to drive an alert. Specifically, what I am seeing is a random spike in the average, almost as if a very high value has been averaged in.

This is strange for two reasons:

  1. I can’t see any high values in the history view
  2. The value I’m averaging is the set temperature of my thermostat, which is never set to anything outside the 70s.

sensor:
  - platform: statistics
    name: "Average downstairs set temperate"
    entity_id: sensor.downstairs_set_temperature_sensor
    state_characteristic: average_step
    sampling_size: 120
    max_age:
      hours: 2

For those who are curious about why I might do such a strange thing: My furnace intake has a habit of freezing in extremely cold temperatures that we get once or twice a year. A large differential between the set value of the thermostat and the actual temperature indicates a potential problem. By taking an average of the set temperature, it prevents the alert from being triggered by someone adjusting the temperature of the thermostat, because it takes 2 hours to fully adjust to the new value. That gives the furnace enough time to keep up.

1 Like

Did you restart home assistant when those spikes occurred?

If so, you should open a new issue as the reporter of that issue let it go stale. You can link to the old issue in yours to give it more support.

I’m having the exact same problem, unfortunately the issue was closed although it’s not resolved.