From 96f885b0c069cf0be48a5324af0e55f0f8365d5e Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 17 Dec 2023 10:10:53 -0600 Subject: [PATCH] Update temp.inc.sh --- inc/temp.inc.sh | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index f33f7073..35eb1b1f 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -343,20 +343,6 @@ CHECKTEMP_SERVICE(){ (( $(bc <<<"${temp_f} < 1") )) && [[ "${temp_f}" = *"."* ]] && temp_f="0${temp_f}" fi - #### LOGGING OF SERVERROOM SENSOR DIFFERENCE - if [ "${SENSOR}" == "ServerRoomLA" ]; then - if [ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.log.sr.difference)) -ge 10 ]; then - [ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] && touch ${PW_TMPFOLDER}/.log.sr.difference - temp_difference=$(bc <<< "scale=1; ${temp_probe_f}-${ServerRoomTH}") - (( $(bc <<<"${temp_difference} < 0") )) && temp_difference=`echo "scale=1; ${temp_difference} * -1" | bc` - echo "HERE: ${temp_probe_f} - ${ServerRoomTH} = ${temp_difference}" - echo ${temp_difference} >> ${PW_TMPFOLDER}/.log.sr.difference - fi - elif [ "${SENSOR}" == "ServerRoomTH" ]; then - ServerRoomTH=${temp_f} - fi - ################### - # echo "HERE: [${SENSOR//-/}] - ${last_temp[${SENSOR//-/}]} - ${temp_c} - ${temp_f} - ${temp_warn} - ${temp_crit} - ${temp_crit_sys}" # [ ! "${temp_c}" ] || [ ! "${temp_f}" ] || [ ! "${temp_warn}" ] || [ ! "${temp_crit}" ] || [ ! "${temp_crit_sys}" ] && echo "VALUE NOT FOUND" @@ -492,6 +478,21 @@ Previous Temp: ${last_temp[${SENSOR//-/}]}${GAUGESH}" fi touch ${PW_TMPFOLDER}/${SENSOR}.insert fi + + #### LOGGING OF SERVERROOM SENSOR DIFFERENCE + if [ "${SENSOR}" == "ServerRoomLA" ]; then + if [ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.log.sr.difference)) -ge 10 ]; then + [ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] && touch ${PW_TMPFOLDER}/.log.sr.difference + temp_difference=$(bc <<< "scale=1; ${temp_probe_f}-${ServerRoomTH}") + (( $(bc <<<"${temp_difference} < 0") )) && temp_difference=`echo "scale=1; ${temp_difference} * -1" | bc` + echo "HERE: ${temp_probe_f} - ${ServerRoomTH} = ${temp_difference}" + echo ${temp_difference} >> ${PW_TMPFOLDER}/.log.sr.difference + fi + elif [ "${SENSOR}" == "ServerRoomTH" ]; then + ServerRoomTH=${temp_f} + fi + ################### + else if [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.reading ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.reading)) -ge 1800 ]; then SENDNOTICE "${SENSOR} Sensor ERROR" "ERROR reading sensor data" 1