This commit is contained in:
2023-12-26 13:37:52 -06:00
parent 4c290ba17e
commit a62f20f42a
2 changed files with 18 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
VERS='2.5.57-12242023'
VERS='2.5.60-12262023'
noheader=' update service dailytemp confsync '

View File

@@ -92,8 +92,10 @@ CHECKTEMP(){
}
CHECKTEMPSENSOR(){
echo ${PW_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn
echo ${PW_THRESHOLDS[${1}]} | cut -d',' -f 2 | read temp_crit
if [ "${PW_THRESHOLDS[${1}]}" != "" ]; then
echo ${PW_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn
echo ${PW_THRESHOLDS[${1}]} | cut -d',' -f 2 | read temp_crit
fi
[ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ] && GAUGESH="'%" || GAUGESH="'F"
if [ "${6}" != "noavg" ]; then
@@ -117,8 +119,12 @@ CHECKTEMPSENSOR(){
temp_probe_c=`IDS_NUMBER_FORMAT $(echo ${INFO} | jq -r '.device0 .obs[].probe_temp') 2 yes`
elif [ "${PW_SENSOR_TYPE[${1}]}" == "system" ]; then
temp_c=$(vcgencmd measure_temp)
temp_c=${temp_c%\'*}; temp_c=${temp_c#*=}
if [[ "${1}" = %"CPU"% ]]; then
temp_c=$(vcgencmd measure_temp)
temp_c=${temp_c%\'*}; temp_c=${temp_c#*=}
elif [[ "${1}" = %"FAN"% ]]; then
temp_c=$(cat /sys/class/hwmon/hwmon2/fan1_input)
fi
elif [ "${PW_SENSOR_TYPE[${1}]}" == "remotesystem" ]; then
temp_c=$(ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${PW_REMOTE_SENSORS[${1}]} vcgencmd measure_temp)
@@ -143,7 +149,13 @@ CHECKTEMPSENSOR(){
if [ "${1}" == "ServerRoomTH" ]; then
temp_f=`echo "scale=2; ${temp_c}*1.8+32+${PW_ServerRoomTH_Dev}" | bc`
else
[ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ] && temp_f=$(echo "scale=2; $temp_c/1" | bc -l) || temp_f=$(bc <<< "scale=2; ${temp_c}*1.8+32")
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")
fi
(( $(bc <<<"${temp_f} < 1") )) && [[ "${temp_f}" = *"."* ]] && temp_f="0${temp_f}"
fi
# echo "HERE: '${temp_c}' -> '${temp_f}'"