From dfa5df2ef14873bb098f5629acdbe8c33f20048f Mon Sep 17 00:00:00 2001 From: avollkopf <43980694+avollkopf@users.noreply.github.com> Date: Tue, 11 Jan 2022 06:59:16 +0100 Subject: [PATCH] Some fixes - Different names for fermentersteps as Notificationstep caused an issue (steps not yot implemented for fermentation) - Reverted back item based mqtt as this may require further testing -> will be activated in dev branch later --- cbpi/__init__.py | 2 +- cbpi/controller/basic_controller2.py | 5 +++-- cbpi/controller/fermentation_controller.py | 6 ++++-- cbpi/controller/step_controller.py | 8 +++++--- cbpi/extension/FermentationStep/__init__.py | 6 +++--- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/cbpi/__init__.py b/cbpi/__init__.py index e695e31..ef9e0d7 100644 --- a/cbpi/__init__.py +++ b/cbpi/__init__.py @@ -1 +1 @@ -__version__ = "4.0.1.a7" +__version__ = "4.0.1.0" diff --git a/cbpi/controller/basic_controller2.py b/cbpi/controller/basic_controller2.py index 18c2914..0444da9 100644 --- a/cbpi/controller/basic_controller2.py +++ b/cbpi/controller/basic_controller2.py @@ -55,8 +55,9 @@ class BasicController: async def push_udpate(self): 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,item.id), item.to_dict()) + self.cbpi.push_update("cbpi/{}".format(self.update_key), list(map(lambda item: item.to_dict(), self.data))) + #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): return next((item for item in self.data if item.id == id), None) diff --git a/cbpi/controller/fermentation_controller.py b/cbpi/controller/fermentation_controller.py index ef455d2..16c152e 100644 --- a/cbpi/controller/fermentation_controller.py +++ b/cbpi/controller/fermentation_controller.py @@ -111,8 +111,10 @@ class FermentationController: def push_update(self): 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,item.id), item.to_dict()) + self.cbpi.push_update("cbpi/{}".format(self.update_key), list(map(lambda item: item.to_dict(), self.data))) + + #for item in self.data: + # self.cbpi.push_update("cbpi/{}/{}".format(self.update_key,item.id), item.to_dict()) pass async def shutdown(self, app=None): diff --git a/cbpi/controller/step_controller.py b/cbpi/controller/step_controller.py index 8f0537a..1f35a35 100644 --- a/cbpi/controller/step_controller.py +++ b/cbpi/controller/step_controller.py @@ -72,7 +72,7 @@ class StepController: self._loop.create_task(self.start_step(active_step)) async def add(self, item: Step): - logging.debug("Add step") + logging.info("Add step") item.id = shortuuid.uuid() item.status = StepState.INITIAL try: @@ -256,8 +256,10 @@ class StepController: self.cbpi.ws.send(dict(topic="mash_profile_update", data=self.get_state())) else: self.cbpi.ws.send(dict(topic="step_update", data=list(map(lambda item: item.to_dict(), self.profile)))) - for item in self.profile: - self.cbpi.push_update(topic="cbpi/stepupdate/{}".format(item.id), data=(item.to_dict())) + + self.cbpi.push_update(topic="cbpi/stepupdate", data=list(map(lambda item: item.to_dict(), self.profile))) + #for item in self.profile: + # self.cbpi.push_update(topic="cbpi/stepupdate/{}".format(item.id), data=(item.to_dict())) async def start_step(self,step): try: diff --git a/cbpi/extension/FermentationStep/__init__.py b/cbpi/extension/FermentationStep/__init__.py index e4499cd..93b8430 100644 --- a/cbpi/extension/FermentationStep/__init__.py +++ b/cbpi/extension/FermentationStep/__init__.py @@ -21,7 +21,7 @@ import warnings @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)")]) -class NotificationStep(CBPiFermentationStep): +class FermenterNotificationStep(CBPiFermentationStep): async def NextStep(self, **kwargs): await self.next() @@ -65,7 +65,7 @@ class NotificationStep(CBPiFermentationStep): Property.Kettle(label="Kettle"), 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")]) -class TargetTempStep(CBPiFermentationStep): +class FermenterTargetTempStep(CBPiFermentationStep): async def NextStep(self, **kwargs): await self.next() @@ -228,4 +228,4 @@ def setup(cbpi): cbpi.plugin.register("NotificationStep", NotificationStep) cbpi.plugin.register("TargetTempStep", TargetTempStep) - cbpi.plugin.register("FermentationStep", FermentationStep) \ No newline at end of file + cbpi.plugin.register("FermentationStep", FermentationStep)