Update temp.inc.sh

This commit is contained in:
2024-02-06 19:21:49 -06:00
parent f1e5312036
commit cafee7c0fe

View File

@@ -266,8 +266,8 @@ CHECKTEMPSENSOR(){
fi
elif [ "${PW_SENSOR_TYPE[${1}]}" == "esxi" ]; then
temp_c=${2}
temp_warn=`echo $(bc <<< "scale=2; (${3}*1.8+32)/1") | awk '{print int($1+0.5)}'`
temp_crit=`echo $(bc <<< "scale=2; (${4}*1.8+32)/1") | awk '{print int($1+0.5)}'`
temp_warn=`echo $(bc <<< "scale=2; ((${3}*(9/5))+32)/1") | awk '{print int($1+0.5)}'`
temp_crit=`echo $(bc <<< "scale=2; ((${4}*(9/5))+32)/1") | awk '{print int($1+0.5)}'`
elif [ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ]; then
if [ "${1}" == "Powerwall-CPU-Usage" ]; then
@@ -288,14 +288,14 @@ CHECKTEMPSENSOR(){
if [ "${temp_c}" != "null" ] && [ "${temp_c}" != "" ]; then
if [ "${1}" == "ServerRoomTH" ]; then
temp_f=`echo "scale=2; ${temp_c}*1.8+32+${PW_ServerRoomTH_Dev}" | bc`
temp_f=`echo "scale=2; (${temp_c}*(9/5))+32+${PW_ServerRoomTH_Dev}" | bc`
else
if [ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ]; then
temp_f=$(echo "scale=2; $temp_c/1" | bc -l)
elif [ "${PW_SENSOR_TYPE[${1}]}" == "system" ] && [[ "${1}" = *"FAN"* ]]; then
temp_f=${temp_c}
else
temp_f=$(bc <<< "scale=2; ${temp_c}*1.8+32")
temp_f=$(bc <<< "scale=2; (${temp_c}*(9/5))+32")
fi
(( $(bc <<<"${temp_f} < 1") )) && [[ "${temp_f}" = *"."* ]] && temp_f="0${temp_f}"
fi
@@ -614,14 +614,14 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
fi
if [ "${SENSOR}" == "ServerRoomTH" ]; then
temp_f=`echo "scale=2; ${temp_c}*1.8+32+${PW_ServerRoomTH_Dev}" | bc`
temp_f=`echo "scale=2; (${temp_c}*(9/5))+32+${PW_ServerRoomTH_Dev}" | bc`
else
if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "cpu" ]; then
temp_f=$(echo "scale=2; $temp_c/1" | bc -l)
elif [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]]; then
temp_f=${temp_c}
else
temp_f=$(bc <<< "scale=2; ${temp_c}*1.8+32")
temp_f=$(bc <<< "scale=2; (${temp_c}*(9/5))+32")
fi
(( $(bc <<<"${temp_f} < 1") )) && [[ "${temp_f}" = *"."* ]] && temp_f="0${temp_f}"
fi
@@ -1015,8 +1015,8 @@ SENDTEMP(){
fi
# elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then
# temp_c=${2}
# temp_warn=`echo $(bc <<< "scale=2; (${3}*1.8+32)/1") | awk '{print int($1+0.5)}'`
# temp_crit=`echo $(bc <<< "scale=2; (${4}*1.8+32)/1") | awk '{print int($1+0.5)}'`
# temp_warn=`echo $(bc <<< "scale=2; ((${3}*(9/5))+32)/1") | awk '{print int($1+0.5)}'`
# temp_crit=`echo $(bc <<< "scale=2; ((${4}*(9/5))+32)/1") | awk '{print int($1+0.5)}'`
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "cpu" ]; then
if [ "${SENSORa}" == "Powerwall-CPU-Usage" ]; then
@@ -1048,14 +1048,14 @@ SENDTEMP(){
c=0; spc=''; spc1=`expr ${cw} - ${#SENSOR}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
if [ "${temp_c}" != "null" ] && [ "${temp_c}" != "" ]; then
if [ "${SENSOR}" == "ServerRoomTH" ]; then
temp_f=`echo "scale=2; ${temp_c}*1.8+32+${PW_ServerRoomTH_Dev}" | bc`
temp_f=`echo "scale=2; (${temp_c}*(9/5))+32+${PW_ServerRoomTH_Dev}" | bc`
else
if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "cpu" ]; then
temp_f=$(echo "scale=2; $temp_c/1" | bc -l)
elif [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]]; then
temp_f=${temp_c}
else
temp_f=$(bc <<< "scale=2; ${temp_c}*1.8+32")
temp_f=$(bc <<< "scale=2; (${temp_c}*(9/5))+32")
fi
(( $(bc <<<"${temp_f} < 1") )) && [[ "${temp_f}" = *"."* ]] && temp_f="0${temp_f}"
fi