State_attr on statistics sensor always return None

Hi, i want to use statistics sensor to generate min/max over a time period. But i can not evaluate the min and max. All help i’ve found point towards attribute value_max and value_min.

But querying this (or old notation max_value) will always return None

What i’ve found is that this is part of sensor characteristics but i’ve found no way to extract it?!

e.g. age_coverage works fine

this is my sensor:

sensor:
  - platform: statistics
    name: "Kitchen power mean over last 15 minutes"
    entity_id: sensor.kuche_shelly25_1_active_power_b
    state_characteristic: mean
    max_age:
      minutes: 15
    sampling_size: 100

According to the documentation, value_max and value_min aren’t attributes but the value you assign to the state_characteristic option in order to configure the sensor’s behavior.

In your example, you assigned mean to state_characteristic. Set it to value_max if you want the sensor to report the maximum value.

Because that’s documented as being one of the sensor’s attributes.

So I need to create two Sensors, one with max and one with min.

Then this Information is obsolete right?

That post is two years old. The Statistics integration was modified since then and its documentation was updated to reflect those changes.

I’ve cautioned other users that when searching for answers they should look for recent posts. Given Home Assistant’s constant and rapid evolution, anything over a year old might be outdated