From eef503ba3177a8f7a974a631de7c4f71bc94598f Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 26 Dec 2023 14:56:21 -0600 Subject: [PATCH] update --- defaults.inc | 2 +- inc/temp.inc.sh | 36 +++++++++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/defaults.inc b/defaults.inc index 5e012e47..ee85818e 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,5 +1,5 @@ -VERS='2.5.60-12262023' +VERS='2.5.61-12262023' noheader=' update service dailytemp confsync ' diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index cc5e9326..6eaf3aa4 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -131,7 +131,6 @@ CHECKTEMPSENSOR(){ 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) if [ "${temp_c}" != "" ]; then @@ -327,9 +326,14 @@ CHECKTEMP_SERVICE(){ temp_h=$(echo ${INFO} | jq -r '.device0 .obs[].humidity') elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "system" ]; then - temp_c=$(vcgencmd measure_temp) - temp_c=${temp_c%\'*}; temp_c=${temp_c#*=} - temp_h='' + if [[ "${1}" = *"CPU"* ]]; then + temp_c=$(vcgencmd measure_temp) + temp_c=${temp_c%\'*}; temp_c=${temp_c#*=} + temp_h='' + elif [[ "${1}" = *"FAN"* ]]; then + temp_c=$(cat /sys/class/hwmon/hwmon2/fan1_input) + temp_h='' + fi elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "remotesystem" ]; then temp_c=$(ssh root@${PW_REMOTE_SENSORS[${SENSOR}]} vcgencmd measure_temp) @@ -364,8 +368,20 @@ CHECKTEMP_SERVICE(){ logtemp=${PW_LOGFOLDER}/log-temp-${SENSOR} if [ "${temp_c}" != "null" ] && [ "${temp_c}" != "" ]; then - [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "cpu" ] && GAUGE="CPU-USAGE" || GAUGE="TEMP" - [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "cpu" ] && GAUGESH='%' || GAUGESH="'F" + if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "cpu" ]; then + GAUGE="CPU-USAGE" + elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "system" ] && [[ "${SENSORa}" = *"FAN"* ]]; then + GAUGE="RPM" + else + GAUGE="TEMP" + fi + if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "cpu" ]; then + GAUGESH='%' + elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "system" ] && [[ "${SENSORa}" = *"FAN"* ]]; then + GAUGESH="'RPM" + else + GAUGESH="'F" + fi [ -f ${PW_TMPFOLDER}/${SENSOR}.* ] && rm -f ${PW_TMPFOLDER}/${SENSOR}.* if [ -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ]; then SENDNOTICE "${SENSOR} Data" "${SENSOR} is reporting data again" @@ -377,7 +393,13 @@ CHECKTEMP_SERVICE(){ if [ "${SENSOR}" == "ServerRoomTH" ]; then temp_f=`echo "scale=2; ${temp_c}*1.8+32+${PW_ServerRoomTH_Dev}" | bc` else - [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "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[${SENSOR}]}" == "cpu" ]; then + temp_f=$(echo "scale=2; $temp_c/1" | bc -l) + elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "system" ] && [[ "${SENSORa}" = *"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