update
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
VERS='2.2.40-08182023'
|
||||
VERS='2.2.43-08182023'
|
||||
|
||||
noheader=' update service dailytemp '
|
||||
|
||||
|
||||
60
powerwall.sh
60
powerwall.sh
@@ -359,31 +359,53 @@ DAILYTEMP(){
|
||||
echo
|
||||
echo -e "Sensor Temperature(s) Now / 1DayAVG / 7DayAVG"
|
||||
DIVIDER . . 60
|
||||
for SENSOR in ${!PW_SENSOR_ID[@]}; do
|
||||
# average1=$(AVERAGETEMP ${PW_SENSOR_ID[$SENSOR]} 1)
|
||||
# average7=$(AVERAGETEMP ${PW_SENSOR_ID[$SENSOR]} 7)
|
||||
|
||||
if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "mqtt" ]; then
|
||||
mqtt_message=`${mqtt_conn} -t tele/${SENSOR}/SENSOR -C 1`
|
||||
temp_c=$(echo $mqtt_message | cut -d':' -f 6 | cut -d',' -f 1)
|
||||
for SENSORa in ${PW_SENSOR_ORD[@]}; do
|
||||
|
||||
elif [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ]; then
|
||||
temp_c=$(vcgencmd measure_temp)
|
||||
temp_c=${temp_c%\'*}; temp_c=${temp_c#*=}
|
||||
|
||||
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then
|
||||
unset IFS
|
||||
SENSORS_CHECK=$(ssh root@${PW_RACADM_ACCESS} racadm -r ${PW_HOST_IDRACS[${SENSOR}]} -u ${PW_ESXI_USER} -p "'${PW_ESXI_PASS}'" getsensorinfo | grep " Temp" 2>&1)
|
||||
IFS=$'\n' read -rd '' -a SENSORS_CHECK <<<"${SENSORS_CHECK}"; unset IFS
|
||||
else
|
||||
temp_c=''
|
||||
|
||||
SENSORS_CHECK=(${SENSORa})
|
||||
fi
|
||||
if [ "$temp_c" != "null" ] && [ "$temp_c" != "" ]; then
|
||||
temp_f=`echo "scale=2; $temp_c*1.8 + 32" | bc`
|
||||
|
||||
|
||||
for SENSOR in "${SENSORS_CHECK[@]}"; do
|
||||
# average1=$(AVERAGETEMP ${PW_SENSOR_ID[$SENSOR]} 1)
|
||||
# average7=$(AVERAGETEMP ${PW_SENSOR_ID[$SENSOR]} 7)
|
||||
|
||||
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "mqtt" ]; then
|
||||
mqtt_message=`${mqtt_conn} -t tele/${SENSOR}/SENSOR -C 1`
|
||||
temp_c=$(echo $mqtt_message | cut -d':' -f 6 | cut -d',' -f 1)
|
||||
|
||||
c=0; spc=''; spc1=`expr ${cw} - ${#SENSOR}`; until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||
echo -e "${SENSOR}${spc}${temp_f}'F / ${average1}'F / ${average7}'F"
|
||||
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "system" ]; then
|
||||
temp_c=$(vcgencmd measure_temp)
|
||||
temp_c=${temp_c%\'*}; temp_c=${temp_c#*=}
|
||||
|
||||
fi
|
||||
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "remotesystem" ]; then
|
||||
temp_c=$(ssh root@${PW_REMOTE_SENSORS[${SENSOR}]} vcgencmd measure_temp)
|
||||
temp_c=${temp_c%\'*}; temp_c=${temp_c#*=}
|
||||
|
||||
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then
|
||||
temp_c=$(echo ${SENSOR} | cut -d'p' -f2 | awk '/ / {print $2}' | sed -e 's/C//g'); temp_c=${temp_c/ /}
|
||||
vSENSOR=$(echo ${SENSOR} | cut -d'T' -f1 | xargs)
|
||||
SENSOR="${SENSORa}-${vSENSOR// /_}"
|
||||
|
||||
fi
|
||||
else
|
||||
temp_c=''
|
||||
|
||||
fi
|
||||
|
||||
if [ "$temp_c" != "null" ] && [ "$temp_c" != "" ]; then
|
||||
temp_f=`echo "scale=2; $temp_c*1.8 + 32" | bc`
|
||||
|
||||
c=0; spc=''; spc1=`expr ${cw} - ${#SENSOR}`; until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||
echo -e "${SENSOR}${spc}${temp_f}'F / ${average1}'F / ${average7}'F"
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
done
|
||||
# echo
|
||||
# end=`date +%s`
|
||||
|
||||
Reference in New Issue
Block a user