Update powerwall.sh

This commit is contained in:
2023-05-27 17:26:20 -05:00
parent 7a8de3499e
commit eae38d4673

View File

@@ -19,7 +19,7 @@ CHECKTEMP(){
cw=20;
echo
# echo -e "${idsCL[Yellow]}Sensor Temperature(s) ${idsCL[Green]}normal${idsCL[Default]} /${idsCL[Yellow]}warning${idsCL[Default]}/ ${idsCL[Red]}critical${idsCL[Default]}"
echo -e "${idsCL[Cyan]}Sensor Temperature(s) Current / 7DayAVG ${idsCL[Green]}normal${idsCL[Default]} /${idsCL[Yellow]}warning${idsCL[Default]}/ ${idsCL[Red]}critical${idsCL[Default]}"
echo -e "${idsCL[Cyan]}Sensor Temperature(s) Current / 7DayAVG ${idsCL[Green]}normal${idsCL[Default]} /${idsCL[Yellow]}warning${idsCL[Default]}/ ${idsCL[Red]}critical${idsCL[Default]}"
DIVIDER . yellow 85
if [ "${1}" != "" ]; then
# reading=$(CHECKTEMPSENSOR ${1})
@@ -63,13 +63,15 @@ CHECKTEMPSENSOR(){
if [ "$temp_c" != "null" ] && [ "$temp_c" != "" ]; then
temp_f=`echo "scale=2; $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
if [ $(bc -l <<< "$temp_f >= $temp_warn") -eq 1 ] && [ $(bc -l <<< "$temp_f < $temp_crit") -eq 1 ]; then
echo -en "${idsCL[Yellow]}WARNING (${temp_f}'F / ${average}'F)${idsCL[Default]}"
echo -en "${idsCL[Yellow]}WARNING (${spct}${temp_f}'F / ${spca}${average}'F)${idsCL[Default]}"
elif [ $(bc -l <<< "$temp_f >= $temp_crit") -eq 1 ]; then
echo -en "${idsCL[Red]}CRITICAL (${temp_f}'F / ${average}'F)${idsCL[Default]}"
echo -en "${idsCL[Red]}CRITICAL (${spct}${temp_f}'F / ${spca}${average}'F)${idsCL[Default]}"
else
echo -en "${idsCL[Green]}Normal (${temp_f}'F / ${average}'F)${idsCL[Default]}"
echo -en "${idsCL[Green]}Normal (${spct}${temp_f}'F / ${spca}${average}'F)${idsCL[Default]}"
fi
c=0; spc=''; spc1=`expr 10 - ${#temp_f} - 2`; until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done