From a7da88846e909c71168fc2b4839f8ed53a88af65 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Mon, 4 Dec 2023 08:56:55 -0600 Subject: [PATCH] Update powerwall.sh --- powerwall.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/powerwall.sh b/powerwall.sh index 6ba91da0..eee43e49 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -64,7 +64,7 @@ CHECKTEMP(){ c=0; spc=''; spc1=`expr ${cw} - ${#sensorname} - 1`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done - [ "${avgdays}" != "noavg" ] && echo -en "${idsCL[LightCyan]} ${sensorname}${spc}${idsCL[Default]}: ${idsCL[LightYellow]}Calculating ${avgdays} Day average ... " + [ "${avgdays}" != "noavg" ] && echo -en "${idsCL[LightCyan]} ${sensorname}${spc}${idsCL[Default]}: ${idsCL[Yellow]}Calculating ${avgdays} Day average ... " reading=$(CHECKTEMPSENSOR ${SENSOR} ${temp_c} ${temp_warn} ${temp_crit} ${sensorname// /_} ${avgdays}) [ "${avgdays}" != "noavg" ] && echo -en "\r\033[K" echo -e "${idsCL[LightCyan]} ${sensorname}${spc}${idsCL[Default]}: ${reading}" @@ -87,9 +87,11 @@ CHECKTEMP(){ else [[ "${SENSOR}" == *"CPU-Usage"* ]] && echo -en "\033[1A" - [ "${avgdays}" != "noavg" ] && echo -en "${idsCL[Yellow]}Pulling data and calculating averages for '${SENSOR}' ... " || echo -en "${idsCL[Yellow]}Pulling data for '${SENSOR}' ... " - reading=$(CHECKTEMPSENSOR ${SENSOR} . . . . ${avgdays}) c=0; spc=''; spc1=`expr ${cw} - ${#SENSOR}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done + if [ "${avgdays}" != "noavg" ]; then + echo -en "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${idsCL[Yellow]}" + [ "${avgdays}" != "noavg" ] && echo -en "Pulling data and calculating ${avgdays} Day average ... " || echo -en "Pulling data ... " + reading=$(CHECKTEMPSENSOR ${SENSOR} . . . . ${avgdays}) echo -e "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}${idsST[Reset]}${spc}${idsCL[Default]}: ${reading}" # if [ "${SENSOR}" == "Powerwall-CPU" ] || [ "${SENSOR}" == "OctoPi-CPU" ]; then