From e9af0dd266072b555c75d13b3fa8cc3c569d0c90 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 3 Sep 2022 11:47:30 -0500 Subject: [PATCH] back --- defaults.inc | 7 ++----- powerwall.sh | 7 +++++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/defaults.inc b/defaults.inc index 2fd74d22..87f83c9e 100755 --- a/defaults.inc +++ b/defaults.inc @@ -2,11 +2,8 @@ mqtt_conn='mosquitto_sub -h 127.0.0.1 -u mqtt -P 12mqtt34password56' -declare -A TEMP_WARN_THRESHOLDS -TEMP_WARN_THRESHOLDS['ServerRoomTH']=78 - -declare -A TEMP_CRIT_THRESHOLDS -TEMP_CRIT_THRESHOLDS['ServerRoomTH']=85 +declare -A TEMP_THRESHOLDS +TEMP_THRESHOLDS['ServerRoomTH']="78,85" declare -A SENSOR_MQTTID diff --git a/powerwall.sh b/powerwall.sh index 52d0bc0f..6dd5f9be 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -22,9 +22,12 @@ CHECKTEMP(){ temp_f=`echo "scale=2; $temp_c*1.8 + 32" | bc` #echo "$temp_c -> $temp_f" - if [ $temp_f -ge ${TEMP_WARN_THRESHOLDS[${1}]} ] && [ $temp_f -lt ${TEMP_CRIT_THRESHOLDS[${1}]} ]; then + echo ${TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn + echo ${TEMP_THRESHOLDS[${1}]} | cut -d',' -f 2 | read temp_crit + + if [ $temp_f -ge ${temp_warn} ] && [ $temp_f -lt ${temp_crit} ]; then echo "WARNING: $temp_f" - elif [ $temp_f -ge ${TEMP_CRIT_THRESHOLDS[${1}]} ]; then + elif [ $temp_f -ge ${temp_crit} ]; then echo "CRITICAL: $temp_f" else echo "normal: $temp_f"