making restart state file more generic. make logs less noisy. put sleep in code so ovenwatcher can be set
This commit is contained in:
parent
7f5b1396b6
commit
fddf22e6bf
@ -1,4 +1,5 @@
|
||||
import logging
|
||||
import os
|
||||
|
||||
# uncomment this if using MAX-31856
|
||||
#from lib.max31856 import MAX31856
|
||||
@ -160,6 +161,9 @@ ignore_emergencies = False
|
||||
# automatically on boot-up for this to work.
|
||||
# DO NOT put automatic_restart_state_file anywhere in /tmp. It could be
|
||||
# cleaned up (deleted) by the OS on boot.
|
||||
# The state file is written to disk every sensor_time_wait seconds (2s by default)
|
||||
# and is written in the same directory as config.py.
|
||||
automatic_restarts = True
|
||||
automatic_restart_window = 15 # max minutes since power outage
|
||||
automatic_restart_state_file = "/home/jason/repos/kiln-controller/state/kiln_controller_state.json"
|
||||
automatic_restart_state_file = os.path.abspath(os.path.join(os.path.dirname( __file__ ),'state.json'))
|
||||
|
||||
|
||||
@ -328,7 +328,8 @@ class Oven(threading.Thread):
|
||||
if not config.automatic_restarts == True:
|
||||
return False
|
||||
if self.state_file_is_old():
|
||||
log.info("restart not possible. state file too old.")
|
||||
# this log statement is too noisy.
|
||||
#log.info("restart not possible. state file too old.")
|
||||
return False
|
||||
if os.path.isfile(config.automatic_restart_state_file):
|
||||
with open(config.automatic_restart_state_file) as infile: d = json.load(infile)
|
||||
@ -352,6 +353,7 @@ class Oven(threading.Thread):
|
||||
profile_json = json.dumps(json.load(infile))
|
||||
profile = Profile(profile_json)
|
||||
self.run_profile(profile,startat=startat)
|
||||
time.sleep(1)
|
||||
self.ovenwatcher.record(profile)
|
||||
|
||||
def set_ovenwatcher(self,watcher):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user