diff --git a/Control/brewpi/controller.py b/Control/brewpi/controller.py index 31ff17c..84f34bb 100644 --- a/Control/brewpi/controller.py +++ b/Control/brewpi/controller.py @@ -67,6 +67,7 @@ class Controller(TimerListener): self.receipe_done = False self.thread = threading.Thread(target=self.main) self.thread.start() + self.fp_log = None def command(self, cmd): self.queue.put_nowait(cmd) @@ -131,6 +132,7 @@ class Controller(TimerListener): def log(self, s): now = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime()) print("{}: {}".format(now, s)) + self.fp_log.write("{}: {}\n".format(now, s)) def report(self): self.log("Temp SOLL {} °C".format(self.ctrl_theta_soll)) @@ -177,6 +179,7 @@ class Controller(TimerListener): elif msg == commands.RUN: if not self.processTimer.isActive: + self.fp_log = open(self.receipe['Name'] + '.log', "w") self.time = 0 self.rast_index = 0 self.reportTimer.start(self.report_interval) @@ -206,6 +209,7 @@ class Controller(TimerListener): # Stirrer and plant self.stirrer.deactivate() self.plant.activate(False) + self.fp_log.close() self.receipe_sema.release() def rast(self, rast):