From 4d97d69a6bcaed0eb5d7afba07f5f2c8af6aacf1 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 25 Feb 2024 15:13:51 -0600 Subject: [PATCH] update --- defaults.inc | 2 +- inc/temp.inc.sh | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/defaults.inc b/defaults.inc index 3dcc40f1..7ea51481 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERS='2.6.47-02242024' +VERS='2.6.50-02252024' noheader=' update service dailytemp confsync -r -report ' diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index 19db02e1..5af8df94 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -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 - IFS=: read -r temp_f hum <<< $(CHECKTEMPSENSOR ${SENSOR}); unset IFS + IFS=: read -r temp_f temp_h <<< $(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 - IFS=: read -r temp_f hum <<< $(CHECKTEMPSENSOR ${SENSOR}); unset IFS + IFS=: read -r temp_f temp_h <<< $(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,13 +339,13 @@ CHECKTEMP(){ CHECKTEMPSENSOR(){ TIMEOUT=0 - hum=0 + temp_h=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 elif [ "${PW_SENSOR_TYPE[${1}]}" == "tuya" ]; then - IFS=: read -r temp_c hum <<< $(GET_TUYA_TEMP ${1}); unset IFS + IFS=: read -r temp_c temp_h <<< $(GET_TUYA_TEMP ${1}); unset IFS elif [ "${PW_SENSOR_TYPE[${1}]}" == "lacrosse" ]; then if ! INFO=$(curl -m 8 -s --get -d "deviceid=${PW_SENSOR_DEVICEID[${SENSOR}]}" -d "limit=1" -d "metric=1" -d "timezone=2" https://decent-destiny-704.appspot.com/laxservices/device_info.php) ; then TIMEOUT=1; fi @@ -409,7 +409,7 @@ CHECKTEMPSENSOR(){ # echo "HERE: '${temp_c}' -> '${temp_f}'" # echo -en "" - echo "${temp_f}:${hum}" + echo "${temp_f}:${temp_h}" elif [ ${TIMEOUT} -eq 1 ]; then # echo -en "${idsCL[Yellow]}Sensor Timeout${idsCL[Default]}" @@ -588,6 +588,9 @@ CHECKTEMP_SERVICE_RUNSENSOR(){ mqtt_message=`${mqtt_conn} -t tele/${SENSOR}/SENSOR -C 1` echo ${mqtt_message} | cut -d':' -f 7 | cut -d',' -f 1 | read temp_h echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c + + elif [ "${PW_SENSOR_TYPE[${1}]}" == "tuya" ]; then + IFS=: read -r temp_c temp_h <<< $(GET_TUYA_TEMP ${1}); unset IFS elif [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ]; then INFO=$(curl -m 5 -s --get -d "deviceid=${PW_SENSOR_DEVICEID[${SENSOR}]}" -d "limit=1" -d "metric=1" -d "timezone=2" https://decent-destiny-704.appspot.com/laxservices/device_info.php | jq)