Make sure your recorder has seven days of data.
Then I guess you could use a statistics sensor on the temperature (probably make a template sensor for this to extract the temperature).
I think the easiest is to make two statistics sensors, one with seven days and one with five days.
The statistics sensor should then display the average temperature the last seven days.
So with that you should be able to template it:
The problem is that I can’t just use an average sensor and set it to the last 5/7 days if I understand it correctly.
Each daily average needs to be within the value and not just the average of all the days, for example winter:
day 1 average: -5
day 2 average: -6
day 3 average: -4
day 4 average: +2
day 5 average; -4
That gives an average for the 5 days at -3,4 but since day 4 “resets” the counter of 5 consecutive days it fails and it would still be autumn.
Right…
The statistics senor wont work in that case.
I can’t see a way to do it easily in Home Assistant.
There is a way to do it in Node Red.
Since I don’t have an outdoor temperature sensor I just took an indoor entity, but the same principle applies.
Same thing here in Finland, meteorological season is based on temps and as such, it may even alternate at some stages between say spring and summer. My intention is to use season for seelecting heating control automation.
Just installed HACS Average sensor ( GitHub - Limych/ha-average: Average Sensor for Home Assistant) in order to make seven day temp average sensor and then going to template output four seasons. This average is supposed to get around some limitations in temp handling according to documentation.