This commit is contained in:
2025-09-26 17:29:55 -05:00
parent 1f5bc68aac
commit 5eb300c52b
2 changed files with 12 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
PW_VERS='2.12.20-08302025' PW_VERS='2.12.21-09262025'
noheader=' update service dailytemp confsync -r -report test ' noheader=' update service dailytemp confsync -r -report test '

View File

@@ -1421,16 +1421,17 @@ Previous Temp: ${last_temp}${GAUGESH}"
touch ${PW_TMPFOLDER}/${SENSOR}-error.reading touch ${PW_TMPFOLDER}/${SENSOR}-error.reading
elif [ ! -f ${PW_TMPFOLDER}/${SENSOR}.disable ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.reading)) -ge 60 ]; then elif [ ! -f ${PW_TMPFOLDER}/${SENSOR}.disable ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.reading)) -ge 60 ]; then
if [ "${SENSOR}" == "ServerRoomTemp" ] && ([ ! -f ${PW_TMPFOLDER}/${SENSOR}.restart ] || ([ -f ${PW_TMPFOLDER}/${SENSOR}.restart ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}.restart)) -ge 900 ])); then ## RESTART ServerTempMon
# if [ "${PW_REMOTE_SENSORS[${SENSOR}]}" != "" ] && [ "$(CHECK_HOST ${PW_REMOTE_SENSORS[${SENSOR}]})" != "false" ]; then # if [ "${SENSOR}" == "ServerRoomTemp" ] && ([ ! -f ${PW_TMPFOLDER}/${SENSOR}.restart ] || ([ -f ${PW_TMPFOLDER}/${SENSOR}.restart ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}.restart)) -ge 900 ])); then
touch ${PW_TMPFOLDER}/${SENSOR}.restart # # if [ "${PW_REMOTE_SENSORS[${SENSOR}]}" != "" ] && [ "$(CHECK_HOST ${PW_REMOTE_SENSORS[${SENSOR}]})" != "false" ]; then
SENDNOTICE "Restarting TG-Outlet-2 to restart ServerRoom-NetworkRack" "ERROR reading ServerRoom-NetworkRack" # touch ${PW_TMPFOLDER}/${SENSOR}.restart
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) # SENDNOTICE "Restarting TG-Outlet-2 to restart ServerRoom-NetworkRack" "ERROR reading ServerRoom-NetworkRack"
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"}' ${PW_HOMEASSISTANT_URL}/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_on) # sleep 2s
# fi # 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" | tr -d $'\r' | bc) ]); then # elif
if [ ! -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" | tr -d $'\r' | bc) ]); then
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSOR} Sensor - ERROR reading sensor data" >> ${logtemp} echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSOR} Sensor - ERROR reading sensor data" >> ${logtemp}
if [ ${PW_ENABLE_RENOTIFY} -eq 1 ] || [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ]; then if [ ${PW_ENABLE_RENOTIFY} -eq 1 ] || [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ]; then
SENDNOTICE "${SENSOR_DESC} Sensor ERROR" "ERROR reading sensor data" 1 SENDNOTICE "${SENSOR_DESC} Sensor ERROR" "ERROR reading sensor data" 1