This commit is contained in:
2025-05-26 21:04:42 -05:00
parent b9b6a3c561
commit 6347d3be6c
2 changed files with 10 additions and 12 deletions

View File

@@ -679,7 +679,7 @@ CHECKTEMPSENSOR(){
TIMEOUT=0
temp_h=0
temp_f=''
if [ "${PW_SENSOR_TYPE[${1}]}" == "mqtt" ]; then
if [ "${mqtt_conn}" != "" ] && [ "${PW_SENSOR_TYPE[${1}]}" == "mqtt" ]; then
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
echo ${mqtt_message} | cut -d':' -f 7 | cut -d',' -f 1 | read temp_h
@@ -952,7 +952,7 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
fi
temp_f=''
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "mqtt" ]; then
if [ "${mqtt_conn}" != "" ] && [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "mqtt" ]; then
mqtt_message=`${mqtt_conn} -t tele/${SENSOR}/SENSOR -C 1`
echo ${mqtt_message} | cut -d':' -f 7 | cut -d',' -f 1 | read temp_h
echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
@@ -1030,6 +1030,9 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
if ! temp_c=$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${PW_REMOTE_SENSORS[${SENSORa}]} cat /sys/bus/w1/devices/${PW_SENSOR_DEVICEID[${SENSORa}]}/w1_slave | tail -n1 | cut -d "=" -f2) ; then TIMEOUT=1; fi
[ "${temp_c}" != "" ] && temp_c=$(echo "scale=2; ${temp_c}/1000" | bc)
temp_h=''
else
temp_c=''
fi
@@ -1602,7 +1605,7 @@ SENDTEMP(){
GAUGESH="'F"
fi
[ "${last_sensor}" != "" ] && [ "${last_sensor%%-*}" != "${SENSOR%%-*}" ] && echo
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "mqtt" ]; then
if [ "${mqtt_conn}" != "" ] && [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "mqtt" ]; then
mqtt_message=`${mqtt_conn} -t tele/${SENSORa}/SENSOR -C 1`
echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c