update
This commit is contained in:
@@ -22,8 +22,13 @@ declare -A TEMP_THRESHOLDS
|
||||
TEMP_THRESHOLDS['ServerRoomTH']="83,88,95"
|
||||
|
||||
|
||||
declare -A SENSOR_TYPE
|
||||
SENSOR_TYPE['ServerRoomTH']='mqtt'
|
||||
SENSOR_TYPE['RaspberryPI-CPU']='system'
|
||||
|
||||
declare -A SENSOR_ID
|
||||
SENSOR_ID['ServerRoomTH']='2'
|
||||
SENSOR_ID['RaspberryPI-CPU']='6'
|
||||
|
||||
declare -A POWERWALL_SERVICES
|
||||
POWERWALL_SERVICES['ServerRoomTH']='monitor-serverroomth'
|
||||
|
||||
17
powerwall.sh
17
powerwall.sh
@@ -41,16 +41,23 @@ CHECKTEMP(){
|
||||
echo
|
||||
}
|
||||
CHECKTEMPSENSOR(){
|
||||
mqtt_message=`${mqtt_conn} -t tele/${1}/SENSOR -C 1`
|
||||
echo $mqtt_message | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
|
||||
echo ${TEMP_THRESHOLDS[${1}]} | cut -d',' -f 1 | read temp_warn
|
||||
echo ${TEMP_THRESHOLDS[${1}]} | cut -d',' -f 2 | read temp_crit
|
||||
|
||||
if [ "${SENSOR_TYPE[${1}]}" == "mqtt" ]; then
|
||||
mqtt_message=`${mqtt_conn} -t tele/${1}/SENSOR -C 1`
|
||||
echo $mqtt_message | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
|
||||
|
||||
elif [ "${SENSOR_TYPE[${1}]}" == "system" ]; then
|
||||
temp_c=$(vcgencmd measure_temp)
|
||||
temp_c=${test%\'*}; temp_c=${test#*=}
|
||||
|
||||
fi
|
||||
|
||||
if [ "$temp_c" != "null" ] && [ "$temp_c" != "" ]; then
|
||||
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
|
||||
|
||||
if [ $(bc -l <<< "$temp_f >= $temp_warn") -eq 1 ] && [ $(bc -l <<< "$temp_f < $temp_crit") -eq 1 ]; then
|
||||
echo -en "${idsCL[LightMagenta]}WARNING - $temp_f°F${idsCL[Default]}"
|
||||
elif [ $(bc -l <<< "$temp_f >= $temp_crit") -eq 1 ]; then
|
||||
|
||||
Reference in New Issue
Block a user