This commit is contained in:
2023-08-12 09:58:10 -05:00
parent d91e3dc144
commit a4ab994219
2 changed files with 18 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
VERS='2.160-07062023'
VERS='2.161-08122023'
noheader=' update service dailytemp '
@@ -33,15 +33,21 @@ declare -A TEMP_THRESHOLDS
# TEMP_THRESHOLDS['ServerRoomTH']="72,74,76"
TEMP_THRESHOLDS['ServerRoomTH']="83,88,95"
TEMP_THRESHOLDS['RaspberryPI-CPU']="122,131,176"
TEMP_THRESHOLDS['OctoPI-CPU']="122,131,176"
declare -A SENSOR_TYPE
SENSOR_TYPE['ServerRoomTH']='mqtt'
SENSOR_TYPE['RaspberryPI-CPU']='system'
SENSOR_TYPE['OctoPI-CPU']='remotesystem'
declare -A REMOTE_SENSORS
REMOTE_SENSORS['OctoPI-CPU']='10.10.1.80'
declare -A SENSOR_ID
SENSOR_ID['ServerRoomTH']='2'
SENSOR_ID['RaspberryPI-CPU']='6'
SENSOR_ID['OctoPI-CPU']='7'
declare -A POWERWALL_SERVICES
POWERWALL_SERVICES['temp']='monitor-temp'

View File

@@ -58,6 +58,10 @@ CHECKTEMPSENSOR(){
temp_c=$(vcgencmd measure_temp)
temp_c=${temp_c%\'*}; temp_c=${temp_c#*=}
elif [ "${SENSOR_TYPE[${1}]}" == "remotesystem" ]; then
temp_c=$(ssh root@${REMOTE_SENSORS[${1}]} vcgencmd measure_temp)
temp_c=${temp_c%\'*}; temp_c=${temp_c#*=}
fi
if [ "$temp_c" != "null" ] && [ "$temp_c" != "" ]; then
@@ -557,6 +561,13 @@ SHUTDOWN_CRIT(){
echo -e "($datetime) - CRITICAL TEMP - Powerwall System shutting down" >> ${LOGFOLDER}/log-temp-${1}
echo -e "($datetime) - ${SENSOR} TEMP CRITICAL - Powerwall System shutting down" >> ${logfile}
/sbin/poweroff
elif [ "${1}" == "OctoPI-CPU" ]; then
SENDNOTICE "${SENSOR} TEMP CRITICAL" "($datetime) OctoPI System shutting down" 1
echo -e "($datetime) - CRITICAL TEMP - OctoPI System shutting down" >> ${LOGFOLDER}/log-temp-${1}
echo -e "($datetime) - ${SENSOR} TEMP CRITICAL - OctoPI System shutting down" >> ${logfile}
# ssh root@${REMOTE_SENSORS[${1}]} /sbin/poweroff
fi
}