Problem with statistics sensors in core-2021.12.0

I’ve just updated to core-2021.12.0 and have found the statistics sensors have less attributes than before.

I have the next sensor:

sensor:
  - platform: statistics
    name: stats_temperature_salon
    entity_id: sensor.sonoff_a48000f31d_temperature
    max_age:
      hours: 24
    sampling_size: 50

In core-2021.11.5 it had the next attributes:

sampling_size: 50
count: 26
mean: 22.6
median: 22.7
quantiles:
  - 22.04
  - 22.7
  - 23.12
standard_deviation: 0.57
variance: 0.32
total: 587.67
min_value: 21.74
max_value: 23.39
min_age: '2021-12-11T13:01:09.658738+00:00'
max_age: '2021-12-12T12:09:57.390473+00:00'
change: -0.38
average_change: -0.02
change_rate: -0.0
unit_of_measurement: °C
friendly_name: stats_temperature_salon
icon: mdi:calculator

while in core-2021.12.0, the attributes are:

state_class: measurement
age_coverage_ratio: 0.97
buffer_usage_ratio: 0.54
source_value_valid: true
unit_of_measurement: °C
icon: mdi:calculator
friendly_name: stats_temperature_salon

I don’t know if this is a bug or a desired feature … In that case, how do I get the min_value, max_value, …?

Thank you.

2 Likes

I have the same problem. Have read the breaking changes in this release but can’t find anything related to the statistics sensor.

1 Like

Thank you. I’ve just reported there.

Got mine working again. A change in how the statistics sensor works:

1 Like

Thank you!

I’ll change my sensors then. the problem is that in this way I need three times more sensors, as I use mean, min_value and max_value from each sensor.

Can you give an config example how to get the value_max from a sensor?
I realy do not understand how it works now or how to create new sensors for attributes that i have on statistics sensors.

Here it is:

sensor:
  - platform: statistics
    name: temperature_entrance_hall_max
    entity_id: sensor.sonoff_a48000c2_temperature
    state_characteristic: value_max
    max_age:
      hours: 24
    sampling_size: 50
3 Likes

For whoever ends up here. All changes are covered in the documentation article.

I have the same setup, where you able to fix this? Or did you set it up as three different sensors?

You now need three different sensors. One for each statistical value.

1 Like

Ok, thanks for letting me know. :slight_smile: