Update temp.inc.sh

This commit is contained in:
2024-02-25 14:59:45 -06:00
parent d32a0abd57
commit 0e2eefa792

View File

@@ -343,6 +343,9 @@ CHECKTEMPSENSOR(){
if ! mqtt_message=`${mqtt_conn} -t tele/${1}/SENSOR -C 1` ; then TIMEOUT=1; fi
echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
elif [ "${PW_SENSOR_TYPE[${1}]}" == "tuya" ]; then
IFS=:; read -r temp_c hum <<< $(GET_TUYA_TEMP ${1}); unset IFS
elif [ "${PW_SENSOR_TYPE[${1}]}" == "lacrosse" ]; then
if ! INFO=$(curl -m 8 -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) ; then TIMEOUT=1; fi
if [ "${INFO}" != "" ]; then
@@ -1288,7 +1291,7 @@ GET_TUYA_TEMP(){
TEMP=-1
if [ "$(echo "${INFO}" | grep '"108":')" != "" ]; then
TEMP=$(echo "${INFO}" | grep '"6":' | cut -d' ' -f 4 | sed 's/,//g')
TEMP=$(bc <<< "scale=2; ($(ROUND_NUMBER $(echo "scale=1; ${TEMP}/10" | bc -l) 1)*(9/5))+32")
TEMP=$(ROUND_NUMBER $(echo "scale=1; ${TEMP}/10" | bc -l) 1)
HUM=$(echo "${INFO}" | grep '"20":' | cut -d' ' -f 4 | sed 's/,//g')
# elif [ "$(echo "${INFO}" | grep '"6":')" != "" ]; then