Update temp.inc.sh

This commit is contained in:
2024-04-10 10:42:13 -05:00
parent 13905e38a7
commit 1e08637a56

View File

@@ -359,11 +359,10 @@ CHECKTEMPSENSOR(){
echo ${mqtt_message} | cut -d':' -f 7 | cut -d',' -f 1 | read temp_h
elif [ "${PW_SENSOR_TYPE[${1}]}" == "esphome" ]; then
if ! temp_c=$(curl -m 8 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" http://10.10.1.180:8123/api/states/sensor.${PW_SENSOR_DEVICEID[${1}]}_temperature) ; then TIMEOUT=1; fi
if ! temp_c=$(curl -m 8 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" http://10.10.1.180:8123/api/states/sensor.${PW_SENSOR_DEVICEID[${1}]}_temperature | jq '.state') ; then TIMEOUT=1; fi
if [ "${temp_c}" != "" ]; then
echo "HERE: ${temp_c}"
temp_f=`IDS_NUMBER_FORMAT ${temp_c} 2 yes`
temp_h=`IDS_NUMBER_FORMAT $(curl -m 8 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" http://10.10.1.180:8123/api/states/sensor.${PW_SENSOR_DEVICEID[${1}]}_humidity) 2 yes`
temp_f=`IDS_NUMBER_FORMAT ${temp_c} 2 yes`
temp_h=`IDS_NUMBER_FORMAT $(curl -m 8 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" http://10.10.1.180:8123/api/states/sensor.${PW_SENSOR_DEVICEID[${1}]}_humidity | jq '.state') 2 yes`
else
temp_c=''
fi