mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-12-22 21:44:57 +01:00
Merge branch 'development' into development
This commit is contained in:
commit
57af6cac59
5 changed files with 14 additions and 8 deletions
|
@ -1 +1,2 @@
|
||||||
__version__ = "4.0.1.a8"
|
__version__ = "4.0.1.a8"
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,9 @@ class BasicController:
|
||||||
|
|
||||||
async def push_udpate(self):
|
async def push_udpate(self):
|
||||||
self.cbpi.ws.send(dict(topic=self.update_key, data=list(map(lambda item: item.to_dict(), self.data))))
|
self.cbpi.ws.send(dict(topic=self.update_key, data=list(map(lambda item: item.to_dict(), self.data))))
|
||||||
for item in self.data:
|
self.cbpi.push_update("cbpi/{}".format(self.update_key), list(map(lambda item: item.to_dict(), self.data)))
|
||||||
self.cbpi.push_update("cbpi/{}/{}".format(self.update_key,item.id), item.to_dict())
|
#for item in self.data:
|
||||||
|
# self.cbpi.push_update("cbpi/{}/{}".format(self.update_key,item.id), item.to_dict())
|
||||||
|
|
||||||
def find_by_id(self, id):
|
def find_by_id(self, id):
|
||||||
return next((item for item in self.data if item.id == id), None)
|
return next((item for item in self.data if item.id == id), None)
|
||||||
|
|
|
@ -111,8 +111,10 @@ class FermentationController:
|
||||||
|
|
||||||
def push_update(self):
|
def push_update(self):
|
||||||
self.cbpi.ws.send(dict(topic=self.update_key, data=list(map(lambda item: item.to_dict(), self.data))))
|
self.cbpi.ws.send(dict(topic=self.update_key, data=list(map(lambda item: item.to_dict(), self.data))))
|
||||||
for item in self.data:
|
self.cbpi.push_update("cbpi/{}".format(self.update_key), list(map(lambda item: item.to_dict(), self.data)))
|
||||||
self.cbpi.push_update("cbpi/{}/{}".format(self.update_key,item.id), item.to_dict())
|
|
||||||
|
#for item in self.data:
|
||||||
|
# self.cbpi.push_update("cbpi/{}/{}".format(self.update_key,item.id), item.to_dict())
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def shutdown(self, app=None):
|
async def shutdown(self, app=None):
|
||||||
|
|
|
@ -72,7 +72,7 @@ class StepController:
|
||||||
self._loop.create_task(self.start_step(active_step))
|
self._loop.create_task(self.start_step(active_step))
|
||||||
|
|
||||||
async def add(self, item: Step):
|
async def add(self, item: Step):
|
||||||
logging.debug("Add step")
|
logging.info("Add step")
|
||||||
item.id = shortuuid.uuid()
|
item.id = shortuuid.uuid()
|
||||||
item.status = StepState.INITIAL
|
item.status = StepState.INITIAL
|
||||||
try:
|
try:
|
||||||
|
@ -265,10 +265,12 @@ class StepController:
|
||||||
self.cbpi.push_update(topic="cbpi/stepupdate/{}".format(item.id), data=(item.to_dict()))
|
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))))
|
||||||
|
|
||||||
step = self.find_by_status(StepState.ACTIVE)
|
step = self.find_by_status(StepState.ACTIVE)
|
||||||
if step != None:
|
if step != None:
|
||||||
self.cbpi.push_update(topic="cbpi/stepupdate/{}".format(step.id), data=(step.to_dict()))
|
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:
|
||||||
logging.info("Try to start step %s" % step)
|
logging.info("Try to start step %s" % step)
|
||||||
|
|
|
@ -21,7 +21,7 @@ import warnings
|
||||||
|
|
||||||
@parameters([Property.Text(label="Notification",configurable = True, description = "Text for notification"),
|
@parameters([Property.Text(label="Notification",configurable = True, description = "Text for notification"),
|
||||||
Property.Select(label="AutoNext",options=["Yes","No"], description="Automatically move to next step (Yes) or pause after Notification (No)")])
|
Property.Select(label="AutoNext",options=["Yes","No"], description="Automatically move to next step (Yes) or pause after Notification (No)")])
|
||||||
class NotificationStep(CBPiFermentationStep):
|
class FermenterNotificationStep(CBPiFermentationStep):
|
||||||
|
|
||||||
async def NextStep(self, **kwargs):
|
async def NextStep(self, **kwargs):
|
||||||
await self.next()
|
await self.next()
|
||||||
|
@ -65,7 +65,7 @@ class NotificationStep(CBPiFermentationStep):
|
||||||
Property.Kettle(label="Kettle"),
|
Property.Kettle(label="Kettle"),
|
||||||
Property.Text(label="Notification",configurable = True, description = "Text for notification when Temp is reached"),
|
Property.Text(label="Notification",configurable = True, description = "Text for notification when Temp is reached"),
|
||||||
Property.Select(label="AutoMode",options=["Yes","No"], description="Switch Kettlelogic automatically on and off -> Yes")])
|
Property.Select(label="AutoMode",options=["Yes","No"], description="Switch Kettlelogic automatically on and off -> Yes")])
|
||||||
class TargetTempStep(CBPiFermentationStep):
|
class FermenterTargetTempStep(CBPiFermentationStep):
|
||||||
|
|
||||||
async def NextStep(self, **kwargs):
|
async def NextStep(self, **kwargs):
|
||||||
await self.next()
|
await self.next()
|
||||||
|
@ -228,4 +228,4 @@ def setup(cbpi):
|
||||||
|
|
||||||
cbpi.plugin.register("NotificationStep", NotificationStep)
|
cbpi.plugin.register("NotificationStep", NotificationStep)
|
||||||
cbpi.plugin.register("TargetTempStep", TargetTempStep)
|
cbpi.plugin.register("TargetTempStep", TargetTempStep)
|
||||||
cbpi.plugin.register("FermentationStep", FermentationStep)
|
cbpi.plugin.register("FermentationStep", FermentationStep)
|
||||||
|
|
Loading…
Reference in a new issue