Update powerwall.sh

This commit is contained in:
2023-12-03 17:13:00 -06:00
parent 6a09701c92
commit 785d3d0df3

View File

@@ -110,7 +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
echo "${temp_warn} - ${temp_crit}"
if [ "${6}" != "noavg" ] && [ "${PW_SENSOR_TYPE[${1}]}" != "cpu" ]; then
[ "${6}" != "" ] && [[ "${6}" =~ ^[0-9]+$ ]] && avgdays=${6} || avgdays=3
if [ "${PW_SENSOR_TYPE[${1}]}" != "esxi" ]; then
@@ -150,13 +150,11 @@ CHECKTEMPSENSOR(){
echo "WOW2"
temp_c=$(ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${PW_REMOTE_SENSORS[${1}]} "/opt/idssys/defaults/get-data.sh cpu-usage")
fi
echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn
echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 2 | read temp_crit
fi
if [ "${temp_c}" != "null" ] && [ "${temp_c}" != "" ]; then
[ "${PW_SENSOR_TYPE[${1}]}" != "cpu" ] && temp_f=$(bc <<< "scale=1; ${temp_c}*1.8+32") || temp_f=${temp_c}
# echo "HERE: '${temp_c}' -> '${temp_f}'"
echo "HERE: '${temp_c}' -> '${temp_f}'"
echo -en ""
c=0; spct=''; spc1=`expr 6 - ${#temp_f}`; until [ ${c} = ${spc1} ]; do spct="${spct} "; c=`expr ${c} + 1`; done