Update temp.inc.sh

This commit is contained in:
2025-05-19 22:07:46 -05:00
parent 85148c2e07
commit 4751199009

View File

@@ -30,7 +30,7 @@ START_POWERWALL_FAN(){
fi
}
CHECKTEMP(){
# start=`date +%s`
start=`date +%s`
cw=25
cdt=$(date +%Y-%m-%d-%H-%M-%S)
REPORT=0; DETAILS=0; exclude=''; drives=0
@@ -140,31 +140,31 @@ CHECKTEMP(){
[ ${REPORT} -eq 0 ] && echo -en "\r\033[K"
echo -en "${idsCL[White]}${idsST[Bold]}${SENSOR_DESC}${idsST[Reset]}${spc}${idsCL[Default]}: ${reading} "
# if [ ${DETAILS} -eq 0 ] && [ "${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 $(expr ${R} + 1) MINUTE) AND date <= DATE_SUB(NOW(), INTERVAL $(expr ${R} - 6) 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})/1" | bc)") -eq 1 ] && [ $(bc -l <<< "$(echo "scale=2; ${OLD_temp_f[1]}-${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
# echo -en "${idsCL[LightRed]}\u25B2 "
# elif [ $(bc -l <<< "${OLD_temp_f[1]} < ${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
# echo -en "${idsCL[LightGreen]}\u25BC "
# elif [ $(bc -l <<< "${temp_f} < ${OLD_temp_f[1]}") -eq 1 ]; then
# echo -en "${idsCL[LightCyan]}\u25BC "
# else
# echo -en " "
# fi
# else
# echo -en "${idsCL[Default]}\u22C5 "
# fi
# done
# elif [ "${avgdays}" = "noavg" ]; then
if [ ${DETAILS} -eq 0 ] && [ "${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 $(expr ${R} + 1) MINUTE) AND date <= DATE_SUB(NOW(), INTERVAL $(expr ${R} - 6) 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})/1" | bc)") -eq 1 ] && [ $(bc -l <<< "$(echo "scale=2; ${OLD_temp_f[1]}-${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
echo -en "${idsCL[LightRed]}\u25B2 "
elif [ $(bc -l <<< "${OLD_temp_f[1]} < ${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
echo -en "${idsCL[LightGreen]}\u25BC "
elif [ $(bc -l <<< "${temp_f} < ${OLD_temp_f[1]}") -eq 1 ]; then
echo -en "${idsCL[LightCyan]}\u25BC "
else
echo -en " "
fi
else
echo -en "${idsCL[Default]}\u22C5 "
fi
done
elif [ "${avgdays}" = "noavg" ]; then
c=0; spca=''; until [ ${c} = ${#PW_TEMPIND_RANGE[@]} ]; do spca="${spca} "; ((c++)); done
echo -en "${spca}"
# fi
fi
@@ -655,7 +655,7 @@ CHECKTEMP(){
done
fi
rm -f ${PW_TMPFOLDER}/.local.fanspeed.*
# [ "${avgdays}" != "" ] && [ ${REPORT} -eq 0 ] && end=`date +%s`; runtime=$((end-start)); echo -e "${idsCL[Default]}runtime: ${runtime}s"
[ "${avgdays}" != "" ] && [ ${REPORT} -eq 0 ] && end=`date +%s`; runtime=$((end-start)); echo -e "${idsCL[Default]}runtime: ${runtime}s"
[ ${REPORT} -eq 0 ] && [ "${PW_ACTION}" != "" ] && echo -e "${idsCL[Default]}"
}