Update temp.inc.sh

This commit is contained in:
2023-12-14 22:23:23 -06:00
parent 1b1a394b07
commit b6936fd99f

View File

@@ -271,18 +271,9 @@ CHECKTEMP_SERVICE(){
elif [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ]; then
INFO=$(curl -s --get -d "deviceid=${PW_LACROSSE_ID[${1}]}" -d "limit=1" -d "metric=1" -d "timezone=2" https://decent-destiny-704.appspot.com/laxservices/device_info.php | jq)
temp_c=$(echo ${INFO} | jq -r '.device0 .obs[].ambient_temp')
temp_probe_c=$(echo ${INFO} | jq -r '.device0 .obs[].probe_temp')
temp_probe_c=$(echo ${INFO} | jq -r '.device0 .obs[].ambient_temp')
temp_c=$(echo ${INFO} | jq -r '.device0 .obs[].probe_temp')
temp_h=$(echo ${INFO} | jq -r '.device0 .obs[].humidity')
INFO=$(/bin/python3 ${PW_INCFOLDER}/getInfo.lacrosse.py "${PW_LACROSSE_ID[${SENSOR}]}" | sed -e "s/\[{'//g" | sed -e "s/}\]//g" | sed -e "s/', '/~/g" | sed -e "s/': '/:/g" | sed -e "s/': /:/g")
IFS=$'~'; read -rd '' -a INFO <<<"${INFO}"; unset IFS; declare -A DEVICE_INFO
for DINFOtmp in "${INFO[@]}"; do key=${DINFOtmp%%:*}; val=${DINFOtmp##*:}; val=${val//[$'\t\r\n ']}; DEVICE_INFO[${key}]=${val}; done
temp_c=${DEVICE_INFO['ambient_temp']}
temp_probe_c=${DEVICE_INFO['probe_temp']}
temp_h=${DEVICE_INFO['humidity']}
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "system" ]; then
temp_c=$(vcgencmd measure_temp)
@@ -470,7 +461,8 @@ Previous Temp: ${last_temp[${SENSOR//-/}]}${GAUGESH}"
fi
${mysql_conn} -e "${QRY}"
if [ "${PW_SENSOR_TYPE[${SENSOR}]}" == "lacrosse" ]; then
${mysql_conn} -e "USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`) VALUES ('${PW_SENSOR_ID["${SENSORa}-Probe"]}','$(date +'%Y-%m-%d %H:%M:%S')','${temp_probe_c}')"
temp_probe_f=$(bc <<< "scale=1; ${temp_probe_c}*1.8+32")
${mysql_conn} -e "USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`) VALUES ('${PW_SENSOR_ID["${SENSORa}-Probe"]}','$(date +'%Y-%m-%d %H:%M:%S')','${temp_probe_f}')"
fi
touch ${PW_TMPFOLDER}/${SENSOR}.insert
fi