mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-10 01:17:42 +01:00
4.01a8
Signed-off-by: InnuendoPi <k.ader@pc-team.de>
This commit is contained in:
parent
a8f7f2d92f
commit
1640453525
2 changed files with 13 additions and 4 deletions
|
@ -1 +1 @@
|
||||||
__version__ = "4.0.1.a7"
|
__version__ = "4.0.1.a8"
|
||||||
|
|
|
@ -117,6 +117,7 @@ class StepController:
|
||||||
step = self.find_by_status(StepState.STOP)
|
step = self.find_by_status(StepState.STOP)
|
||||||
if step is not None:
|
if step is not None:
|
||||||
logging.info("Resume step")
|
logging.info("Resume step")
|
||||||
|
self.cbpi.push_update(topic="cbpi/notification", data=dict(type="info", title="Resume", message="Calling resume step"))
|
||||||
await self.start_step(step)
|
await self.start_step(step)
|
||||||
await self.save()
|
await self.save()
|
||||||
return
|
return
|
||||||
|
@ -124,10 +125,13 @@ class StepController:
|
||||||
step = self.find_by_status(StepState.INITIAL)
|
step = self.find_by_status(StepState.INITIAL)
|
||||||
if step is not None:
|
if step is not None:
|
||||||
logging.info("Start Step")
|
logging.info("Start Step")
|
||||||
|
self.cbpi.push_update(topic="cbpi/notification", data=dict(type="info", title="Start", message="Calling start step"))
|
||||||
|
self.push_udpate(complete=True)
|
||||||
await self.start_step(step)
|
await self.start_step(step)
|
||||||
await self.save()
|
await self.save()
|
||||||
return
|
return
|
||||||
self.cbpi.notify("Brewing Complete", "Now the yeast will take over",action=[NotificationAction("OK")])
|
self.cbpi.notify("Brewing Complete", "Now the yeast will take over",action=[NotificationAction("OK")])
|
||||||
|
self.cbpi.push_update(topic="cbpi/notification", data=dict(type="info", title="Brewing completed", message="Now the yeast will take over"))
|
||||||
logging.info("BREWING COMPLETE")
|
logging.info("BREWING COMPLETE")
|
||||||
|
|
||||||
async def previous(self):
|
async def previous(self):
|
||||||
|
@ -168,7 +172,9 @@ class StepController:
|
||||||
logging.info("CALLING STOP STEP")
|
logging.info("CALLING STOP STEP")
|
||||||
try:
|
try:
|
||||||
await step.instance.stop()
|
await step.instance.stop()
|
||||||
|
self.cbpi.push_update(topic="cbpi/notification", data=dict(type="info", title="Pause", message="Calling paue step"))
|
||||||
step.status = StepState.STOP
|
step.status = StepState.STOP
|
||||||
|
|
||||||
await self.save()
|
await self.save()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error("Failed to stop step - Id: %s" % step.id)
|
logging.error("Failed to stop step - Id: %s" % step.id)
|
||||||
|
@ -183,6 +189,7 @@ class StepController:
|
||||||
item.status = StepState.INITIAL
|
item.status = StepState.INITIAL
|
||||||
try:
|
try:
|
||||||
await item.instance.reset()
|
await item.instance.reset()
|
||||||
|
self.cbpi.push_update(topic="cbpi/notification", data=dict(type="info", title="Stop", message="Calling stop step"))
|
||||||
except:
|
except:
|
||||||
logging.warning("No Step Instance - Id: %s", item.id)
|
logging.warning("No Step Instance - Id: %s", item.id)
|
||||||
await self.save()
|
await self.save()
|
||||||
|
@ -254,10 +261,13 @@ class StepController:
|
||||||
def push_udpate(self, complete=False):
|
def push_udpate(self, complete=False):
|
||||||
if complete is True:
|
if complete is True:
|
||||||
self.cbpi.ws.send(dict(topic="mash_profile_update", data=self.get_state()))
|
self.cbpi.ws.send(dict(topic="mash_profile_update", data=self.get_state()))
|
||||||
|
for item in self.profile:
|
||||||
|
self.cbpi.push_update(topic="cbpi/stepupdate/{}".format(item.id), data=(item.to_dict()))
|
||||||
else:
|
else:
|
||||||
self.cbpi.ws.send(dict(topic="step_update", data=list(map(lambda item: item.to_dict(), self.profile))))
|
self.cbpi.ws.send(dict(topic="step_update", data=list(map(lambda item: item.to_dict(), self.profile))))
|
||||||
for item in self.profile:
|
step = self.find_by_status(StepState.ACTIVE)
|
||||||
self.cbpi.push_update(topic="cbpi/stepupdate/{}".format(item.id), data=(item.to_dict()))
|
if step != None:
|
||||||
|
self.cbpi.push_update(topic="cbpi/stepupdate/{}".format(step.id), data=(step.to_dict()))
|
||||||
|
|
||||||
async def start_step(self,step):
|
async def start_step(self,step):
|
||||||
try:
|
try:
|
||||||
|
@ -315,4 +325,3 @@ class StepController:
|
||||||
with open(path, "w") as file:
|
with open(path, "w") as file:
|
||||||
yaml.dump(data, file)
|
yaml.dump(data, file)
|
||||||
self.push_udpate()
|
self.push_udpate()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue