This commit is contained in:
2024-04-10 19:48:40 -05:00
parent b8225cec2d
commit e6c2a60f83
2 changed files with 11 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
VERS='2.6.85-04102024'
VERS='2.6.90-04102024'
noheader=' update service dailytemp confsync -r -report '

View File

@@ -979,17 +979,21 @@ Previous Temp: ${last_temp}${GAUGESH}"
else
[ ! -f ${PW_TMPFOLDER}/${SENSOR}.down ] && touch ${PW_TMPFOLDER}/${SENSOR}.down
if [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.reading ]; then
if [ "${SENSOR}" == "ServerRoomTemp" ]; then
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)
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)
fi
touch ${PW_TMPFOLDER}/${SENSOR}-error.reading
elif [ ! -f ${PW_TMPFOLDER}/${SENSOR}.disable ] && (([ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.reading)) -ge 60 ]) || ([ -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
touch ${PW_TMPFOLDER}/${SENSOR}-error.sent
SENDNOTICE "${SENSOR} Sensor ERROR" "ERROR reading sensor data" 1
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${SENSOR} Sensor - ERROR reading sensor data" >> ${logtemp}
fi
fi
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
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)
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)
touch ${PW_TMPFOLDER}/${SENSOR}.restart
fi
fi
done
fi