This commit is contained in:
2023-05-15 09:24:39 -05:00
parent 4362ce7539
commit c3cfcecd2f
2 changed files with 11 additions and 6 deletions

View File

@@ -77,9 +77,13 @@ CHECKTEMP_SERVICE(){
cw=20
declare -A last_temp
while true; do
errtime=$(expr `date +%s` - $(stat -c %Y ${logtemp}))
[ $errtime -ge 3600 ] && relog=1 || relog=0
for SENSOR in ${!SENSOR_ID[@]}; do
logtemp=${LOGFOLDER}/log-temp-${SENSOR}
[ ! -f ${logtemp} ] && touch ${logtemp}
errtime=$(expr `date +%s` - $(stat -c %Y ${logtemp}))
[ $errtime -ge 3600 ] && relog=1 || relog=0
if [ "${SENSOR_TYPE[${SENSOR}]}" == "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