From 6a09701c9202f2e9d79062e278ecdf8422b52fe4 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 3 Dec 2023 17:12:08 -0600 Subject: [PATCH] Update powerwall.sh --- powerwall.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/powerwall.sh b/powerwall.sh index 42540760..f15433da 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -144,9 +144,10 @@ CHECKTEMPSENSOR(){ elif [ "${PW_SENSOR_TYPE[${1}]}" == "cpu" ]; then if [ "${1}" == "Powerwall-CPU-Usage" ]; then + echo "WOW1" temp_c=$(awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else print ($2+$4-u1) * 100 / (t-t1) "%"; }' <(grep 'cpu ' /proc/stat) <(sleep 1;grep 'cpu ' /proc/stat) | sed -e 's/%//g') else - echo "WOW" + echo "WOW2" temp_c=$(ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${PW_REMOTE_SENSORS[${1}]} "/opt/idssys/defaults/get-data.sh cpu-usage") fi echo ${PW_TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn