Update temp.inc.sh

This commit is contained in:
2023-12-26 21:09:59 -06:00
parent c1b89cf3a0
commit 20fdf3dfa2

View File

@@ -288,11 +288,6 @@ AVERAGETEMP(){
# echo ${logsfound}
}
SENDTEMPS(){
st_temps=$(DAILYTEMP)
SENDNOTICE "${1}" "${st_temps}"
}
CHECKTEMP_SERVICE(){
cw=20
declare -A last_temp
@@ -305,7 +300,7 @@ CHECKTEMP_SERVICE(){
# 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
# SENDTEMPS "Daily Temp Readings" &
# SENDTEMPS "Daily Temp Readings" yes &
# fi
# fi
SENSORS_CHECKED=()
@@ -645,10 +640,15 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
touch ${PW_TMPFOLDER}/zservicerun.${SENSORa}.done
}
DAILYTEMP(){
SENDTEMPS(){
st_temps=$(SENDTEMP ${2})
SENDNOTICE "${1}" "${st_temps}"
}
SENDTEMP(){
cw=35;
echo
echo -e "Sensor Temperature(s) Now / 1DayAVG / 7DayAVG"
echo -en "Sensor Temperature(s)"
[ "${1}" != "" ] && echo " Now / 1DayAVG / 7DayAVG" || echo
DIVIDER . . 60
for SENSORa in ${PW_SENSOR_ORD[@]}; do
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" != "esxi" ]; then
@@ -685,20 +685,20 @@ DAILYTEMP(){
temp_c=''
fi
# if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then
# average1=$(AVERAGETEMP ${PW_SENSOR_ID[${SENSORa}]} 1 ${vSENSOR// /_})
# average7=$(AVERAGETEMP ${PW_SENSOR_ID[${SENSORa}]} 7 ${vSENSOR// /_})
# else
# average1=$(AVERAGETEMP ${PW_SENSOR_ID[${SENSORa}]} 1)
# average7=$(AVERAGETEMP ${PW_SENSOR_ID[${SENSORa}]} 7)
# fi
average1=0
average7=0
if [ "${1}" != "" ]; then
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then
average1=$(AVERAGETEMP ${PW_SENSOR_ID[${SENSORa}]} 1 ${vSENSOR// /_})
average7=$(AVERAGETEMP ${PW_SENSOR_ID[${SENSORa}]} 7 ${vSENSOR// /_})
else
average1=$(AVERAGETEMP ${PW_SENSOR_ID[${SENSORa}]} 1)
average7=$(AVERAGETEMP ${PW_SENSOR_ID[${SENSORa}]} 7)
fi
fi
c=0; spc=''; spc1=`expr ${cw} - ${#SENSOR}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
if [ "${temp_c}" != "null" ] && [ "${temp_c}" != "" ]; then
temp_f=`echo "scale=2; ${temp_c}*1.8 + 32" | bc`
echo -e "${SENSOR}${spc}${temp_f}'F / ${average1}'F / ${average7}'F"
[ "${1}" != "" ] && echo -e "${SENSOR}${spc}${temp_f}'F / ${average1}'F / ${average7}'F" || echo -e "${SENSOR}${spc}${temp_f}'F"
else
echo -e "${SENSOR}${spc}No Data"