From 495fc823292a2359c602c2819edb3244880e258e Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Mon, 14 Aug 2023 19:50:56 -0500 Subject: [PATCH] Update powerwall.sh --- powerwall.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/powerwall.sh b/powerwall.sh index b9458368..0b5592d5 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -42,7 +42,7 @@ CHECKTEMP(){ temp_warn=$(echo ${sensordata} | cut -d'p' -f2 | awk '/ / {print $7}' | sed -e 's/C//g'); temp_warn=${temp_warn/ /} temp_crit=$(echo ${sensordata} | cut -d'p' -f2 | awk '/ / {print $4}' | sed -e 's/C//g'); temp_crit=${temp_crit/ /} - # reading=$(CHECKTEMPSENSOR ${SENSOR} ${temp_c} ${temp_warn} ${temp_crit}) + reading=$(CHECKTEMPSENSOR ${SENSOR} ${temp_c} ${temp_warn} ${temp_crit}) c=0; spc=''; spc1=`expr ${cw} - ${#vSENSOR} - 1`; until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done echo -e "${idsCL[LightCyan]} ${vSENSOR}${spc}${idsCL[Default]}: ${reading}" @@ -100,7 +100,7 @@ CHECKTEMPSENSOR(){ temp_crit=$(bc <<< "scale=2; ${4}*1.8+32") fi - + echo -en 1 if [ "${temp_c}" != "null" ] && [ "${temp_c}" != "" ]; then temp_f=`echo "scale=2; ${temp_c}*1.8 + 32" | bc` #echo "$temp_c -> $temp_f" @@ -116,7 +116,7 @@ CHECKTEMPSENSOR(){ else averagedisp="${idsCL[Green]}${average}'F" fi - + echo -en 2 if [ $(bc -l <<< "$temp_f >= $temp_warn") -eq 1 ] && [ $(bc -l <<< "$temp_f < $temp_crit") -eq 1 ]; then echo -en "${idsCL[Yellow]}WARNING (${spct}${temp_f}'F / ${spca}${averagedisp}${idsCL[Yellow]})${idsCL[Default]}" elif [ $(bc -l <<< "$temp_f >= $temp_crit") -eq 1 ]; then @@ -128,7 +128,9 @@ CHECKTEMPSENSOR(){ c=0; spc=''; spc1=`expr 10 - ${#tmp} - 2`; until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done [ ${#temp_warn} == 2 ] && spcw=' ' || spcw=' ' [ ${#temp_crit} == 2 ] && spcc=' ' || spcc=' ' + echo -en 3 echo -e "${spc}[${spcw}${idsCL[Green]}<=$(expr ${temp_warn} - 1)'F${idsCL[Default]} /${spcw}${idsCL[Yellow]}${temp_warn}'F${idsCL[Default]} /${spcc}${idsCL[Red]}${temp_crit}'F=>${idsCL[Default]} ]" + echo -en 4 fi } AVERAGETEMP(){