Update temp.inc.sh

This commit is contained in:
2024-05-09 21:15:55 -05:00
parent 63807f93b2
commit f2887f7e55

View File

@@ -218,20 +218,21 @@ CHECKTEMP(){
for M in 15 30 60 120; do
lico=" "
OLD_temp_f=($(${mysql_conn} -e "SELECT temp FROM servermonitor.sensor_data WHERE sensorid='${PW_SENSOR_ID[${SENSOR}]}' AND date >= DATE_SUB(NOW(), INTERVAL ${M} MINUTE) AND date <= DATE_SUB(NOW(), INTERVAL $(expr ${M} - 7) MINUTE) ORDER BY date ASC LIMIT 1"))
if [ "${OLD_temp_f[1]}" != "" ]; then
if [ $(bc -l <<< "${temp_f} < $(echo "scale=2; ${OLD_temp_f[1]}+${PW_TEMPIND_DIFF}" | bc)") -eq 1 ] && [ $(bc -l <<< "$(echo "scale=2; ${OLD_temp_f[1]}-${PW_TEMPIND_DIFF}" | bc) < ${temp_f}") -eq 1 ]; then
OLD_temp_f=${OLD_temp_f[1]}
if [ "${OLD_temp_f}" != "" ]; then
if [ $(bc -l <<< "${temp_f} < $(echo "scale=2; ${OLD_temp_f}+${PW_TEMPIND_DIFF}" | bc)") -eq 1 ] && [ $(bc -l <<< "$(echo "scale=2; ${OLD_temp_f}-${PW_TEMPIND_DIFF}" | bc) < ${temp_f}") -eq 1 ]; then
lclr="${idsCL[White]}"
lico="\u23F9"
elif [ $(bc -l <<< "$(bc <<< "scale=2; ${OLD_temp_f[1]}+(${PW_TEMPIND_DIFF}*2)") < ${temp_f}") -eq 1 ]; then
elif [ $(bc -l <<< "$(bc <<< "scale=2; ${OLD_temp_f}+(${PW_TEMPIND_DIFF}*2)") < ${temp_f}") -eq 1 ]; then
lclr="${idsCL[LightRed]}"
lico="\u25B2"
elif [ $(bc -l <<< "${OLD_temp_f[1]} < ${temp_f}") -eq 1 ]; then
elif [ $(bc -l <<< "${OLD_temp_f} < ${temp_f}") -eq 1 ]; then
lclr="${idsCL[Magenta]}"
lico="\u25B2"
elif [ $(bc -l <<< "${temp_f} < $(bc <<< "scale=2; ${OLD_temp_f[1]}-(${PW_TEMPIND_DIFF}*2)")") -eq 1 ]; then
elif [ $(bc -l <<< "${temp_f} < $(bc <<< "scale=2; ${OLD_temp_f}-(${PW_TEMPIND_DIFF}*2)")") -eq 1 ]; then
lclr="${idsCL[LightGreen]}"
lico="\u25BC"
elif [ $(bc -l <<< "${temp_f} < ${OLD_temp_f[1]}") -eq 1 ]; then
elif [ $(bc -l <<< "${temp_f} < ${OLD_temp_f}") -eq 1 ]; then
lclr="${idsCL[LightCyan]}"
lico="\u25BC"
else
@@ -243,8 +244,8 @@ CHECKTEMP(){
fi
([ "${temp_h}" != "" ] && [ "${temp_h}" != "0" ]) && echo -en "${idsCL[White]}| " || echo -n " "
[ ${#M} -eq 2 ] && echo -n " "
c=0; spc=''; spc1=`expr 4 - ${#OLD_temp_f[1]}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; ((c++)); done
echo -e "${idsCL[White]} ${lclr}${M} Mins Ago ${lclr} ${lico}${spc}${OLD_temp_f[1]}${GAUGESH}"
c=0; spc=''; spc1=`expr 4 - ${#OLD_temp_f}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; ((c++)); done
echo -e "${idsCL[White]} ${lclr}${M} Mins Ago ${lclr} ${lico}${spc}${OLD_temp_f}${GAUGESH}"
done
fi