Closed ProBackup-nl closed 2 years ago
I think you overestimate the accuracy of the sensors, I don't expect them to provide good results up to decimal points. But the result page will probably look better with this patch, so let's have it :)
It's not the need for the exact value. On the other hand having 2 or 3 of 3 sensors with value 3, then you start wondering which one is higher and which one is lower. I am not happy with my own solution, maybe try half or quarter values: ½ or ¼, ½, ¾. Less is more, I would try to implement the "½" range solution, thus > 0,25 and < 0,75 will show suffix "½".
Code is not tested and my PHP is rusty. I'm not sure whether between the "}" and the echo statement, a semicolon should be inserted or not. if ($averages['values']['pm25'] < 10) { $precision = 1; } else { $precision = 0; };