This commit is contained in:
2025-05-26 21:04:42 -05:00
parent b9b6a3c561
commit 6347d3be6c
2 changed files with 10 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
PW_VERS='2.9.2-05262025' PW_VERS='2.9.3-05262025'
noheader=' update service dailytemp confsync -r -report test ' noheader=' update service dailytemp confsync -r -report test '
@@ -36,13 +36,8 @@ M_SRVCOPT=(start stop restart reload enable disable)
source ${PW_FOLDER}/conf/settings.conf source ${PW_FOLDER}/conf/settings.conf
if [[ "${IP}" != "10.6.1."* ]]; then [ "${PW_MYSQL_HOST}" != "" ] && mysql_conn="/usr/bin/mariadb -h ${PW_MYSQL_HOST} -P 3308 --user=${PW_MYSQL_USER} --password=${PW_MYSQL_PASS}"
mqtt_conn="/usr/bin/mosquitto_sub -h ${PW_IP} -u ${PW_MQTT_USER} -P ${PW_MQTT_PASS}" [ "${PW_MQTT_HOST}" != "" ] && mqtt_conn="/usr/bin/mosquitto_sub -h ${PW_MQTT_HOST} -u ${PW_MQTT_USER} -P ${PW_MQTT_PASS}"
mysql_conn="/usr/bin/mariadb -h 127.0.0.1 -P 3308 --user=${PW_MYSQL_USER} --password=${PW_MYSQL_PASS}"
# else
# mqtt_conn="/usr/bin/mosquitto_sub -h 127.0.0.1 -u ${PW_MQTT_USER} -P ${PW_MQTT_PASS}"
# mysql_conn='/usr/bin/mariadb'
fi
EMAIL_NOTICE=${PW_EMAIL_NOTICE} EMAIL_NOTICE=${PW_EMAIL_NOTICE}
PUSHOVER_APP_TOKEN=${PW_PUSHOVER_APP_TOKEN} PUSHOVER_APP_TOKEN=${PW_PUSHOVER_APP_TOKEN}

View File

@@ -679,7 +679,7 @@ CHECKTEMPSENSOR(){
TIMEOUT=0 TIMEOUT=0
temp_h=0 temp_h=0
temp_f='' temp_f=''
if [ "${PW_SENSOR_TYPE[${1}]}" == "mqtt" ]; then if [ "${mqtt_conn}" != "" ] && [ "${PW_SENSOR_TYPE[${1}]}" == "mqtt" ]; then
if ! mqtt_message=`${mqtt_conn} -t tele/${1}/SENSOR -C 1` ; then TIMEOUT=1; fi 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 echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
echo ${mqtt_message} | cut -d':' -f 7 | cut -d',' -f 1 | read temp_h echo ${mqtt_message} | cut -d':' -f 7 | cut -d',' -f 1 | read temp_h
@@ -952,7 +952,7 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
fi fi
temp_f='' temp_f=''
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "mqtt" ]; then if [ "${mqtt_conn}" != "" ] && [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "mqtt" ]; then
mqtt_message=`${mqtt_conn} -t tele/${SENSOR}/SENSOR -C 1` 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 7 | cut -d',' -f 1 | read temp_h
echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
@@ -1031,6 +1031,9 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
[ "${temp_c}" != "" ] && temp_c=$(echo "scale=2; ${temp_c}/1000" | bc) [ "${temp_c}" != "" ] && temp_c=$(echo "scale=2; ${temp_c}/1000" | bc)
temp_h='' temp_h=''
else
temp_c=''
fi fi
[ ! -f ${PW_TMPFOLDER}/.lasttemp/${SENSOR} ] && echo 0 > ${PW_TMPFOLDER}/.lasttemp/${SENSOR} [ ! -f ${PW_TMPFOLDER}/.lasttemp/${SENSOR} ] && echo 0 > ${PW_TMPFOLDER}/.lasttemp/${SENSOR}
@@ -1602,7 +1605,7 @@ SENDTEMP(){
GAUGESH="'F" GAUGESH="'F"
fi fi
[ "${last_sensor}" != "" ] && [ "${last_sensor%%-*}" != "${SENSOR%%-*}" ] && echo [ "${last_sensor}" != "" ] && [ "${last_sensor%%-*}" != "${SENSOR%%-*}" ] && echo
if [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "mqtt" ]; then if [ "${mqtt_conn}" != "" ] && [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "mqtt" ]; then
mqtt_message=`${mqtt_conn} -t tele/${SENSORa}/SENSOR -C 1` mqtt_message=`${mqtt_conn} -t tele/${SENSORa}/SENSOR -C 1`
echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c