Update temp.inc.sh
This commit is contained in:
@@ -157,43 +157,7 @@ CHECKTEMP(){
|
|||||||
echo -en "${spca}"
|
echo -en "${spca}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${DETAILS} -eq 1 ]; then
|
|
||||||
DIVIDER . white ${PRI_WIDTH}
|
|
||||||
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"))
|
|
||||||
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}+(${PW_TEMPIND_DIFF}*2)") < ${temp_f}") -eq 1 ]; then
|
|
||||||
lclr="${idsCL[LightRed]}"
|
|
||||||
lico="\u25B2"
|
|
||||||
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}-(${PW_TEMPIND_DIFF}*2)")") -eq 1 ]; then
|
|
||||||
lclr="${idsCL[LightGreen]}"
|
|
||||||
lico="\u25BC"
|
|
||||||
elif [ $(bc -l <<< "${temp_f} < ${OLD_temp_f}") -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_f}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; ((c++)); done
|
|
||||||
echo -e "${lclr}~${M}m ago - ${lclr}${lico}${spc}${OLD_temp_f}${GAUGESH}"
|
|
||||||
done
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
else
|
||||||
temp_f_disp=" "
|
temp_f_disp=" "
|
||||||
@@ -253,6 +217,44 @@ CHECKTEMP(){
|
|||||||
echo -e "${idsCL[Default]}"
|
echo -e "${idsCL[Default]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ${DETAILS} -eq 1 ] && [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ] && [ "${temp_f}" != "timeout" ] && [ "${temp_f}" != "offline" ]; then
|
||||||
|
DIVIDER . white ${PRI_WIDTH}
|
||||||
|
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"))
|
||||||
|
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}+(${PW_TEMPIND_DIFF}*2)") < ${temp_f}") -eq 1 ]; then
|
||||||
|
lclr="${idsCL[LightRed]}"
|
||||||
|
lico="\u25B2"
|
||||||
|
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}-(${PW_TEMPIND_DIFF}*2)")") -eq 1 ]; then
|
||||||
|
lclr="${idsCL[LightGreen]}"
|
||||||
|
lico="\u25BC"
|
||||||
|
elif [ $(bc -l <<< "${temp_f} < ${OLD_temp_f}") -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_f}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; ((c++)); done
|
||||||
|
echo -e "${lclr}~${M}m ago - ${lclr}${lico}${spc}${OLD_temp_f}${GAUGESH}"
|
||||||
|
done
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${temp_h}" != "" ] && [ "${temp_h}" != "0" ]; then
|
if [ "${temp_h}" != "" ] && [ "${temp_h}" != "0" ]; then
|
||||||
echo -en "${idsCL[White]}|-- ${idsCL[Cyan]}Humidity ${idsCL[LightCyan]}$(ROUND_NUMBER ${temp_h} 2)%"
|
echo -en "${idsCL[White]}|-- ${idsCL[Cyan]}Humidity ${idsCL[LightCyan]}$(ROUND_NUMBER ${temp_h} 2)%"
|
||||||
if [ "${avgdays}" != "noavg" ]; then
|
if [ "${avgdays}" != "noavg" ]; then
|
||||||
@@ -262,7 +264,7 @@ CHECKTEMP(){
|
|||||||
fi
|
fi
|
||||||
echo -e "${idsCL[Default]}"
|
echo -e "${idsCL[Default]}"
|
||||||
|
|
||||||
if [ ${DETAILS} -eq 1 ]; then
|
if [ ${DETAILS} -eq 1 ] && [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ]; then
|
||||||
DIVIDER . lightCyan ${PRI_WIDTH}
|
DIVIDER . lightCyan ${PRI_WIDTH}
|
||||||
for M in 15 30 60 120; do
|
for M in 15 30 60 120; do
|
||||||
lico=" "
|
lico=" "
|
||||||
|
|||||||
Reference in New Issue
Block a user