From 81d1186d4c68e465bb38f8924058fda856836f89 Mon Sep 17 00:00:00 2001 From: Jon Ziebell Date: Mon, 20 Jun 2022 21:43:01 -0400 Subject: [PATCH] Quick fix for IAQ/VOC readings going outside of acceptable range. --- api/runtime.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/api/runtime.php b/api/runtime.php index 11a9d39..3c3d867 100644 --- a/api/runtime.php +++ b/api/runtime.php @@ -789,13 +789,25 @@ class runtime extends cora\api { $datas[$sensor['sensor_id']]['air_pressure'] = $value; break; case 'airQuality': - $datas[$sensor['sensor_id']]['air_quality'] = $value; + // Apparently this value can get larger than 255. Temporary + // fix until I can rebuild this table. Max I saw: 256 + if($value > 255) { + $datas[$sensor['sensor_id']]['air_quality'] = null; + } else { + $datas[$sensor['sensor_id']]['air_quality'] = $value; + } break; case 'airQualityAccuracy': $datas[$sensor['sensor_id']]['air_quality_accuracy'] = $value; break; case 'vocPPM': - $datas[$sensor['sensor_id']]['voc_concentration'] = $value; + // Apparently this value can get larger than 65535. Temporary + // fix until I can rebuild this table. Max I saw: 120071 + if($value > 65535) { + $datas[$sensor['sensor_id']]['voc_concentration'] = null; + } else { + $datas[$sensor['sensor_id']]['voc_concentration'] = $value; + } break; case 'co2PPM': $datas[$sensor['sensor_id']]['co2_concentration'] = $value;