diff --git a/powerwall.sh b/powerwall.sh index 5e3104df..b884fec8 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -152,8 +152,8 @@ CHECKTEMPSENSOR(){ 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 -en "" + # 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 if [ "${average}" != "" ] && [ "${PW_SENSOR_TYPE[${1}]}" != "cpu" ]; then @@ -169,13 +169,13 @@ CHECKTEMPSENSOR(){ fi fi - # if [ $(bc -l <<< "${temp_f} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit}") -eq 1 ]; then - # ([ "${average}" != "" ] && [ "${PW_SENSOR_TYPE[${1}]}" != "cpu" ]) && echo -en "${idsCL[Yellow]}WARNING ${spct}${temp_f}'F /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Yellow]}WARNING ${spct}${temp_f}" - # elif [ $(bc -l <<< "${temp_f} >= ${temp_crit}") -eq 1 ]; then - # ([ "${average}" != "" ] && [ "${PW_SENSOR_TYPE[${1}]}" != "cpu" ]) && echo -en "${idsCL[Red]}CRITICAL${spct}${temp_f}'F /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Red]}CRITICAL${spct}${temp_f}" - # else - # ([ "${average}" != "" ] && [ "${PW_SENSOR_TYPE[${1}]}" != "cpu" ]) && echo -en "${idsCL[Green]}Normal ${spct}${temp_f}'F /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Green]}Normal ${spct}${temp_f}" - # fi + if [ $(bc -l <<< "${temp_f} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${temp_f} < ${temp_crit}") -eq 1 ]; then + ([ "${average}" != "" ] && [ "${PW_SENSOR_TYPE[${1}]}" != "cpu" ]) && echo -en "${idsCL[Yellow]}WARNING ${spct}${temp_f}'F /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Yellow]}WARNING ${spct}${temp_f}" + elif [ $(bc -l <<< "${temp_f} >= ${temp_crit}") -eq 1 ]; then + ([ "${average}" != "" ] && [ "${PW_SENSOR_TYPE[${1}]}" != "cpu" ]) && echo -en "${idsCL[Red]}CRITICAL${spct}${temp_f}'F /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Red]}CRITICAL${spct}${temp_f}" + else + ([ "${average}" != "" ] && [ "${PW_SENSOR_TYPE[${1}]}" != "cpu" ]) && echo -en "${idsCL[Green]}Normal ${spct}${temp_f}'F /${spca}${averagedisp}${idsCL[Default]}" || echo -en "${idsCL[Green]}Normal ${spct}${temp_f}" + fi [ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ] && echo -en "%${idsCL[Default]}" || echo -en "'F${idsCL[Default]}" tmp="${spct}${temp_f}"