Update powerwall.sh

This commit is contained in:
2023-05-15 09:01:29 -05:00
parent 0f2db6d84c
commit 2a07c7d85e

View File

@@ -89,6 +89,8 @@ CHECKTEMP_SERVICE(){
temp_h=''
fi
datetime=`date +'%Y-%m-%d %H:%M:%S'`
errtime=$(expr `date +%s` - $(stat -c %Y ${logtemp}))
[ $errtime -ge 20 ] && relog=1 || relog=0
if [ "$temp_c" != "null" ] && [ "$temp_c" != "" ]; then
temp_f=`echo "scale=2; $temp_c*1.8 + 32" | bc`
@@ -146,8 +148,7 @@ Shutting down system servers!!" 1
echo -e "($datetime) - ${SENSOR} - ${temp_f}'F - Service Startup - NORMAL TEMP" >> ${logtemp}
fi
last_temp[${SENSOR}]=1
errtime=$(expr `date +%s` - $(stat -c %Y ${logtemp}))
[ $errtime -ge 20 ] && echo "($datetime) - ${SENSOR} - ${temp_f}F - Normal Temp" >> ${logtemp}
[ $relog -eq 1 ] && echo "($datetime) - ${SENSOR} - ${temp_f}F - Normal Temp" >> ${logtemp}
fi
if [ "${temp_h}" != "" ]; then
QRY="USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`, \`hum\`) VALUES ('${SENSOR_ID[${SENSOR}]}','${datetime}','${temp_f}','${temp_h}')"