timer fix for manual stop and restart of fermentationstep

This commit is contained in:
avollkopf 2022-02-28 16:47:33 +01:00
parent a503995d98
commit 2573e39bd8
3 changed files with 6 additions and 10 deletions

View file

@ -1 +1 @@
__version__ = "4.0.2.0.a6"
__version__ = "4.0.2.0.a7"

View file

@ -173,11 +173,8 @@ class FermenterStep(CBPiFermentationStep):
async def on_timer_done(self,timer):
self.summary = ""
#self.fermenter.target_temp = 0
if self.AutoMode == True:
await self.setAutoMode(False)
#self.endtime = 0
#await self.update_endtime()
self.cbpi.notify(self.name, 'Step finished', NotificationType.SUCCESS)
await self.next(self.fermenter.id)
return StepResult.DONE
@ -188,8 +185,7 @@ class FermenterStep(CBPiFermentationStep):
await self.push_update()
async def on_start(self):
if self.endtime == 0:
if self.endtime == 0:
timeD=int(self.props.get("TimerD", 0))
timeH=int(self.props.get("TimerH", 0))
timeM=int(self.props.get("TimerM", 0))
@ -197,8 +193,6 @@ class FermenterStep(CBPiFermentationStep):
else:
self.fermentationtime = self.endtime - time.time()
self.AutoMode = True if self.props.get("AutoMode", "No") == "Yes" else False
self.starttemp= self.get_sensor_value(self.props.get("Sensor", None)).get("value")
if self.fermenter is not None:
@ -210,6 +204,7 @@ class FermenterStep(CBPiFermentationStep):
if self.fermenter is not None and self.timer is None:
logging.info("Set Timer")
self.timer = Timer(self.fermentationtime ,on_update=self.on_timer_update, on_done=self.on_timer_done)
self.timer.is_running = False
elif self.fermenter is not None:
try:
if self.timer.is_running == True:
@ -218,7 +213,8 @@ class FermenterStep(CBPiFermentationStep):
await self.update_endtime()
except:
pass
if self.endtime != 0 and self.timer is not None:
if self.endtime != 0 and self.timer is not None and self.timer.is_running == False:
self.timer.start()
self.timer.is_running = True

View file

@ -33,7 +33,7 @@ class FermenterAutostart(CBPiExtension):
try:
if (self.fermenter.instance is None or self.fermenter.instance.state == False):
await self.cbpi.fermenter.start(self.fermenter.id)
logging.info("Successfully switched on Ferenterlogic for Fermenter {}".format(self.fermenter.id))
logging.info("Successfully switched on Fermenterlogic for Fermenter {}".format(self.fermenter.id))
except Exception as e:
logging.error("Failed to switch on FermenterLogic {} {}".format(self.fermenter.id, e))
except: