Is this what average step should look like?

I have an ecowitt compatible weather station, it calculates UV index, which is an integer from 0. However, that value can jump up and down a bit, so I’d like to have an average taken over the last 30 minutes. I tried to do that by setting up a statistics helper. The helper takes the UV index from the weather station as input, uses the step_linear method, and has a max age of 30 minutes. The precision is set to a whole number, no decimal places.

The chart below shows the average in blue, and the source in gold.

To my understanding, the blue line should not step up to 3 at 11:27. As I understand the scenario, this function is essentially calculating the average height of the graph for the last 30 minutes. Given that the graph was at 3 for only 3 minutes, the average should stay below 2.5. But maybe I’m missing something, or maybe I’ve misconfigured something.

Can anyone shed light on what’s going on? Thanks in advance for any input you can offer.

I got a similar result yesterday, it seemed to jump up too soon. I’ve tried now adding an average_linear statistic as well, to see how that behaves. I also enabled the “keep last measurement” option, as otherwise I was getting periods of “unavailable” when the source data didn’t change. But now the two lines don’t show up on the same chart, so it’s slightly harder to compare.

Looks like the issue might have been not having the “keep last value” setting enabled. Now it seems a lot more sensible. I still don’t understand that chart above, it seems like the average rises before the underlying metric, but maybe it’s being rounded in a way I don’t get, or the history is somehow recorded out of sync with how it happened.