Update powerwall.sh
This commit is contained in:
@@ -146,7 +146,7 @@ AVERAGETEMP(){
|
|||||||
CHECKTEMP_SERVICE(){
|
CHECKTEMP_SERVICE(){
|
||||||
cw=20
|
cw=20
|
||||||
declare -A last_temp
|
declare -A last_temp
|
||||||
# while true; do
|
while true; do
|
||||||
|
|
||||||
for SENSORa in ${!PW_SENSOR_ID[@]}; do
|
for SENSORa in ${!PW_SENSOR_ID[@]}; do
|
||||||
logtemp=${PW_LOGFOLDER}/log-temp-${SENSORa}
|
logtemp=${PW_LOGFOLDER}/log-temp-${SENSORa}
|
||||||
@@ -275,7 +275,7 @@ CHECKTEMP_SERVICE(){
|
|||||||
[ "$(compgen -G "${PW_FOLDER}/shutdown.*")" != "" ] && rm -f ${PW_FOLDER}/shutdown.*
|
[ "$(compgen -G "${PW_FOLDER}/shutdown.*")" != "" ] && rm -f ${PW_FOLDER}/shutdown.*
|
||||||
|
|
||||||
elif [ ${last_temp[${SENSOR}]} -eq 0 ]; then
|
elif [ ${last_temp[${SENSOR}]} -eq 0 ]; then
|
||||||
# SENDNOTICE "${SENSOR} TEMP NORMAL" "($datetime) Service Startup
|
SENDNOTICE "${SENSOR} TEMP NORMAL" "($datetime) Service Startup
|
||||||
# NORMAL TEMP: ${temp_f}'F"
|
# NORMAL TEMP: ${temp_f}'F"
|
||||||
echo -e "($datetime) - ${temp_f}'F - Service Startup - NORMAL TEMP" >> ${logtemp}
|
echo -e "($datetime) - ${temp_f}'F - Service Startup - NORMAL TEMP" >> ${logtemp}
|
||||||
echo -e "($datetime) - ${temp_f}'F - ${SENSOR} - Service Startup" >> ${PW_LOGFILE}
|
echo -e "($datetime) - ${temp_f}'F - ${SENSOR} - Service Startup" >> ${PW_LOGFILE}
|
||||||
@@ -301,8 +301,8 @@ CHECKTEMP_SERVICE(){
|
|||||||
else
|
else
|
||||||
QRY="USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`) VALUES ('${PW_SENSOR_ID[${SENSOR}]}','${datetime}','${temp_f}')"
|
QRY="USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`) VALUES ('${PW_SENSOR_ID[${SENSOR}]}','${datetime}','${temp_f}')"
|
||||||
fi
|
fi
|
||||||
# ${mysql_conn} -e "${QRY}"
|
${mysql_conn} -e "${QRY}"
|
||||||
# touch ${PW_TMPFOLDER}/${SENSOR}.insert
|
touch ${PW_TMPFOLDER}/${SENSOR}.insert
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.reading ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.reading)) -ge 1800 ]; then
|
if [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.reading ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.reading)) -ge 1800 ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user