diff --git a/inc/power.inc.sh b/inc/power.inc.sh index b0170bad..2ac079e4 100644 --- a/inc/power.inc.sh +++ b/inc/power.inc.sh @@ -18,11 +18,11 @@ AVERAGEPOWER(){ total_amp=0 total_watt=0 while IFS=$'\t' read date amp watt ;do - if [ "${amp}" != "" ] && [ "${amp}" != "NULL" ]; then + if [ "${amp}" != "" ] && [ "${amp}" != "0" ] && [ "${amp}" != "NULL" ] && [[ "${amp}" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then total_amp=$(bc <<< "scale=2; ${total_amp}+${amp}") ((logsfound_amp++)) fi - if [ "${watt}" != "" ] && [ "${watt}" != "NULL" ]; then + if [ "${watt}" != "" ] && [ "${watt}" != "0" ] && [ "${watt}" != "NULL" ] && [[ "${watt}" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then total_watt=$(bc <<< "scale=2; ${total_watt}+${watt}") ((logsfound_watt++)) fi