diff --git a/powerwall.sh b/powerwall.sh index a3a6e1a1..228e9a54 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -156,6 +156,12 @@ CHECKTEMP_SERVICE(){ declare -A last_temp while true; do + if [ ! -f ${PW_TMPFOLDER}/temp.* ] && [ $(date +%H)$(date +%M) -ge 0700 ] && [ $(date +%H)$(date +%M) -lt 0705 ]; then + if [ ! -f ${PW_TMPFOLDER}/.sentdaily ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.sentdaily)) -gt 600 ]; then + touch ${PW_TMPFOLDER}/.sentdaily + SENDNOTICE "Daily Temp Readings" "$(DAILYTEMP)" & + fi + fi for SENSORa in ${PW_SENSOR_ORD[@]}; do logtemp=${PW_LOGFOLDER}/log-temp-${SENSORa} [ ! -f ${logtemp} ] && touch ${logtemp} @@ -276,13 +282,6 @@ Shutting down system servers!!" 1 echo -e "($datetime) - ${temp_f}'F - Shutting down SYS servers" >> ${logtemp} fi else - if [ ! -f ${PW_TMPFOLDER}/temp.* ] && [ $(date +%H)$(date +%M) -ge 0700 ] && [ $(date +%H)$(date +%M) -lt 0705 ]; then - if [ ! -f ${PW_TMPFOLDER}/.${SENSOR}.sentdaily ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.${SENSOR}.sentdaily)) -gt 600 ]; then - rm -f ${PW_TMPFOLDER}/.${SENSOR}.sentdaily - touch ${PW_TMPFOLDER}/.${SENSOR}.sentdaily - SENDNOTICE "Daily Temp Readings" "$(DAILYTEMP)" & - fi - fi if [ ${last_temp[${SENSOR}]} -gt 1 ]; then SENDNOTICE "${SENSOR} BACK TO NORMAL" "($datetime) NORMAL TEMP: ${temp_f}'F @@ -293,8 +292,8 @@ Previous Temp: ${last_temp[${SENSOR}]}'F" [ "$(compgen -G "${PW_FOLDER}/shutdown.*")" != "" ] && rm -f ${PW_FOLDER}/shutdown.* elif [ ${last_temp[${SENSOR}]} -eq 0 ]; then - SENDNOTICE "${SENSOR} TEMP NORMAL" "($datetime) Service Startup -NORMAL TEMP: ${temp_f}'F" + # SENDNOTICE "${SENSOR} TEMP NORMAL" "($datetime) Service Startup +# NORMAL TEMP: ${temp_f}'F" echo -e "($datetime) - ${temp_f}'F - Service Startup - NORMAL TEMP" >> ${logtemp} echo -e "($datetime) - ${temp_f}'F - ${SENSOR} - Service Startup" >> ${PW_LOGFILE} [ "$(compgen -G "${PW_FOLDER}/shutdown.*")" != "" ] && rm -f ${PW_FOLDER}/shutdown.* @@ -967,9 +966,14 @@ fi fi else if [ "${3}" = "start" ] || [ "${3}" = "" ]; then - [ "${2}" = "temp" ] && CHECKTEMP_SERVICE - [ "${2}" = "power" ] && CHECKPOWER_SERVICE - [ "${2}" = "powerlogger" ] && POWERLOGGER_SERVICE + if [ "${2}" = "temp" ]; then + SENDNOTICE "Temp Monitor Startup" "$(DAILYTEMP)" & + CHECKTEMP_SERVICE + elif [ "${2}" = "power" ]; then + CHECKPOWER_SERVICE + elif [ "${2}" = "powerlogger" ]; then + POWERLOGGER_SERVICE + fi elif [ "${3}" = "stop" ]; then if [ "${2}" = "temp" ]; then