Update powerwall.sh

This commit is contained in:
2023-12-04 08:28:42 -06:00
parent 936a91b9e8
commit 89c8b617e9

View File

@@ -110,6 +110,7 @@ CHECKTEMP(){
CHECKTEMPSENSOR(){
echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn
echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 2 | read temp_crit
[ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ] && GAUGESH="'%" || GAUGESH="'F"
if [ "${6}" != "noavg" ]; then
[ "${6}" != "" ] && [[ "${6}" =~ ^[0-9]+$ ]] && avgdays=${6} || avgdays=3
@@ -170,24 +171,18 @@ CHECKTEMPSENSOR(){
fi
if [ $(bc -l <<< "${temp_f} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit}") -eq 1 ]; then
[ "${average}" != "" ] && echo -en "${idsCL[Yellow]}WARNING ${spct}${temp_f}'F /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Yellow]}WARNING ${spct}${temp_f}"
[ "${average}" != "" ] && echo -en "${idsCL[Yellow]}WARNING ${spct}${temp_f}${GAUGESH} /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Yellow]}WARNING ${spct}${temp_f}${GAUGESH}${idsCL[Default]}"
elif [ $(bc -l <<< "${temp_f} >= ${temp_crit}") -eq 1 ]; then
[ "${average}" != "" ] && echo -en "${idsCL[Red]}CRITICAL${spct}${temp_f}'F /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Red]}CRITICAL${spct}${temp_f}"
[ "${average}" != "" ] && echo -en "${idsCL[Red]}CRITICAL${spct}${temp_f}${GAUGESH} /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Red]}CRITICAL${spct}${temp_f}${GAUGESH}${idsCL[Default]}"
else
[ "${average}" != "" ] && echo -en "${idsCL[Green]}Normal ${spct}${temp_f}'F /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Green]}Normal ${spct}${temp_f}"
[ "${average}" != "" ] && echo -en "${idsCL[Green]}Normal ${spct}${temp_f}${GAUGESH} /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Green]}Normal ${spct}${temp_f}${GAUGESH}${idsCL[Default]}"
fi
[ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ] && echo -en "%${idsCL[Default]}" || echo -en "'F${idsCL[Default]}"
tmp="${spct}${temp_f}"
c=0; spc=''; spc1=`expr 10 - ${#tmp}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
[ ${#temp_warn} == 2 ] && spcw=' ' || spcw=' '
[ ${#temp_crit} == 2 ] && spcc=' ' || spcc=' '
if [ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ]; then
echo -e "${spc} [${spcw} ${idsCL[Yellow]}${temp_warn}%${idsCL[Default]} /${spcc} ${idsCL[Red]}${temp_crit}%=>${idsCL[Default]} ]"
else
echo -e "${spc}[${spcw}${idsCL[Yellow]}${temp_warn}'F${idsCL[Default]} /${spcc}${idsCL[Red]}${temp_crit}'F=>${idsCL[Default]} ]"
fi
echo -e "${spc}[${spcw}${idsCL[Yellow]}${temp_warn}${GAUGESH}${idsCL[Default]} /${spcc}${idsCL[Red]}${temp_crit}${GAUGESH}=>${idsCL[Default]} ]"
fi
}
AVERAGETEMP(){