Update temp.inc.sh

This commit is contained in:
2024-02-25 15:06:40 -06:00
parent e39c6e417f
commit f4b7f159c7

View File

@@ -109,7 +109,7 @@ CHECKTEMP(){
c=0; spc=''; spc1=`expr ${cw} - ${#SENSOR}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
echo -en "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Pulling data ... "
if [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ]; then
temp_f=$(CHECKTEMPSENSOR ${SENSOR})
IFS=: read -r temp_f hum <<< $(CHECKTEMPSENSOR ${SENSOR}); unset IFS
if [ "${temp_f}" != "timeout" ] && [ "${temp_f}" != "offline" ]; then
[ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]] && temp_f_disp=$(IDS_NUMBER_FORMAT ${temp_f} 0) || temp_f_disp=${temp_f}
if [ $(bc -l <<< "${temp_f} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit}") -eq 1 ]; then
@@ -255,7 +255,7 @@ CHECKTEMP(){
temp_crit=$(snmpwalk -v 1 -c public -t 2 ${vHOSTiDRACIP} .1.3.6.1.4.1.674.10892.5.4.700.20.1.10.1.${t} -O vq | sed -e 's/"//g')
temp_crit=`echo "scale=1; ${temp_crit}/10" | bc`; temp_crit=`echo $(bc <<< "scale=2; ((${temp_crit}*(9/5))+32)/1") | awk '{print int($1+0.5)}'`
c=0; spc=''; spc1=`expr ${cw} - ${#sensorname} - 1`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
temp_f=$(CHECKTEMPSENSOR ${SENSOR})
IFS=: read -r temp_f hum <<< $(CHECKTEMPSENSOR ${SENSOR}); unset IFS
if [ $(bc -l <<< "${temp_f} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit}") -eq 1 ]; then
lclr="${idsCL[Yellow]}"
lmd="WARNING "
@@ -339,6 +339,7 @@ CHECKTEMP(){
CHECKTEMPSENSOR(){
TIMEOUT=0
hum=0
if [ "${PW_SENSOR_TYPE[${1}]}" == "mqtt" ]; then
if ! mqtt_message=`${mqtt_conn} -t tele/${1}/SENSOR -C 1` ; then TIMEOUT=1; fi
echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
@@ -408,7 +409,7 @@ CHECKTEMPSENSOR(){
# echo "HERE: '${temp_c}' -> '${temp_f}'"
# echo -en ""
echo ${temp_f}
echo "${temp_f}:${hum}"
elif [ ${TIMEOUT} -eq 1 ]; then
# echo -en "${idsCL[Yellow]}Sensor Timeout${idsCL[Default]}"