From 39dbeb942cb38b70fddc7c12ad02ee76980df1bc Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Wed, 16 Aug 2023 17:59:23 -0500 Subject: [PATCH] Update powerwall.sh --- powerwall.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/powerwall.sh b/powerwall.sh index 2532929c..414206d0 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -192,9 +192,9 @@ CHECKTEMP_SERVICE(){ elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then temp_c=$(echo ${SENSOR} | cut -d'p' -f2 | awk '/ / {print $2}' | sed -e 's/C//g'); temp_c=${temp_c/ /} - temp_warn=$(echo ${SENSOR} | cut -d'p' -f2 | awk '/ / {print $7}' | sed -e 's/C//g'); #temp_warn=${temp_warn/ /} - temp_crit=$(echo ${SENSOR} | cut -d'p' -f2 | awk '/ / {print $4}' | sed -e 's/C//g'); #temp_crit=${temp_crit/ /} - temp_crit_sys=$(echo ${SENSOR} | cut -d'p' -f2 | awk '/ / {print $4}' | sed -e 's/C//g'); #temp_crit_sys=${temp_crit_sys/ /} + temp_warn=$(echo ${SENSOR} | cut -d'p' -f2 | awk '/ / {print $7}' | sed -e 's/C//g'); + temp_crit=$(echo ${SENSOR} | cut -d'p' -f2 | awk '/ / {print $4}' | sed -e 's/C//g'); + temp_crit_sys=$(echo ${SENSOR} | cut -d'p' -f2 | awk '/ / {print $4}' | sed -e 's/C//g'); temp_warn=`echo $(bc <<< "scale=2; (${temp_warn/ /}*1.8+32)/1") | awk '{print int($1+0.5)}'` temp_crit=`echo $(bc <<< "scale=2; (${temp_crit/ /}*1.8+32)/1") | awk '{print int($1+0.5)}'` @@ -203,9 +203,7 @@ CHECKTEMP_SERVICE(){ temp_h='' vSENSOR=$(echo ${SENSOR} | cut -d'T' -f1 | xargs) SENSOR="${SENSORa}-${vSENSOR// /_}" - - echo "HERE: ${SENSOR} - ${temp_c} - ${temp_warn} - ${temp_crit} - ${temp_crit_sys}" - + fi @@ -214,12 +212,14 @@ CHECKTEMP_SERVICE(){ if [ "$temp_c" != "null" ] && [ "$temp_c" != "" ]; then if [ -f ${PW_TMPFOLDER}/${SENSOR}-error.reading ]; then SENDNOTICE "${SENSOR} Data" "${SENSOR} is reporting data again" - echo "($datetime) - ${SENSOR} - ${SENSOR} is reporting data again" >> ${logtemp} + echo "($datetime) - ${SENSOR} - Sensor is reporting data again" >> ${logtemp} rm -f ${PW_TMPFOLDER}/${SENSOR}-error.reading fi temp_f=`echo "scale=2; $temp_c*1.8 + 32" | bc` - if [ "${PW_SENSOR_TYPE[${SENSOR}]}" != "esxi" ]; then + echo "HERE: ${SENSOR} - ${temp_f} - ${temp_warn} - ${temp_crit} - ${temp_crit_sys}" + + if [ "${PW_SENSOR_TYPE[${SENSORa}]}" != "esxi" ]; then echo ${PW_TEMP_THRESHOLDS[${SENSOR}]} | cut -d',' -f 1 | read temp_warn echo ${PW_TEMP_THRESHOLDS[${SENSOR}]} | cut -d',' -f 2 | read temp_crit echo ${PW_TEMP_THRESHOLDS[${SENSOR}]} | cut -d',' -f 3 | read temp_crit_sys