From a4ab9942195f5a9789eed29e621adf85b5d501bf Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 12 Aug 2023 09:58:10 -0500 Subject: [PATCH] update --- defaults.inc | 8 +++++++- powerwall.sh | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/defaults.inc b/defaults.inc index e6482e01..48c363d7 100755 --- a/defaults.inc +++ b/defaults.inc @@ -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' diff --git a/powerwall.sh b/powerwall.sh index e5d5ba82..1a4b01df 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -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 }