Update temp.inc.sh

This commit is contained in:
2024-04-29 09:44:37 -05:00
parent e2bccbd9f5
commit ec3eabd00e

View File

@@ -101,7 +101,6 @@ CHECKTEMP(){
RANGE_TEMPS["${R}-${lookup[2]}"]=${lookup[3]}
RANGE_TEMPS["${R}-${lookup[4]}"]=${lookup[5]}
done
echo "${RANGE_TEMPS[@]}"
fi
fi
@@ -153,17 +152,18 @@ CHECKTEMP(){
if [ "${avgdays}" = "noavg" ] && [[ "${SENSOR}" != *"FAN"* ]]; then
for R in ${PW_TEMPIND_RANGE[@]}; do
OLD_temp_f=($(${mysql_conn} -e "SELECT temp FROM servermonitor.sensor_data WHERE sensorid='${PW_SENSOR_ID[${SENSOR}]}' AND date >= DATE_SUB(NOW(), INTERVAL ${R} MINUTE) AND date <= DATE_SUB(NOW(), INTERVAL $(expr ${R} - 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=($(${mysql_conn} -e "SELECT temp FROM servermonitor.sensor_data WHERE sensorid='${PW_SENSOR_ID[${SENSOR}]}' AND date >= DATE_SUB(NOW(), INTERVAL ${R} MINUTE) AND date <= DATE_SUB(NOW(), INTERVAL $(expr ${R} - 7) MINUTE) ORDER BY date ASC LIMIT 1"))
sensorid=${PW_SENSOR_ID[${SENSOR}]}
if [ "${RANGE_TEMPS["${R}-${sensorid}"]}" != "" ]; then
if [ $(bc -l <<< "${temp_f} < $(echo "scale=2; ${RANGE_TEMPS["${R}-${sensorid}"]}+${PW_TEMPIND_DIFF}" | bc)") -eq 1 ] && [ $(bc -l <<< "$(echo "scale=2; ${RANGE_TEMPS["${R}-${sensorid}"]}-${PW_TEMPIND_DIFF}" | bc) < ${temp_f}") -eq 1 ]; then
echo -en "${idsCL[White]}\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; ${RANGE_TEMPS["${R}-${sensorid}"]}+(${PW_TEMPIND_DIFF}*2)") < ${temp_f}") -eq 1 ]; then
echo -en "${idsCL[LightRed]}\u25B2 "
elif [ $(bc -l <<< "${OLD_temp_f[1]} < ${temp_f}") -eq 1 ]; then
elif [ $(bc -l <<< "${RANGE_TEMPS["${R}-${sensorid}"]} < ${temp_f}") -eq 1 ]; then
echo -en "${idsCL[Magenta]}\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; ${RANGE_TEMPS["${R}-${sensorid}"]}-(${PW_TEMPIND_DIFF}*2)")") -eq 1 ]; then
echo -en "${idsCL[LightGreen]}\u25BC "
elif [ $(bc -l <<< "${temp_f} < ${OLD_temp_f[1]}") -eq 1 ]; then
elif [ $(bc -l <<< "${temp_f} < ${RANGE_TEMPS["${R}-${sensorid}"]}") -eq 1 ]; then
echo -en "${idsCL[LightCyan]}\u25BC "
else
echo -en " "