function fnChkSensorValue($intSensorID, $intValue) { # OBTAIN SENSOR TYPE INFO $intSensorTypeID = fnGetSensorType($intSensorID); # LOOK UP MIN AND MAX VALUES FOR THAT SENSOR (NOT LOOKING AT TYPE YET...) # IF NULL IT WILL CHECK AND OBTAIN SENSOR TYPE DATAS $intMinVal = fnChkSensorTH($intSensorID, 0); $intMaxVal = fnChkSensorTH($intSensorID, 1); echo "<br>intMinVal=" . $intMinVal . " and intMaxVal= " . $intMaxVal; if ($intValue >= $intMinVal && $intValue <= $intMaxVal) { #!!! Value is larger than the minimum andsmaller than the max -- ITS IN BOUNDS! fnLogClimateData($intSensorID, $intValue); } else { #!!! IF OUT OF BOUNDS CREATE THRESHOLDEVENT -- IF NOT LOG DATA PER NORMAL fnThresholdEvt($intSensorID, $intValue); fnLogClimateData($intSensorID, $intValue); } }
<?php include 'base.php'; $intThresholdEventID = $_GET['evtid']; $intSensorID = fnGetEventData($intThresholdEventID, 1); $intMinValTH = fnChkSensorTH($intSensorID, 0); $intMaxValTH = fnChkSensorTH($intSensorID, 1); $intMedValTH = round(($intMaxValTH - $intMinValTH) / 2, 2) + $intMinValTH; $intRelayID = fnGetRelayNum($intSensorID); $intOrigValue = fnGetEventData($intThresholdEventID, 3); echo "<br>" . $intSensorID . " - " . $intMinValTH . " - " . $intMaxValTH . " - " . $intMedValTH . " - " . $intOrigValue; echo "<br><br>!!! - fnGetEventData({$intThresholdEventID}, 1): " . $intSensorID; echo "<br>Relay " . $intRelayID;