This commit is contained in:
2023-05-15 09:24:39 -05:00
parent 4362ce7539
commit c3cfcecd2f
2 changed files with 11 additions and 6 deletions

View File

@@ -14,11 +14,12 @@ min_battvolt_sys=47
#47
FOLDER='/opt/idssys/powerwall'
logfile=${FOLDER}/logfile
logacv=${FOLDER}/log-acv
LOGFOLDER=${FOLDER}/logs
[ ! -d ${LOGFOLDER} ] && mkdir ${LOGFOLDER}
logfile=${LOGFOLDER}/logfile
logacv=${LOGFOLDER}/log-acv
[ ! -f ${logacv} ] && touch ${logacv}
logtemp=${FOLDER}/log-temp
[ ! -f ${logtemp} ] && touch ${logtemp}
declare -A TEMP_THRESHOLDS
TEMP_THRESHOLDS['ServerRoomTH']="83,88,95"

View File

@@ -77,9 +77,13 @@ CHECKTEMP_SERVICE(){
cw=20
declare -A last_temp
while true; do
errtime=$(expr `date +%s` - $(stat -c %Y ${logtemp}))
[ $errtime -ge 3600 ] && relog=1 || relog=0
for SENSOR in ${!SENSOR_ID[@]}; do
logtemp=${LOGFOLDER}/log-temp-${SENSOR}
[ ! -f ${logtemp} ] && touch ${logtemp}
errtime=$(expr `date +%s` - $(stat -c %Y ${logtemp}))
[ $errtime -ge 3600 ] && relog=1 || relog=0
if [ "${SENSOR_TYPE[${SENSOR}]}" == "mqtt" ]; then
mqtt_message=`${mqtt_conn} -t tele/${SENSOR}/SENSOR -C 1`
echo $mqtt_message | cut -d':' -f 7 | cut -d',' -f 1 | read temp_h