Update temp.inc.sh
This commit is contained in:
@@ -1626,16 +1626,16 @@ SENDTEMP(){
|
|||||||
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "lacrosse" ]; then
|
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "lacrosse" ]; then
|
||||||
INFO=$(curl -m 5 -s --get -d "deviceid=${PW_SENSOR_DEVICEID[${SENSOR}]}" -d "limit=1" -d "metric=1" -d "timezone=2" https://decent-destiny-704.appspot.com/laxservices/device_info.php | jq)
|
INFO=$(curl -m 5 -s --get -d "deviceid=${PW_SENSOR_DEVICEID[${SENSOR}]}" -d "limit=1" -d "metric=1" -d "timezone=2" https://decent-destiny-704.appspot.com/laxservices/device_info.php | jq)
|
||||||
if [[ "${SENSORa}" = *"-Probe" ]]; then
|
if [[ "${SENSORa}" = *"-Probe" ]]; then
|
||||||
temp_c=`IDS_NUMBER_FORMAT $(echo ${INFO} | jq -r '.device0 .obs[].probe_temp') 2 yes`
|
temp_c=$(echo ${INFO} | jq -r '.device0 .obs[].probe_temp')
|
||||||
else
|
else
|
||||||
temp_c=`IDS_NUMBER_FORMAT $(echo ${INFO} | jq -r '.device0 .obs[].ambient_temp') 2 yes`
|
temp_c=$(echo ${INFO} | jq -r '.device0 .obs[].ambient_temp')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esphome" ]; then
|
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esphome" ]; then
|
||||||
if ! temp_c=$(curl -m 5 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" ${PW_HOMEASSISTANT_URL}/api/states/sensor.${PW_SENSOR_DEVICEID[${SENSORa}]}_temperature | jq -r '.state') ; then TIMEOUT=1; fi
|
if ! temp_c=$(curl -m 5 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" ${PW_HOMEASSISTANT_URL}/api/states/sensor.${PW_SENSOR_DEVICEID[${SENSORa}]}_temperature | jq -r '.state') ; then TIMEOUT=1; fi
|
||||||
if [ "${temp_c}" != "" ]; then
|
if [ "${temp_c}" != "" ]; then
|
||||||
temp_f=`IDS_NUMBER_FORMAT ${temp_c} 2 yes`
|
temp_f=${temp_c}
|
||||||
temp_h=`IDS_NUMBER_FORMAT $(curl -m 5 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" ${PW_HOMEASSISTANT_URL}/api/states/sensor.${PW_SENSOR_DEVICEID[${SENSORa}]}_humidity | jq -r '.state') 2 yes`
|
temp_h=$(curl -m 5 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" ${PW_HOMEASSISTANT_URL}/api/states/sensor.${PW_SENSOR_DEVICEID[${SENSORa}]}_humidity | jq -r '.state')
|
||||||
else
|
else
|
||||||
temp_c=''
|
temp_c=''
|
||||||
fi
|
fi
|
||||||
@@ -1643,7 +1643,7 @@ SENDTEMP(){
|
|||||||
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "espdev" ]; then
|
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "espdev" ]; then
|
||||||
if ! temp_c=$(curl -m 8 -s http://${PW_REMOTE_SENSORS[${SENSORa}]}:8090/sensor/${PW_SENSOR_DEVICEID[${SENSORa}]} | jq '.value'); then TIMEOUT=1; fi
|
if ! temp_c=$(curl -m 8 -s http://${PW_REMOTE_SENSORS[${SENSORa}]}:8090/sensor/${PW_SENSOR_DEVICEID[${SENSORa}]} | jq '.value'); then TIMEOUT=1; fi
|
||||||
if [ "${temp_c}" != "" ]; then
|
if [ "${temp_c}" != "" ]; then
|
||||||
temp_h=`IDS_NUMBER_FORMAT $(curl -m 8 -s http://${PW_REMOTE_SENSORS[${SENSORa}]}:8090/sensor/${PW_SENSOR_DEVICEID[${SENSORa}]/temperature/humidity} | jq '.value') 2 yes`
|
temp_h=$(curl -m 8 -s http://${PW_REMOTE_SENSORS[${SENSORa}]}:8090/sensor/${PW_SENSOR_DEVICEID[${SENSORa}]/temperature/humidity} | jq '.value')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "tuya" ]; then
|
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "tuya" ]; then
|
||||||
@@ -1695,8 +1695,7 @@ SENDTEMP(){
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ "${PW_DESC_TEMP[${SENSOR}]}" != "" ] && SENSOR_DESC=${PW_DESC_TEMP[${SENSOR}]} || SENSOR_DESC=${SENSOR}
|
|
||||||
c=0; spc=''; spc1=`expr ${cw} - ${#SENSOR_DESC}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; ((c++)); done
|
|
||||||
if [ "${temp_c}" != "null" ] && [ "${temp_c}" != "" ]; then
|
if [ "${temp_c}" != "null" ] && [ "${temp_c}" != "" ]; then
|
||||||
if [ "${SENSOR}" == "ServerRoomTH" ]; then
|
if [ "${SENSOR}" == "ServerRoomTH" ]; then
|
||||||
temp_f=`echo "scale=2; (${temp_c}*(9/5))+32+${PW_ServerRoomTH_Dev}" | tr -d $'\r' | bc`
|
temp_f=`echo "scale=2; (${temp_c}*(9/5))+32+${PW_ServerRoomTH_Dev}" | tr -d $'\r' | bc`
|
||||||
@@ -1710,20 +1709,29 @@ SENDTEMP(){
|
|||||||
fi
|
fi
|
||||||
(( $(bc <<<"${temp_f} < 1") )) && [[ "${temp_f}" = *"."* ]] && temp_f="0${temp_f}"
|
(( $(bc <<<"${temp_f} < 1") )) && [[ "${temp_f}" = *"."* ]] && temp_f="0${temp_f}"
|
||||||
fi
|
fi
|
||||||
if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]]; then
|
|
||||||
temp_f_disp=$(IDS_NUMBER_FORMAT ${temp_f} 2 yes)
|
# if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ] && [[ "${SENSOR}" = *"FAN"* ]]; then
|
||||||
if [ "${1}" != "" ]; then
|
# temp_f_disp=$(IDS_NUMBER_FORMAT ${temp_f} 2 yes)
|
||||||
average1_disp=$(IDS_NUMBER_FORMAT ${average1})
|
# if [ "${1}" != "" ]; then
|
||||||
average7_disp=$(IDS_NUMBER_FORMAT ${average7})
|
# average1_disp=$(IDS_NUMBER_FORMAT ${average1} 2 yes)
|
||||||
fi
|
# average7_disp=$(IDS_NUMBER_FORMAT ${average7} 2 yes)
|
||||||
else
|
# fi
|
||||||
temp_f_disp=${temp_f}
|
# else
|
||||||
if [ "${1}" != "" ]; then
|
# temp_f_disp=${temp_f}
|
||||||
average1_disp=${average1}
|
# if [ "${1}" != "" ]; then
|
||||||
average7_disp=${average7}
|
# average1_disp=${average1}
|
||||||
fi
|
# average7_disp=${average7}
|
||||||
|
# fi
|
||||||
|
# fi
|
||||||
|
temp_f_disp=$(IDS_NUMBER_FORMAT ${temp_f} 2 yes)
|
||||||
|
if [ "${1}" != "" ]; then
|
||||||
|
average1_disp=$(IDS_NUMBER_FORMAT ${average1} 2 yes)
|
||||||
|
average7_disp=$(IDS_NUMBER_FORMAT ${average7} 2 yes)
|
||||||
fi
|
fi
|
||||||
[ "${1}" != "" ] && echo -e "${SENSOR_DESC}${spc}${temp_f_disp}${GAUGESH} / ${average1_disp}${GAUGESH} / ${average7_disp}${GAUGESH}" || echo -e "${SENSOR}${spc}${temp_f_disp}${GAUGESH}"
|
|
||||||
|
[ "${PW_DESC_TEMP[${SENSOR}]}" != "" ] && SENSOR_DESC=${PW_DESC_TEMP[${SENSOR}]} || SENSOR_DESC=${SENSOR}
|
||||||
|
c=0; spc=''; spc1=`expr ${cw} - ${#SENSOR_DESC}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; ((c++)); done
|
||||||
|
[ "${1}" != "" ] && echo -e "${SENSOR_DESC}${spc}${temp_f_disp}${GAUGESH} / ${average1_disp}${GAUGESH} / ${average7_disp}${GAUGESH}" || echo -e "${SENSOR_DESC}${spc}${temp_f_disp}${GAUGESH}"
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -e "${SENSOR_DESC}${spc}No Data"
|
echo -e "${SENSOR_DESC}${spc}No Data"
|
||||||
|
|||||||
Reference in New Issue
Block a user