Update temp.inc.sh

This commit is contained in:
2023-12-29 21:07:19 -06:00
parent 7374271dd3
commit 68cb89254a

View File

@@ -623,26 +623,18 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
#### LOGGING OF SERVERROOM SENSOR DIFFERENCE
if [ "${SENSOR}" == "ServerRoomLA-Probe" ]; then
echo -en "PRobe found - "
if [ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.log.sr.difference)) -ge 300 ]; then
echo -en "logs good - "
if [ "${temp_f}" != "" ] && [ -f ${PW_TMPFOLDER}/.serveroomth ]; then
echo -en "temp good"
if [ "${temp_f}" != "" ] && [ -f ${PW_TMPFOLDER}/.serverroomth ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.serverroomth)) -lt 60 ]; then
[ ! -f ${PW_TMPFOLDER}/.log.sr.difference ] && touch ${PW_TMPFOLDER}/.log.sr.difference
temp_difference=$(bc <<< "scale=2; $(cat ${PW_TMPFOLDER}/.serveroomth)-${temp_f}")
# (( $(bc <<<"${temp_difference} < 0") )) && temp_difference=`echo "scale=2; ${temp_difference} * -1" | bc`
# echo "$(date "+%Y-%m-%d %H:%M:%S")~${temp_difference}" >> ${PW_TMPFOLDER}/.log.sr.difference
echo "[$(date +'%Y-%m-%d %H:%M:%S')] ${temp_f} - $(cat ${PW_TMPFOLDER}/.serveroomth) = ${temp_difference}"
rm -f ${PW_TMPFOLDER}/.serveroomth
else
echo "temp not good (${temp_f} - ${ServerRoomTH})"
echo "$(date "+%Y-%m-%d %H:%M:%S")~${temp_difference}" >> ${PW_TMPFOLDER}/.log.sr.difference
# echo "[$(date +'%Y-%m-%d %H:%M:%S')] ${temp_f} - $(cat ${PW_TMPFOLDER}/.serveroomth) = ${temp_difference}"
rm -f ${PW_TMPFOLDER}/.serverroomth
fi
else
echo "logs not good"
fi
elif [ "${SENSOR}" == "ServerRoomTH" ]; then
echo ${temp_f} > ${PW_TMPFOLDER}/.serveroomth
echo "srth found - ${ServerRoomTH}"
echo ${temp_f} > ${PW_TMPFOLDER}/.serverroomth
fi
###################