Statistic entities - Seems I made a mistake

Using the wizard for the first time, I’ve created a statistic helper, but it is not doing, what I had in mind.

I was expecting that it shows me “the average temperature” in my room. But it seems that what I’ve gotten out of the documentation is wrong.

How would such an entity look like, if it should tell me the average temperature of the last 4 hours and fill a diagram containing values of the last week.

If you want a rolling 4 hour average you should use 4 hours as your max age. AFAIK there is no way to make the Statistics integration back-populate the recorder with past values, you just have to let it run and you will eventually have the data to “fill a diagram of the last week”.

Thanks a lot for your answer. I guess, I explained it in a wrong way.

I’ve created this entity roughly a day ago and the result is this:

But the temperature was not always in between 26,2 and 26,5. Within the last 24h it looked like this:

My goal would be to get an average value for each 4h, so that I can see, the mean temperature from 0 to 4h was 12,34°C, from 4-8 it was like …
It would also be even nicer, if I would only consider values from 7h in the morning until 7 in the evening.

The overall result should be something like:

  • I can see that during summer, this room has an average temperature of X in the morning and in the afternoon it is like Y.

But the linear average of all the readings over that time was between 26,2 and 26,5.

For a rolling average of the last 4 hours you need to change the max_age to 4 hours, as previously stated. If you want the average from 0:00-4:00 etc, you just poll the linear average sensor at the top of every 4th hour. This can be done with a trigger-based template sensor.

There are a number of other tools such as InfluxDB and Grafana that offer more options in terms of statistical analysis and data representation as well as custom cards like ApexChart Card that can access the HA database.

Thanks a lot for your answer.

At first glance, I did not see that the average might have been correct. But now, having both charts roughly aligned, you might be right.

All values are stored in an Influx db and I already have graphs showing charts, but also here my knowledge is rather limited.
I’ll check the ApexChart card as well - didn’t know this one either.