Update temp.inc.sh

This commit is contained in:
2024-04-10 10:54:09 -05:00
parent b00ba8f34d
commit 2379b9eb4a

View File

@@ -620,10 +620,10 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "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[${SENSORa}]}_temperature | jq -r '.state') ; then TIMEOUT=1; fi
if ! temp_c=$(curl -m 5 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" http://10.10.1.180:8123/api/states/sensor.${PW_SENSOR_DEVICEID[${SENSORa}]}_temperature | jq -r '.state') ; then TIMEOUT=1; fi
if [ "${temp_c}" != "" ]; then
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[${SENSORa}]}_humidity | jq -r '.state') 2 yes`
temp_h=`IDS_NUMBER_FORMAT $(curl -m 5 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" http://10.10.1.180:8123/api/states/sensor.${PW_SENSOR_DEVICEID[${SENSORa}]}_humidity | jq -r '.state') 2 yes`
else
temp_c=''
fi
@@ -730,7 +730,7 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
(( $(bc <<<"${temp_f} < 1") )) && [[ "${temp_f}" = *"."* ]] && temp_f="0${temp_f}"
fi
# echo "HERE: [${SENSOR//-/}] - ${last_temp} - ${temp_c} - ${temp_f} - ${temp_warn} - ${temp_crit} - ${temp_crit_sys}"
echo "HERE: [${SENSOR//-/}] - ${last_temp} - ${temp_c} - ${temp_f} - ${temp_warn} - ${temp_crit} - ${temp_crit_sys}"
# [ ! "${temp_c}" ] || [ ! "${temp_f}" ] || [ ! "${temp_warn}" ] || [ ! "${temp_crit}" ] || [ ! "${temp_crit_sys}" ] && echo "VALUE NOT FOUND"
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" != "esxi" ]; then