Update temp.inc.sh
This commit is contained in:
@@ -914,27 +914,27 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
|
||||
fi
|
||||
|
||||
temp_f=''
|
||||
if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "mqtt" ]; then
|
||||
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "mqtt" ]; then
|
||||
mqtt_message=`${mqtt_conn} -t tele/${SENSOR}/SENSOR -C 1`
|
||||
echo ${mqtt_message} | cut -d':' -f 7 | cut -d',' -f 1 | read temp_h
|
||||
echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
|
||||
|
||||
elif [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "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[${SENSOR}]}_temperature | jq -r '.state') ; then TIMEOUT=1; fi
|
||||
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}" != "" ]; then
|
||||
temp_f=`IDS_NUMBER_FORMAT ${temp_c} 2 yes`
|
||||
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[${SENSOR}]}_humidity | jq -r '.state') 2 yes`
|
||||
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`
|
||||
else
|
||||
temp_c=''
|
||||
fi
|
||||
|
||||
elif [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "espdev" ]; then
|
||||
if ! temp_c=$(curl -m 8 -s http://${PW_REMOTE_SENSORS[${SENSOR}]}:8090/sensor/${PW_SENSOR_DEVICEID[${SENSOR}]} | jq '.value'); then TIMEOUT=1; fi
|
||||
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}" != "" ]; then
|
||||
temp_h=`IDS_NUMBER_FORMAT $(curl -m 8 -s http://${PW_REMOTE_SENSORS[${SENSOR}]}:8090/sensor/${PW_SENSOR_DEVICEID[${SENSOR}]/temperature/humidity} | jq '.value') 2 yes`
|
||||
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`
|
||||
fi
|
||||
|
||||
elif [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "tuya" ]; then
|
||||
elif [ "${PW_SENSOR_TYPE[${1}]}" == "tuya" ]; then
|
||||
IFS=: read -r temp_c temp_h <<< $(GET_TUYA_TEMP ${1}); unset IFS
|
||||
|
||||
elif [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ]; then
|
||||
@@ -946,7 +946,7 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
|
||||
temp_h=`IDS_NUMBER_FORMAT $(echo ${INFO} | jq -r '.device0 .obs[].humidity') 2 yes`
|
||||
fi
|
||||
|
||||
elif [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "system" ]; then
|
||||
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "system" ]; then
|
||||
if [[ "${SENSOR}" = *"CPU"* ]]; then
|
||||
temp_c=$(vcgencmd measure_temp)
|
||||
temp_c=${temp_c%\'*}; temp_c=${temp_c#*=}
|
||||
@@ -959,12 +959,12 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
|
||||
# fi
|
||||
fi
|
||||
|
||||
elif [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "remotesystem" ]; then
|
||||
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "remotesystem" ]; then
|
||||
temp_c=$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${PW_REMOTE_SENSORS[${SENSOR}]} vcgencmd measure_temp)
|
||||
temp_c=${temp_c%\'*}; temp_c=${temp_c#*=}
|
||||
temp_h=''
|
||||
|
||||
elif [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "esxi" ]; then
|
||||
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esxi" ]; then
|
||||
temp_c=$(snmpwalk -v 1 -c public -t 2 ${PW_HOST_IDRACS[${SENSORa}]} .1.3.6.1.4.1.674.10892.5.4.700.20.1.6.1.${t} -O vq | sed -e 's/"//g')
|
||||
temp_c=`echo "scale=1; ${temp_c}/10" | bc`
|
||||
temp_warn=$(snmpwalk -v 1 -c public -t 2 ${PW_HOST_IDRACS[${SENSORa}]} .1.3.6.1.4.1.674.10892.5.4.700.20.1.11.1.${t} -O vq | sed -e 's/"//g')
|
||||
|
||||
Reference in New Issue
Block a user