update
This commit is contained in:
13
defaults.inc
13
defaults.inc
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PW_VERS='2.9.2-05262025'
|
||||
PW_VERS='2.9.3-05262025'
|
||||
|
||||
noheader=' update service dailytemp confsync -r -report test '
|
||||
|
||||
@@ -36,14 +36,9 @@ M_SRVCOPT=(start stop restart reload enable disable)
|
||||
source ${PW_FOLDER}/conf/settings.conf
|
||||
|
||||
|
||||
if [[ "${IP}" != "10.6.1."* ]]; then
|
||||
mqtt_conn="/usr/bin/mosquitto_sub -h ${PW_IP} -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
|
||||
|
||||
[ "${PW_MYSQL_HOST}" != "" ] && mysql_conn="/usr/bin/mariadb -h ${PW_MYSQL_HOST} -P 3308 --user=${PW_MYSQL_USER} --password=${PW_MYSQL_PASS}"
|
||||
[ "${PW_MQTT_HOST}" != "" ] && mqtt_conn="/usr/bin/mosquitto_sub -h ${PW_MQTT_HOST} -u ${PW_MQTT_USER} -P ${PW_MQTT_PASS}"
|
||||
|
||||
EMAIL_NOTICE=${PW_EMAIL_NOTICE}
|
||||
PUSHOVER_APP_TOKEN=${PW_PUSHOVER_APP_TOKEN}
|
||||
PUSHOVER_USER_TOKEN=${PW_PUSHOVER_USER_TOKEN}
|
||||
|
||||
@@ -679,7 +679,7 @@ CHECKTEMPSENSOR(){
|
||||
TIMEOUT=0
|
||||
temp_h=0
|
||||
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
|
||||
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
|
||||
@@ -952,7 +952,7 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
|
||||
fi
|
||||
|
||||
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`
|
||||
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
|
||||
@@ -1030,6 +1030,9 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
|
||||
if ! temp_c=$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${PW_REMOTE_SENSORS[${SENSORa}]} cat /sys/bus/w1/devices/${PW_SENSOR_DEVICEID[${SENSORa}]}/w1_slave | tail -n1 | cut -d "=" -f2) ; then TIMEOUT=1; fi
|
||||
[ "${temp_c}" != "" ] && temp_c=$(echo "scale=2; ${temp_c}/1000" | bc)
|
||||
temp_h=''
|
||||
|
||||
else
|
||||
temp_c=''
|
||||
|
||||
fi
|
||||
|
||||
@@ -1602,7 +1605,7 @@ SENDTEMP(){
|
||||
GAUGESH="'F"
|
||||
fi
|
||||
[ "${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`
|
||||
echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
|
||||
|
||||
|
||||
Reference in New Issue
Block a user