diff --git a/defaults.inc b/defaults.inc index a586aa37..660ece25 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERS='2.6.93-04102024' +VERS='2.6.94-04102024' noheader=' update service dailytemp confsync -r -report ' diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index 1cc35522..094c98fc 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -359,10 +359,10 @@ CHECKTEMPSENSOR(){ echo ${mqtt_message} | cut -d':' -f 7 | cut -d',' -f 1 | read temp_h elif [ "${PW_SENSOR_TYPE[${1}]}" == "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[${1}]}_temperature | jq -r '.state') ; then TIMEOUT=1; fi + if ! temp_c=$(curl -m 8 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" ${PW_HOMEASSISTANT_URL}/api/states/sensor.${PW_SENSOR_DEVICEID[${1}]}_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[${1}]}_humidity | jq -r '.state') 2 yes` + temp_h=`IDS_NUMBER_FORMAT $(curl -m 8 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" ${PW_HOMEASSISTANT_URL}/api/states/sensor.${PW_SENSOR_DEVICEID[${1}]}_humidity | jq -r '.state') 2 yes` else temp_c='' fi @@ -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 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=$(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}" 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}" ${PW_HOMEASSISTANT_URL}/api/states/sensor.${PW_SENSOR_DEVICEID[${SENSORa}]}_humidity | jq -r '.state') 2 yes` else temp_c='' fi @@ -986,9 +986,9 @@ Previous Temp: ${last_temp}${GAUGESH}" # if [ "${PW_REMOTE_SENSORS[${SENSOR}]}" != "" ] && [ "$(CHECK_HOST ${PW_REMOTE_SENSORS[${SENSOR}]})" != "false" ]; then touch ${PW_TMPFOLDER}/${SENSOR}.restart SENDNOTICE "Restarting TG-Outlet-2 to restart ServerRoomTemp" "ERROR reading ServerRoomTemp" - RUN=$(curl -m 8 -s -H "Authorization: Bearer ${PW_ESPHOME_API}" -H "Content-Type: application/json" -d '{"entity_id": "switch.smart_15em_plug_in_2_socket"}' http://10.10.1.180:8123/api/services/switch/turn_off) + RUN=$(curl -m 8 -s -H "Authorization: Bearer ${PW_ESPHOME_API}" -H "Content-Type: application/json" -d '{"entity_id": "switch.smart_15em_plug_in_2_socket"}' ${PW_HOMEASSISTANT_URL}/api/services/switch/turn_off) sleep 2s - RUN=$(curl -m 8 -s -H "Authorization: Bearer ${PW_ESPHOME_API}" -H "Content-Type: application/json" -d '{"entity_id": "switch.smart_15em_plug_in_2_socket"}' http://10.10.1.180:8123/api/services/switch/turn_on) + RUN=$(curl -m 8 -s -H "Authorization: Bearer ${PW_ESPHOME_API}" -H "Content-Type: application/json" -d '{"entity_id": "switch.smart_15em_plug_in_2_socket"}' ${PW_HOMEASSISTANT_URL}/api/services/switch/turn_on) # fi elif [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] || ([ -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.sent)) -ge $(echo "scale=0; ${PW_RENOTIFY_TIMEOUT}*60" | bc) ]); then diff --git a/powerwall.sh b/powerwall.sh index da4d71ff..f5dae3ea 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -723,9 +723,11 @@ GET_SNAPSHOTS(){ } CONFSYNC(){ - # rsync -az --timeout=3 ${PW_FOLDER}/settings.conf root@10.2.1.1:${PW_FOLDER}/ & >/dev/null 2>&1 - rsync -az --timeout=3 ${PW_FOLDER}/settings.conf root@${PW_OFFSITE_MONITOR}:${PW_FOLDER}/ & >/dev/null 2>&1 - rsync -az --timeout=3 ${PW_FOLDER}/settings.conf root@10.10.10.60:/opt/idssys/nodemgmt/conf/powerwall.settings.conf & >/dev/null 2>&1 + [ "${PW_OFFSITE_MONITOR}" != "" ] && rsync -az --timeout=3 ${PW_FOLDER}/settings.conf root@${PW_OFFSITE_MONITOR}:${PW_FOLDER}/ & >/dev/null 2>&1 + if [ -f /opt/idssys/nodemgmt/conf/defaults.local.inc ]; then + source /opt/idssys/nodemgmt/defaults.inc + rsync -az --timeout=3 ${PW_FOLDER}/settings.conf root@${NM_NODEMANAGER}:/opt/idssys/nodemgmt/conf/powerwall.settings.conf & >/dev/null 2>&1 + fi } DOWNLIST(){