Update temp.inc.sh

This commit is contained in:
2024-05-09 22:38:39 -05:00
parent 539a2f3530
commit d736d2543d

View File

@@ -261,6 +261,44 @@ CHECKTEMP(){
echo -en "${idsCL[White]}|-- ${idsCL[Cyan]}Humidity ${idsCL[LightCyan]}$(ROUND_NUMBER ${temp_h} 2)%${idsCL[Default]} / ${idsCL[LightCyan]}$(ROUND_NUMBER ${average} 2)%"
fi
echo -e "${idsCL[Default]}"
if [ ${DETAILS} -eq 1 ]; then
DIVIDER . lightCyan ${PRI_WIDTH}
for M in 15 30 60 120; do
lico=" "
OLD_temp_h=($(${mysql_conn} -e "SELECT hum 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"))
OLD_temp_h=${OLD_temp_h[1]}
if [ "${OLD_temp_h}" != "" ]; then
if [ $(bc -l <<< "${temp_h} < $(echo "scale=2; ${OLD_temp_h}+${PW_TEMPIND_DIFF}" | bc)") -eq 1 ] && [ $(bc -l <<< "$(echo "scale=2; ${OLD_temp_h}-${PW_TEMPIND_DIFF}" | bc) < ${temp_h}") -eq 1 ]; then
lclr="${idsCL[White]}"
lico="\u23F9"
elif [ $(bc -l <<< "$(bc <<< "scale=2; ${OLD_temp_h}+(${PW_TEMPIND_DIFF}*2)") < ${temp_h}") -eq 1 ]; then
lclr="${idsCL[LightRed]}"
lico="\u25B2"
elif [ $(bc -l <<< "${OLD_temp_h} < ${temp_h}") -eq 1 ]; then
lclr="${idsCL[Magenta]}"
lico="\u25B2"
elif [ $(bc -l <<< "${temp_h} < $(bc <<< "scale=2; ${OLD_temp_h}-(${PW_TEMPIND_DIFF}*2)")") -eq 1 ]; then
lclr="${idsCL[LightGreen]}"
lico="\u25BC"
elif [ $(bc -l <<< "${temp_h} < ${OLD_temp_h}") -eq 1 ]; then
lclr="${idsCL[LightCyan]}"
lico="\u25BC"
else
lclr="${idsCL[Default]}"
fi
else
lclr="${idsCL[Default]}"
lico="\u22C5"
fi
([ "${temp_h}" != "" ] && [ "${temp_h}" != "0" ]) && echo -en "${idsCL[White]}| " || echo -n " "
echo -en "${idsCL[Default]} --{"
[ ${#M} -eq 2 ] && echo -n " "
c=0; spc=''; spc1=`expr 7 - ${#OLD_temp_h}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; ((c++)); done
echo -e "${lclr}~${M}m ago - ${lclr}${lico}${spc}${OLD_temp_h}%"
done
fi
fi
echo