The routine starts with the last (latest) entry, and works backwards for upto 24 hrs (todays worth).
Yes the routine could be expanded to cope with say a years worth of data, but there is no guarantee that an on-line request would be a complete or meaningful record. Plus no ones had a Watson for a year yet
Your own records highlight what seems to be a recuring Watson problem. signal 'drop-out at 20:10 and 20:15.
I may have to rewrite the code. The inbuilt php 'Max' function regards --- as a low value - no problem, but it is also true for the 'Min' function - that is why your Min. temp value of --- (no signal) is regarded as valid !
I may have to go back to real maths and compare throuhout the various arrays.
Most important thing - do you think it's useful, or will it never see the light of day ?