Update temp.inc.sh
This commit is contained in:
@@ -107,13 +107,10 @@ CHECKTEMPSENSOR(){
|
|||||||
echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
|
echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
|
||||||
|
|
||||||
elif [ "${PW_SENSOR_TYPE[${1}]}" == "lacrosse" ]; then
|
elif [ "${PW_SENSOR_TYPE[${1}]}" == "lacrosse" ]; then
|
||||||
# INFO=$(/bin/python3 ${PW_INCFOLDER}/getInfo.lacrosse.py "${PW_LACROSSE_ID[${1}]}" | sed -e "s/\[{'//g" | sed -e "s/}\]//g" | sed -e "s/', '/~/g" | sed -e "s/': '/:/g" | sed -e "s/': /:/g")
|
|
||||||
# IFS=$'~'; read -rd '' -a INFO <<<"${INFO}"; unset IFS; declare -A DEVICE_INFO
|
|
||||||
# for DINFOtmp in "${INFO[@]}"; do key=${DINFOtmp%%:*}; val=${DINFOtmp##*:}; val=${val//[$'\t\r\n ']}; DEVICE_INFO[${key}]=${val}; done
|
|
||||||
# temp_c=${DEVICE_INFO['probe_temp']}
|
|
||||||
INFO=$(curl -s --get -d "deviceid=${PW_LACROSSE_ID[${1}]}" -d "limit=1" -d "metric=1" -d "timezone=2" https://decent-destiny-704.appspot.com/laxservices/device_info.php | jq)
|
INFO=$(curl -s --get -d "deviceid=${PW_LACROSSE_ID[${1}]}" -d "limit=1" -d "metric=1" -d "timezone=2" https://decent-destiny-704.appspot.com/laxservices/device_info.php | jq)
|
||||||
temp_c=$(echo ${INFO} | jq -r '.device0 .obs[].probe_temp')
|
temp_c=$(echo ${INFO} | jq -r '.device0 .obs[].ambient_temp')
|
||||||
|
temp_probe=$(echo ${INFO} | jq -r '.device0 .obs[].probe_temp')
|
||||||
|
|
||||||
elif [ "${PW_SENSOR_TYPE[${1}]}" == "system" ]; then
|
elif [ "${PW_SENSOR_TYPE[${1}]}" == "system" ]; then
|
||||||
temp_c=$(vcgencmd measure_temp)
|
temp_c=$(vcgencmd measure_temp)
|
||||||
temp_c=${temp_c%\'*}; temp_c=${temp_c#*=}
|
temp_c=${temp_c%\'*}; temp_c=${temp_c#*=}
|
||||||
@@ -174,6 +171,24 @@ CHECKTEMPSENSOR(){
|
|||||||
[ ${#temp_warn} == 2 ] && spcw=' ' || spcw=' '
|
[ ${#temp_warn} == 2 ] && spcw=' ' || spcw=' '
|
||||||
[ ${#temp_crit} == 2 ] && spcc=' ' || spcc=' '
|
[ ${#temp_crit} == 2 ] && spcc=' ' || spcc=' '
|
||||||
echo -e "${spc}[${spcw}${idsCL[Yellow]}${temp_warn}${GAUGESH}${idsCL[Default]} /${spcc}${idsCL[LightRed]}${temp_crit}${GAUGESH}=>${idsCL[Default]} ]"
|
echo -e "${spc}[${spcw}${idsCL[Yellow]}${temp_warn}${GAUGESH}${idsCL[Default]} /${spcc}${idsCL[LightRed]}${temp_crit}${GAUGESH}=>${idsCL[Default]} ]"
|
||||||
|
|
||||||
|
if [ "${1}" == "ServerRoomLA" ]; then
|
||||||
|
if [ $(bc -l <<< "${temp_probe} >= ${temp_warn}") -eq 1 ] && [ $(bc -l <<< "${temp_probe} < ${temp_crit}") -eq 1 ]; then
|
||||||
|
echo -en "${idsCL[Yellow]}WARNING ${spct}${temp_probe}${GAUGESH}${idsCL[Default]}"
|
||||||
|
elif [ $(bc -l <<< "${temp_probe} >= ${temp_crit}") -eq 1 ]; then
|
||||||
|
echo -en "${idsCL[LightRed]}CRITICAL${spct}${temp_probe}${GAUGESH}${idsCL[Default]}"
|
||||||
|
else
|
||||||
|
echo -en "${idsCL[Green]}Normal ${spct}${temp_probe}${GAUGESH}${idsCL[Default]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
tmp="${spct}${temp_probe}"
|
||||||
|
c=0; spc=''; spc1=`expr 10 - ${#tmp}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
|
||||||
|
[ ${#temp_warn} == 2 ] && spcw=' ' || spcw=' '
|
||||||
|
[ ${#temp_crit} == 2 ] && spcc=' ' || spcc=' '
|
||||||
|
echo -en "\r\033[K${idsCL[White]}${idsST[Bold]}${SENSOR}-Probe${idsST[Reset]}${spc}${idsCL[Default]}: "
|
||||||
|
echo -e "${spc}[${spcw}${idsCL[Yellow]}${temp_warn}${GAUGESH}${idsCL[Default]} /${spcc}${idsCL[LightRed]}${temp_crit}${GAUGESH}=>${idsCL[Default]} ]"
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
AVERAGETEMP(){
|
AVERAGETEMP(){
|
||||||
@@ -254,6 +269,13 @@ CHECKTEMP_SERVICE(){
|
|||||||
echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
|
echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
|
||||||
|
|
||||||
elif [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ]; then
|
elif [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ]; then
|
||||||
|
INFO=$(curl -s --get -d "deviceid=${PW_LACROSSE_ID[${1}]}" -d "limit=1" -d "metric=1" -d "timezone=2" https://decent-destiny-704.appspot.com/laxservices/device_info.php | jq)
|
||||||
|
temp_c=$(echo ${INFO} | jq -r '.device0 .obs[].ambient_temp')
|
||||||
|
temp_probe=$(echo ${INFO} | jq -r '.device0 .obs[].probe_temp')
|
||||||
|
temp_h=$(echo ${INFO} | jq -r '.device0 .obs[].humidity')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
INFO=$(/bin/python3 ${PW_INCFOLDER}/getInfo.lacrosse.py "${PW_LACROSSE_ID[${SENSOR}]}" | sed -e "s/\[{'//g" | sed -e "s/}\]//g" | sed -e "s/', '/~/g" | sed -e "s/': '/:/g" | sed -e "s/': /:/g")
|
INFO=$(/bin/python3 ${PW_INCFOLDER}/getInfo.lacrosse.py "${PW_LACROSSE_ID[${SENSOR}]}" | sed -e "s/\[{'//g" | sed -e "s/}\]//g" | sed -e "s/', '/~/g" | sed -e "s/': '/:/g" | sed -e "s/': /:/g")
|
||||||
IFS=$'~'; read -rd '' -a INFO <<<"${INFO}"; unset IFS; declare -A DEVICE_INFO
|
IFS=$'~'; read -rd '' -a INFO <<<"${INFO}"; unset IFS; declare -A DEVICE_INFO
|
||||||
for DINFOtmp in "${INFO[@]}"; do key=${DINFOtmp%%:*}; val=${DINFOtmp##*:}; val=${val//[$'\t\r\n ']}; DEVICE_INFO[${key}]=${val}; done
|
for DINFOtmp in "${INFO[@]}"; do key=${DINFOtmp%%:*}; val=${DINFOtmp##*:}; val=${val//[$'\t\r\n ']}; DEVICE_INFO[${key}]=${val}; done
|
||||||
|
|||||||
Reference in New Issue
Block a user