diff --git a/defaults.inc b/defaults.inc index 7de1e6ac..1bba96e7 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,5 +1,5 @@ -VERS='2.5.162-01262024' +VERS='2.5.163-01272024' noheader=' update service dailytemp confsync -r -report ' diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index 1bd830c5..0dcec055 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -171,13 +171,14 @@ CHECKTEMPSENSOR(){ else average='' fi - + + TIMEOUT=0 if [ "${PW_SENSOR_TYPE[${1}]}" == "mqtt" ]; then - mqtt_message=`${mqtt_conn} -t tele/${1}/SENSOR -C 1` + if ! mqtt_message=`${mqtt_conn} -t tele/${1}/SENSOR -C 1` ; then TIMEOUT=1; fi echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c elif [ "${PW_SENSOR_TYPE[${1}]}" == "lacrosse" ]; then - INFO=$(curl -m 7 -s --get -d "deviceid=${PW_LACROSSE_ID[${SENSOR}]}" -d "limit=1" -d "metric=1" -d "timezone=2" https://decent-destiny-704.appspot.com/laxservices/device_info.php) + if ! INFO=$(curl -m 7 -s --get -d "deviceid=${PW_LACROSSE_ID[${SENSOR}]}" -d "limit=1" -d "metric=1" -d "timezone=2" https://decent-destiny-704.appspot.com/laxservices/device_info.php) ; then TIMEOUT=1; fi if [ "${INFO}" != "" ]; then if [[ "${1}" = *"-Probe" ]]; then temp_c=`IDS_NUMBER_FORMAT $(echo ${INFO} | jq -r '.device0 .obs[].probe_temp') 2 yes` @@ -196,7 +197,7 @@ CHECKTEMPSENSOR(){ temp_c=$(cat /sys/class/hwmon/hwmon2/fan1_input) fi elif [ "${PW_SENSOR_TYPE[${1}]}" == "remotesystem" ]; then - temp_c=$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${PW_REMOTE_SENSORS[${1}]} vcgencmd measure_temp) + if ! temp_c=$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${PW_REMOTE_SENSORS[${1}]} vcgencmd measure_temp) ; then TIMEOUT=1; fi if [ "${temp_c}" != "" ]; then temp_c=${temp_c%\'*}; temp_c=${temp_c#*=} @@ -207,7 +208,6 @@ CHECKTEMPSENSOR(){ temp_crit=`echo $(bc <<< "scale=2; (${4}*1.8+32)/1") | awk '{print int($1+0.5)}'` elif [ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ]; then - TIMEOUT=0 if [ "${1}" == "Powerwall-CPU-Usage" ]; then if ! temp_c=$(awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else print ($2+$4-u1) * 100 / (t-t1) "%"; }' <(grep 'cpu ' /proc/stat) <(sleep 1;grep 'cpu ' /proc/stat) | sed -e 's/%//g') ; then TIMEOUT=1