Help with statistics max and min

I’m trying to get the max current over a 24 hour period. As shown in the graph, it approaches 20 amps, but the max statistics sensor only reports 11.85… the min is also way off…

My sensor is defined as follows:

  - platform: statistics
    name: "Min House current 24 Hours"
    entity_id: sensor.house_energy_monitor_current
    state_characteristic: value_min
    max_age:
      hours: 24
  - platform: statistics
    name: "Max House current 24 Hours"
    entity_id: sensor.house_energy_monitor_current
    state_characteristic: value_max
    max_age:
      hours: 24

Any ideas?
EDIT: I’m experimenting with sampling size. I set to 100. I’m sampling at 10s intervals. 6x15=90, so 100 should suffice.

Jeff

No difference. And yes, I restarted. I turned on the toaster and microwave and spiked it to 37 amps. It shows the value correctly but the min max values aren’t correct.

My sensors now:

  - platform: statistics
    name: "Min House current 48 Hours"
    entity_id: sensor.house_energy_monitor_current
    state_characteristic: value_min
    sampling_size: 100
    max_age:
      hours: 48
  - platform: statistics
    name: "Max House current 48 Hours"
    entity_id: sensor.house_energy_monitor_current
    state_characteristic: value_max
    sampling_size: 100
    max_age:
      hours: 48

If you are getting sensor updates at 10s intervals you need this many samples minimum for a 24 hour window:

24*60*60/10 = 8640 Say 9000 to be sure. For a 48 hour window you would need twice as many samples (18,000).

There is an attribute of the sensor called buffer_usage_ratio. You need this to be close to 1 but never actually reaching 1 (100% sample buffer used). Keep an eye on it after making the samples change.

Interesting. My ratio is = 1.0, so what am I to interpret from that?

That the buffer is full, so it probably had to drop values you needed to get the right result. If you increase to the suggested 18000 samples it should drop below 1 I guess.

1 Like