Update temp.inc.sh

This commit is contained in:
2024-04-10 20:14:18 -05:00
parent 3c1b3ff112
commit 08d81ea35b

View File

@@ -983,12 +983,14 @@ Previous Temp: ${last_temp}${GAUGESH}"
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
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)
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)
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)
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
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
touch ${PW_TMPFOLDER}/${SENSOR}-error.sent
SENDNOTICE "${SENSOR} Sensor ERROR" "ERROR reading sensor data" 1