Update power.inc.sh

This commit is contained in:
2024-02-14 22:49:22 -06:00
parent 8f7d751a5b
commit 363a5ed348

View File

@@ -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