Update powerwall.sh
This commit is contained in:
50
powerwall.sh
50
powerwall.sh
@@ -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
|
||||||
|
echo "HERE: ${SENSOR}-${SENSORS[${SENSOR}]}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
for SENSOR in ${!SENSORS}; do
|
}
|
||||||
echo "HERE: ${SENSOR}-${SENSORS[${SENSOR}]}"
|
CHECKTEMPSENSOR()}{
|
||||||
done
|
mqtt_message=`${mqtt_conn} -t tele/${1}/SENSOR -C 1`
|
||||||
|
echo $mqtt_message | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
|
||||||
# mqtt_message=`${mqtt_conn} -t tele/${1}/SENSOR -C 1`
|
if [ "$temp_c" != "null" ] && [ "$temp_c" != "" ]; then
|
||||||
# echo $mqtt_message | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
|
temp_f=`echo "scale=2; $temp_c*1.8 + 32" | bc`
|
||||||
# if [ "$temp_c" != "null" ] && [ "$temp_c" != "" ]; then
|
#echo "$temp_c -> $temp_f"
|
||||||
# temp_f=`echo "scale=2; $temp_c*1.8 + 32" | bc`
|
|
||||||
# #echo "$temp_c -> $temp_f"
|
echo ${TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn
|
||||||
#
|
echo ${TEMP_THRESHOLDS[${1}]} | cut -d',' -f 2 | read temp_crit
|
||||||
# echo ${TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn
|
|
||||||
# echo ${TEMP_THRESHOLDS[${1}]} | cut -d',' -f 2 | read temp_crit
|
if [ $(bc -l <<< "$temp_f >= $temp_warn") -eq 1 ] && [ $(bc -l <<< "$temp_f < $temp_crit") -eq 1 ]; then
|
||||||
#
|
echo "WARNING: $temp_f°F"
|
||||||
# if [ $(bc -l <<< "$temp_f >= $temp_warn") -eq 1 ] && [ $(bc -l <<< "$temp_f < $temp_crit") -eq 1 ]; then
|
elif [ $(bc -l <<< "$temp_f >= $temp_crit") -eq 1 ]; then
|
||||||
# echo "WARNING: $temp_f°F"
|
echo "CRITICAL: $temp_f°F"
|
||||||
# elif [ $(bc -l <<< "$temp_f >= $temp_crit") -eq 1 ]; then
|
else
|
||||||
# echo "CRITICAL: $temp_f°F"
|
echo "normal: $temp_f°F"
|
||||||
# else
|
fi
|
||||||
# echo "normal: $temp_f°F"
|
fi
|
||||||
# fi
|
|
||||||
# fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECKTEMP_SERVICE(){
|
CHECKTEMP_SERVICE(){
|
||||||
|
|||||||
Reference in New Issue
Block a user