Update powerwall.sh

This commit is contained in:
2023-07-06 18:22:59 -05:00
parent ed00eef94a
commit cbdc60641e

View File

@@ -228,6 +228,39 @@ NORMAL TEMP: ${temp_f}'F"
done # &
}
DAILYTEMP(){
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 / 3DayAVG ${idsCL[Green]}normal${idsCL[Default]} /${idsCL[Yellow]}warning${idsCL[Default]}/ ${idsCL[Red]}critical${idsCL[Default]}"
DIVIDER . yellow 85
if [ "${1}" != "" ]; then
# reading=$(CHECKTEMPSENSOR ${1})
# c=0; spc=''; spc1=`expr ${cw} - ${#1}`; until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
# echo -e "${idsCL[LightCyan]}${1}${spc}${idsCL[Default]}: ${reading}"
for SENSOR in ${!SENSOR_ID[@]}; do
if [[ "${SENSOR}" = *"${1}"* ]]; then
echo -en "${idsCL[Yellow]}Pulling data and calculating averages for '${SENSOR}' ..."
reading=$(CHECKTEMPSENSOR ${SENSOR})
c=0; spc=''; spc1=`expr ${cw} - ${#SENSOR}`; until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
echo -e "\r\033[K${idsCL[LightCyan]}${SENSOR}${spc}${idsCL[Default]}: ${reading}"
fi
done
else
for SENSOR in ${!SENSOR_ID[@]}; do
echo -en "${idsCL[Yellow]}Pulling data and calculating averages for '${SENSOR}' ..."
reading=$(CHECKTEMPSENSOR ${SENSOR})
c=0; spc=''; spc1=`expr ${cw} - ${#SENSOR}`; until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
echo -e "\r\033[K${idsCL[LightCyan]}${SENSOR}${spc}${idsCL[Default]}: ${reading}"
done
fi
[ "${action}" != "" ] && echo
}
CHECKPOWER(){
INVSTATSINFO=$(curl -s "http://10.10.0.61/stats.json")
INPUTV=`echo ${INVSTATSINFO} | jq '.inputs .inV'`
@@ -735,6 +768,7 @@ fi
[ "${2}" == "status" ] && CHECK_SERVICES
;;
checktemp) CHECKTEMP ${2};;
dailytemp) DAILYTEMP;;
checkpower) CHECKPOWER;;
test) CHECKTEMP ${2} ${3};;
iscsi-vm-shutdown) ISCSIVMSHUTDOWN;;