update
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
VERS='2.2.40-08182023'
|
VERS='2.2.43-08182023'
|
||||||
|
|
||||||
noheader=' update service dailytemp '
|
noheader=' update service dailytemp '
|
||||||
|
|
||||||
|
|||||||
60
powerwall.sh
60
powerwall.sh
@@ -359,31 +359,53 @@ DAILYTEMP(){
|
|||||||
echo
|
echo
|
||||||
echo -e "Sensor Temperature(s) Now / 1DayAVG / 7DayAVG"
|
echo -e "Sensor Temperature(s) Now / 1DayAVG / 7DayAVG"
|
||||||
DIVIDER . . 60
|
DIVIDER . . 60
|
||||||
for SENSOR in ${!PW_SENSOR_ID[@]}; do
|
for SENSORa in ${PW_SENSOR_ORD[@]}; 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)
|
|
||||||
|
|
||||||
elif [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ]; then
|
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then
|
||||||
temp_c=$(vcgencmd measure_temp)
|
unset IFS
|
||||||
temp_c=${temp_c%\'*}; temp_c=${temp_c#*=}
|
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
|
else
|
||||||
temp_c=''
|
SENSORS_CHECK=(${SENSORa})
|
||||||
|
|
||||||
fi
|
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
|
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "system" ]; then
|
||||||
echo -e "${SENSOR}${spc}${temp_f}'F / ${average1}'F / ${average7}'F"
|
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
|
done
|
||||||
# echo
|
# echo
|
||||||
# end=`date +%s`
|
# end=`date +%s`
|
||||||
|
|||||||
Reference in New Issue
Block a user