Update power.inc.sh

This commit is contained in:
2024-01-13 10:51:00 -06:00
parent 63b1bae7d5
commit 36695e9323

View File

@@ -8,11 +8,11 @@ AVERAGEPOWER(){
total_watt=0
while IFS=$'\t' read date amp watt ;do
echo "HERE: '${amp}'"
if [ "${amp}" != "" ] && [ "${amp}" != "null" ]; then
if [ "${amp}" != "" ] && [ "${amp}" != "NULL" ]; then
total_amp=$(bc <<< "scale=2; ${total_amp}+${amp}")
((logsfound_amp++))
fi
if [ "${watt}" != "" ] && [ "${watt}" != "null" ]; then
if [ "${watt}" != "" ] && [ "${watt}" != "NULL" ]; then
total_watt=$(bc <<< "scale=2; ${total_watt}+${watt}")
((logsfound_watt++))
fi
@@ -344,8 +344,8 @@ CHECKPOWER(){
# if [ ${HOST_WATTS} -gt 0 ]; then
if [ "${avgdays}" != "" ] && [ ${HOST_WATTS} -ne -2 ] && [ "${SENSOR}" != "iDS-vMS-Host6" ]; then
echo -en "${idsCL[LightYellow]} Calculating average ...${idsCL[Default]}"
AVERAGEPOWER ${PW_POWERSENSOR_ID[${SENSOR}]} ${avgdays} both
# average=$(AVERAGEPOWER ${PW_POWERSENSOR_ID[${SENSOR}]} ${avgdays} both)
# AVERAGEPOWER ${PW_POWERSENSOR_ID[${SENSOR}]} ${avgdays} both
average=$(AVERAGEPOWER ${PW_POWERSENSOR_ID[${SENSOR}]} ${avgdays} both)
average_amp=$(echo ${average} | cut -d'~' -f 1)
average_watt=$(echo ${average} | cut -d'~' -f 2)
average_disp="${idsCL[LightYellow]} ${average_amp}'amps - `IDS_NUMBER_FORMAT ${average_watt} 0`'watts"