Update powerwall.sh

This commit is contained in:
2023-08-14 19:50:56 -05:00
parent 127d559496
commit 495fc82329

View File

@@ -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(){