From 75021fb701670c927a644c7a9ef51af647abbdf7 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 17 Dec 2023 11:24:33 -0600 Subject: [PATCH] Update temp.inc.sh --- inc/temp.inc.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index 5a93ac4d..72766e15 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -453,6 +453,8 @@ Previous Temp: ${last_temp[${SENSOR//-/}]}${GAUGESH}" wait=$(echo "scale=0; ${PW_MYSQL_LOG_INTERVAL_NORMAL}*60" | bc) fi + [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ] && temp_probe_f=$(bc <<< "scale=1; ${temp_probe_c}*1.8+32") + if [ "${PW_SENSOR_ID[${SENSORa}]}" != "" ] && [ ${lastinsert} -ge ${wait} ]; then if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then entityid=($(${mysql_conn} -e "SELECT id FROM servermonitor.entities WHERE BINARY name='${vSENSOR// /_}' AND sensorid='${PW_SENSOR_ID[${SENSORa}]}'")) @@ -473,7 +475,6 @@ Previous Temp: ${last_temp[${SENSOR//-/}]}${GAUGESH}" fi ${mysql_conn} -e "${QRY}" if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ]; then - temp_probe_f=$(bc <<< "scale=1; ${temp_probe_c}*1.8+32") ${mysql_conn} -e "USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`) VALUES ('${PW_SENSOR_ID["${SENSORa}-Probe"]}','$(date +'%Y-%m-%d %H:%M:%S')','${temp_probe_f}')" fi touch ${PW_TMPFOLDER}/${SENSOR}.insert @@ -481,6 +482,10 @@ Previous Temp: ${last_temp[${SENSOR//-/}]}${GAUGESH}" #### LOGGING OF SERVERROOM SENSOR DIFFERENCE if [ "${SENSOR}" == "ServerRoomLA" ]; then + echo "SET SR-LA: ${temp_probe_f}" + temp_difference=$(bc <<< "scale=1; ${temp_probe_f}-${ServerRoomTH}") + (( $(bc <<<"${temp_difference} < 0") )) && temp_difference=`echo "scale=1; ${temp_difference} * -1" | bc` + echo "DIFFERENCE: ${temp_difference}" if [ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.log.sr.difference)) -ge 300 ]; then if [ "${temp_probe_f}" != "" ] && [ "${ServerRoomTH}" != "" ]; then [ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] && touch ${PW_TMPFOLDER}/.log.sr.difference @@ -491,6 +496,7 @@ Previous Temp: ${last_temp[${SENSOR//-/}]}${GAUGESH}" fi elif [ "${SENSOR}" == "ServerRoomTH" ]; then ServerRoomTH=${temp_f} + echo "SET SR-TH: ${ServerRoomTH}" fi ###################