Update powerwall.sh
This commit is contained in:
@@ -220,7 +220,7 @@ CHECKTEMP_SERVICE(){
|
|||||||
else
|
else
|
||||||
SENSORS_CHECK=(${SENSORa})
|
SENSORS_CHECK=(${SENSORa})
|
||||||
fi
|
fi
|
||||||
|
if [ "${SENSORS_CHECK}" != "" ]; then
|
||||||
for SENSOR in "${SENSORS_CHECK[@]}"; do
|
for SENSOR in "${SENSORS_CHECK[@]}"; do
|
||||||
|
|
||||||
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "mqtt" ]; then
|
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "mqtt" ]; then
|
||||||
@@ -296,7 +296,7 @@ CHECKTEMP_SERVICE(){
|
|||||||
touch ${PW_TMPFOLDER}/temp.crit
|
touch ${PW_TMPFOLDER}/temp.crit
|
||||||
if [ $temp_diff -gt 1 ] || [ "${last_temp[${SENSOR}]}" = "1" ]; then
|
if [ $temp_diff -gt 1 ] || [ "${last_temp[${SENSOR}]}" = "1" ]; then
|
||||||
SENDNOTICE "${SENSOR} TEMP CRITICAL" "($datetime) CRITICAL TEMP: ${temp_f}'F - (Difference of ${temp_diff}')
|
SENDNOTICE "${SENSOR} TEMP CRITICAL" "($datetime) CRITICAL TEMP: ${temp_f}'F - (Difference of ${temp_diff}')
|
||||||
Shutting down servers!!" 1
|
Shutting down servers!!" 1
|
||||||
echo "($datetime) - ${temp_f}'F - CRITICAL - (Difference of ${temp_diff}'F)" >> ${logtemp}
|
echo "($datetime) - ${temp_f}'F - CRITICAL - (Difference of ${temp_diff}'F)" >> ${logtemp}
|
||||||
echo -e "($datetime) - ${SENSOR} - ${temp_f}'F - CRITICAL TEMP - (Difference of ${temp_diff}')" >> ${PW_LOGFILE}
|
echo -e "($datetime) - ${SENSOR} - ${temp_f}'F - CRITICAL TEMP - (Difference of ${temp_diff}')" >> ${PW_LOGFILE}
|
||||||
last_temp[${SENSOR}]=$temp_f
|
last_temp[${SENSOR}]=$temp_f
|
||||||
@@ -319,14 +319,14 @@ Shutting down servers!!" 1
|
|||||||
|
|
||||||
if [ ${last_temp[${SENSOR}]} -gt 1 ]; then
|
if [ ${last_temp[${SENSOR}]} -gt 1 ]; then
|
||||||
SENDNOTICE "${SENSOR} BACK TO NORMAL" "($datetime) NORMAL TEMP: ${temp_f}'F
|
SENDNOTICE "${SENSOR} BACK TO NORMAL" "($datetime) NORMAL TEMP: ${temp_f}'F
|
||||||
Previous Temp: ${last_temp[${SENSOR}]}'F"
|
Previous Temp: ${last_temp[${SENSOR}]}'F"
|
||||||
echo -e "($datetime) - ${temp_f}'F - Back to NORMAL TEMP - Previous Temp: ${last_temp[${SENSOR}]}'F" >> ${logtemp}
|
echo -e "($datetime) - ${temp_f}'F - Back to NORMAL TEMP - Previous Temp: ${last_temp[${SENSOR}]}'F" >> ${logtemp}
|
||||||
echo -e "($datetime) - ${temp_f}'F - ${SENSOR} - Back to NORMAL TEMP" >> ${PW_LOGFILE}
|
echo -e "($datetime) - ${temp_f}'F - ${SENSOR} - Back to NORMAL TEMP" >> ${PW_LOGFILE}
|
||||||
[ "$(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}
|
||||||
[ "$(compgen -G "${PW_FOLDER}/shutdown.*")" != "" ] && rm -f ${PW_FOLDER}/shutdown.*
|
[ "$(compgen -G "${PW_FOLDER}/shutdown.*")" != "" ] && rm -f ${PW_FOLDER}/shutdown.*
|
||||||
@@ -373,6 +373,7 @@ Previous Temp: ${last_temp[${SENSOR}]}'F"
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
elif [ "${PW_HOST_ADDRESSES[${SENSORa}]}" == "" ]; then #sensor down
|
elif [ "${PW_HOST_ADDRESSES[${SENSORa}]}" == "" ]; then #sensor down
|
||||||
if [ ! -f ${PW_TMPFOLDER}/${SENSORa}.down ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSORa}.down)) -ge 1800 ]; then
|
if [ ! -f ${PW_TMPFOLDER}/${SENSORa}.down ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSORa}.down)) -ge 1800 ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user