Update powerwall.sh

This commit is contained in:
2023-08-18 18:27:36 -05:00
parent 4585a6f8c7
commit 4879a342db

View File

@@ -149,7 +149,6 @@ CHECKTEMP_SERVICE(){
# while true; do # while true; do
for SENSORa in ${PW_SENSOR_ORD[@]}; do for SENSORa in ${PW_SENSOR_ORD[@]}; do
echo $SENSORa
logtemp=${PW_LOGFOLDER}/log-temp-${SENSORa} logtemp=${PW_LOGFOLDER}/log-temp-${SENSORa}
[ ! -f ${logtemp} ] && touch ${logtemp} [ ! -f ${logtemp} ] && touch ${logtemp}
logtime=$(expr `date +%s` - $(stat -c %Y ${logtemp})) logtime=$(expr `date +%s` - $(stat -c %Y ${logtemp}))
@@ -217,7 +216,7 @@ CHECKTEMP_SERVICE(){
fi fi
temp_f=`echo "scale=2; $temp_c*1.8 + 32" | bc` temp_f=`echo "scale=2; $temp_c*1.8 + 32" | bc`
echo "HERE: ${SENSOR} - ${temp_f} - ${temp_warn} - ${temp_crit} - ${temp_crit_sys}" # echo "HERE: ${SENSOR} - ${temp_f} - ${temp_warn} - ${temp_crit} - ${temp_crit_sys}"
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" != "esxi" ]; then if [ "${PW_SENSOR_TYPE[${SENSORa}]}" != "esxi" ]; then
echo ${PW_TEMP_THRESHOLDS[${SENSOR}]} | cut -d',' -f 1 | read temp_warn echo ${PW_TEMP_THRESHOLDS[${SENSOR}]} | cut -d',' -f 1 | read temp_warn
@@ -271,6 +270,7 @@ Shutting down system servers!!" 1
else else
if [ ! -f ${PW_TMPFOLDER}/temp.* ] && [ $(date +%H)$(date +%M) -ge 0700 ] && [ $(date +%H)$(date +%M) -lt 0705 ]; then 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 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 touch ${PW_TMPFOLDER}/.${SENSOR}.sentdaily
SENDNOTICE "Daily Temp Readings" "$(DAILYTEMP)" & SENDNOTICE "Daily Temp Readings" "$(DAILYTEMP)" &
fi fi
@@ -360,8 +360,8 @@ DAILYTEMP(){
echo -e "Sensor Temperature(s) Now / 1DayAVG / 7DayAVG" echo -e "Sensor Temperature(s) Now / 1DayAVG / 7DayAVG"
DIVIDER . . 60 DIVIDER . . 60
for SENSOR in ${!PW_SENSOR_ID[@]}; do for SENSOR in ${!PW_SENSOR_ID[@]}; do
average1=$(AVERAGETEMP ${PW_SENSOR_ID[$SENSOR]} 1) # average1=$(AVERAGETEMP ${PW_SENSOR_ID[$SENSOR]} 1)
average7=$(AVERAGETEMP ${PW_SENSOR_ID[$SENSOR]} 7) # average7=$(AVERAGETEMP ${PW_SENSOR_ID[$SENSOR]} 7)
if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "mqtt" ]; then if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "mqtt" ]; then
mqtt_message=`${mqtt_conn} -t tele/${SENSOR}/SENSOR -C 1` mqtt_message=`${mqtt_conn} -t tele/${SENSOR}/SENSOR -C 1`