From ad694dbfbfca0eb80c30dae35509c7fd122f5f5b Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Mon, 13 May 2024 17:24:09 -0500 Subject: [PATCH] Update temp.inc.sh --- inc/temp.inc.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index 864c00bf..dfe0a953 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -1200,7 +1200,7 @@ Previous Temp: ${last_temp}${GAUGESH}" wait=$(echo "scale=0; ${PW_MYSQL_LOG_INTERVAL_NORMAL}*60" | bc) fi - if [ "${PW_SENSOR_ID[${SENSORa}]}" != "" ] && [ ${lastinsert} -ge ${wait} ]; then + if [ "${PW_SENSOR_ID[${SENSORa}]}" != "" ] && [ ${lastinsert} -ge ${wait} ] && [ "${temp_f}" != "32.00" ] && [ "${temp_f}" != "35.60" ]; then if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then entityid=($(${mysql_conn} -e "SELECT id FROM servermonitor.entities WHERE BINARY name='${vSENSOR// /_}' AND sensorid='${PW_SENSOR_ID[${SENSORa}]}'")) if [ "${entityid[1]}" == "" ]; then @@ -1219,14 +1219,14 @@ Previous Temp: ${last_temp}${GAUGESH}" entityid=${entityid[1]} ${mysql_conn} -e "USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`entity\`, \`date\`, \`speed\`) VALUES ('${PW_SENSOR_ID[${SENSORa}]}','${entityid}','$(date +'%Y-%m-%d %H:%M:%S')','${FanSpeed}')" + fi elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "system" ] && [[ "${SENSORa}" = *"FAN"* ]]; then QRY="USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`speed\`) VALUES ('${PW_SENSOR_ID[${SENSORa}]}','$(date +'%Y-%m-%d %H:%M:%S')','${temp_c}')" + elif [ "${temp_h}" != "" ] && [ "${temp_h}" != "0" ]; then QRY="USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`, \`hum\`) VALUES ('${PW_SENSOR_ID[${SENSORa}]}','$(date +'%Y-%m-%d %H:%M:%S')','${temp_f}','${temp_h}')" - elif [ "${temp_f}" != "32.00" ] && [ "${temp_f}" != "35.60" ]; then - QRY="USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`) VALUES ('${PW_SENSOR_ID[${SENSORa}]}','$(date +'%Y-%m-%d %H:%M:%S')','${temp_f}')" - + elif [ "${SENSOR}" == "Powerwall-Switch" ]; then [ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ] && touch ${PW_TMPFOLDER}/${SENSOR}.down if [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.reading ]; then @@ -1237,6 +1237,10 @@ Previous Temp: ${last_temp}${GAUGESH}" echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSOR} Sensor - ERROR reading sensor data" >> ${logtemp} fi QRY="" + + else + QRY="USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`) VALUES ('${PW_SENSOR_ID[${SENSORa}]}','$(date +'%Y-%m-%d %H:%M:%S')','${temp_f}')" + fi if [ "${QRY}" != "" ]; then ${mysql_conn} -e "${QRY}"