diff --git a/defaults.inc b/defaults.inc index d5400d4d..835f6b35 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERS='2.6.64-03162024' +VERS='2.6.65-03162024' noheader=' update service dailytemp confsync -r -report ' diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index c74df3bb..eef89628 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -914,6 +914,16 @@ Previous Temp: ${last_temp}${GAUGESH}" 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}')" else [ "${temp_f}" != "32.00" ]; 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 + touch ${PW_TMPFOLDER}/${SENSOR}-error.reading + elif [ ! -f ${PW_TMPFOLDER}/${SENSOR}.disable ] && (([ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.reading)) -ge 60 ]) || ([ -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.sent)) -ge $(echo "scale=0; ${PW_RENOTIFY_TIMEOUT}*60" | bc) ])); then + touch ${PW_TMPFOLDER}/${SENSOR}-error.sent + SENDNOTICE "${SENSOR} Sensor ERROR" "ERROR reading sensor data" 1 + echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSOR} Sensor - ERROR reading sensor data" >> ${logtemp} + fi fi ${mysql_conn} -e "${QRY}" # if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ]; then