How to create and update array which is restored after reboot

I’m looking to hold information about average warm up times for each room in my house according to the temperature outside, based on historical averages, so at any point I can work out when I need to start heating each room.

Each time a room heats up, I want to log the outside temperature, the start temperature, the target temperature and the time taken to get from the start temperature to the target temperature. Then I locate the relevant position in the array for the room and outside temperature, before incrementing the count of times the room has been heated, and adding the time taken to the total time.

For example the temperature outside is 6 degrees Celsius, it takes half an hour to heat up the kitchen from 13 to 18 degrees, therefore it takes 180 seconds to heat up by half a degree. I’ve already logged 9 occasions of the kitchen heating up when it’s 6 degrees outside and the total time of all those 9 occasions is 1580 seconds. Adding my new log will bring the total count to 10 and the total time to 1760 seconds.
It’s 6 degrees again, and I now need to warm up the kitchen for 6am from 14 degrees, so I take the average half degree warm up time of 176, multiply it by 8 to get 1408 seconds - therefore I need to kick the heating in at 5:36am in order to get it to 18 degrees for 6am.

Now I’ve explained the use case, here’s what I can’t work out - how to hold and manipulate the data to support this. I come from a MultiValue background where a 3 dimensional array is child’s play, but I can’t figure out how to do it in Home Assistant - especially when ensuring that it persists regardless of any reboots. I’ve been reading around about lists, templates, global variables etc…, but haven’t managed to make sense of it!

I’d be grateful for any pointers please.