one more fix on timer reset for fermentationstep

This commit is contained in:
avollkopf 2022-02-28 18:15:23 +01:00
parent 2573e39bd8
commit 959c33624d
3 changed files with 10 additions and 3 deletions

View file

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

View file

@ -427,6 +427,7 @@ class FermentationController:
if step is None:
self.logger.info("No futher step to start")
else:
step.instance.endtime = 0
await step.instance.start()
logging.info("Starting step {}".format(step.name))
step.status = StepState.ACTIVE
@ -530,9 +531,9 @@ class FermentationController:
for step in item.steps:
self.logger.info("Stopping Step {} {}".format(step.name, step.id))
try:
await step.instance.stop()
await step.instance.reset()
await step.instance.stop()
step.status = StepState.INITIAL
step.endtime = 0
except Exception as e:
self.logger.error(e)
self.save()

View file

@ -229,6 +229,12 @@ class FermenterStep(CBPiFermentationStep):
await self.push_update()
async def reset(self):
await self.timer.stop()
timeD=int(self.props.get("TimerD", 0))
timeH=int(self.props.get("TimerH", 0))
timeM=int(self.props.get("TimerM", 0))
self.fermentationtime=(timeM+(60*timeH)+(1440*timeD)) *60
self.timer = Timer(self.fermentationtime ,on_update=self.on_timer_update, on_done=self.on_timer_done)
self.endtime = 0
await self.update_endtime()