Update powerwall.sh

This commit is contained in:
2023-08-14 21:52:41 -05:00
parent eb9d09cb44
commit b6c1518693

View File

@@ -94,7 +94,7 @@ CHECKTEMPSENSOR(){
fi
elif [ "${PW_SENSOR_TYPE[${1}]}" == "esxi" ]; then
temp_c=${2}
temp_f=$(bc <<< "scale=2; ${temp_c}*1.8+32")
temp_f=$(bc <<< "scale=1; ${temp_c}*1.8+32")
# temp_warn=$(bc <<< "scale=2; (${3}*1.8+32)/1")
temp_warn=`echo $(bc <<< "scale=2; (${3}*1.8+32)/1") | awk '{print int($1+0.5)}'`
# temp_crit=$(bc <<< "scale=2; (${4}*1.8+32)/1")
@@ -103,7 +103,7 @@ CHECKTEMPSENSOR(){
fi
if [ "${temp_c}" != "null" ] && [ "${temp_c}" != "" ]; then
temp_f=`echo "scale=2; ${temp_c}*1.8 + 32" | bc`
temp_f=`echo "scale=1; ${temp_c}*1.8 + 32" | bc`
#echo "$temp_c -> $temp_f"
c=0; spct=''; spc1=`expr 6 - ${#temp_f}`; until [ $c = ${spc1} ]; do spct="${spct} "; c=`expr ${c} + 1`; done
c=0; spca=''; spc1=`expr 6 - ${#average}`; until [ $c = ${spc1} ]; do spca="${spca} "; c=`expr ${c} + 1`; done
@@ -127,10 +127,9 @@ CHECKTEMPSENSOR(){
fi
tmp="${spct}${temp_f}"
c=0; spc=''; spc1=`expr 8 - ${#tmp}`; until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
[ ${#temp_warn} == 2 ] && spcw=' ' || spcw=' '
# [ ${#temp_warn} == 2 ] && spcw=' ' || spcw=' '
[ ${#temp_crit} == 2 ] && spcc=' ' || spcc=' '
tt=$(bc <<< "scale=2; ${temp_warn} - 1")
echo -e "${spc}[${spcw}${idsCL[Green]}<===${idsCL[Default]} /${spcw}${idsCL[Yellow]}${temp_warn}'F${idsCL[Default]} /${spcc}${idsCL[Red]}${temp_crit}'F=>${idsCL[Default]} ]"
echo -e "${spc}[ ${idsCL[Green]}<===${idsCL[Default]} /${spcw}${idsCL[Yellow]}${temp_warn}'F${idsCL[Default]} /${spcc}${idsCL[Red]}${temp_crit}'F=>${idsCL[Default]} ]"
fi
}
AVERAGETEMP(){