Update powerwall.sh

This commit is contained in:
2023-05-14 17:04:41 -05:00
parent d33d7c612d
commit db928e6735

View File

@@ -16,31 +16,33 @@ VERBOSE=false
#ssh root@10.5.10.35 '/vmfs/volumes/NFS_ESXi-Vault/esxi-shutdown.sh > /dev/null 2>&1' & > /dev/null 2>&1 #ssh root@10.5.10.35 '/vmfs/volumes/NFS_ESXi-Vault/esxi-shutdown.sh > /dev/null 2>&1' & > /dev/null 2>&1
CHECKTEMP(){ CHECKTEMP(){
[ "${1}" != "" ] && SENSORS=("${1}") || SENSORS=SENSOR_ID[@] if [ "${1}" != "" ]; then
for x in "${!SENSOR_ID[@]}"; do printf "[%s]=%s\n" "$x" "${SENSOR_ID[$x]}" ; done CHECKTEMPSENSOR ${1}
for x in "${!SENSORS[@]}"; do printf "[%s]=%s\n" "$x" "${SENSORS[$x]}" ; done else
for SENSOR in ${!SENSOR_ID[@]}; do
for SENSOR in ${!SENSORS}; do
echo "HERE: ${SENSOR}-${SENSORS[${SENSOR}]}" echo "HERE: ${SENSOR}-${SENSORS[${SENSOR}]}"
done done
fi
# mqtt_message=`${mqtt_conn} -t tele/${1}/SENSOR -C 1` }
# echo $mqtt_message | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c CHECKTEMPSENSOR()}{
# if [ "$temp_c" != "null" ] && [ "$temp_c" != "" ]; then mqtt_message=`${mqtt_conn} -t tele/${1}/SENSOR -C 1`
# temp_f=`echo "scale=2; $temp_c*1.8 + 32" | bc` echo $mqtt_message | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
# #echo "$temp_c -> $temp_f" if [ "$temp_c" != "null" ] && [ "$temp_c" != "" ]; then
# temp_f=`echo "scale=2; $temp_c*1.8 + 32" | bc`
# echo ${TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn #echo "$temp_c -> $temp_f"
# echo ${TEMP_THRESHOLDS[${1}]} | cut -d',' -f 2 | read temp_crit
# echo ${TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn
# if [ $(bc -l <<< "$temp_f >= $temp_warn") -eq 1 ] && [ $(bc -l <<< "$temp_f < $temp_crit") -eq 1 ]; then echo ${TEMP_THRESHOLDS[${1}]} | cut -d',' -f 2 | read temp_crit
# echo "WARNING: $temp_f°F"
# elif [ $(bc -l <<< "$temp_f >= $temp_crit") -eq 1 ]; then if [ $(bc -l <<< "$temp_f >= $temp_warn") -eq 1 ] && [ $(bc -l <<< "$temp_f < $temp_crit") -eq 1 ]; then
# echo "CRITICAL: $temp_f°F" echo "WARNING: $temp_f°F"
# else elif [ $(bc -l <<< "$temp_f >= $temp_crit") -eq 1 ]; then
# echo "normal: $temp_f°F" echo "CRITICAL: $temp_f°F"
# fi else
# fi echo "normal: $temp_f°F"
fi
fi
} }
CHECKTEMP_SERVICE(){ CHECKTEMP_SERVICE(){