From 326d24c48f999598618f196686f3e60e7fc89445 Mon Sep 17 00:00:00 2001 From: avollkopf <43980694+avollkopf@users.noreply.github.com> Date: Wed, 3 Nov 2021 09:30:16 +0100 Subject: [PATCH 1/3] BF StrikeTemp test and some fixes --- cbpi/cli.py | 4 ++-- cbpi/controller/upload_controller.py | 9 +++++++-- cbpi/extension/mashstep/__init__.py | 21 ++++++++++++++------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/cbpi/cli.py b/cbpi/cli.py index d2158cc..5b0b4fd 100644 --- a/cbpi/cli.py +++ b/cbpi/cli.py @@ -166,7 +166,7 @@ def plugins_add(package_name): return if package_name == 'autostart': - print("Add cradtbeerpi.service to systemd") + print("Add craftbeerpi.service to systemd") try: if os.path.exists(os.path.join("/etc/systemd/system","craftbeerpi.service")) is False: srcfile = os.path.join(".", "config", "craftbeerpi.service") @@ -209,7 +209,7 @@ def plugin_remove(package_name): return if package_name == 'autostart': - print("Remove cradtbeerpi.service from systemd") + print("Remove craftbeerpi.service from systemd") try: status = os.popen('systemctl list-units --type=service --state=running | grep craftbeerpi.service').read() if status.find("craftbeerpi.service") != -1: diff --git a/cbpi/controller/upload_controller.py b/cbpi/controller/upload_controller.py index 19d911e..c523b47 100644 --- a/cbpi/controller/upload_controller.py +++ b/cbpi/controller/upload_controller.py @@ -465,8 +465,12 @@ class UploadController: async with bf_session.get(self.bf_url) as r: bf_recipe = await r.json() await bf_session.close() - + if bf_recipe !="": + try: + StrikeTemp=bf_recipe['data']['strikeTemp'] + except: + StrikeTemp = None RecipeName = bf_recipe['name'] BoilTime = bf_recipe['boilTime'] mash_steps=bf_recipe['mash']['steps'] @@ -509,6 +513,7 @@ class UploadController: MashIn_Flag = False elif self.addmashin == "Yes": + mashin_temp = str(round(StrikeTemp)) if StrikeTemp is not None else step_temp step_type = self.mashin if self.mashin != "" else "MashInStep" Notification = "Target temperature reached. Please add malt." MashIn_Flag = False @@ -517,7 +522,7 @@ class UploadController: "AutoMode": self.AutoMode, "Kettle": self.id, "Sensor": self.kettle.sensor, - "Temp": step_temp, + "Temp": mashin_temp, "Timer": 0, "Notification": Notification }, diff --git a/cbpi/extension/mashstep/__init__.py b/cbpi/extension/mashstep/__init__.py index 7a17772..f6cf6cc 100644 --- a/cbpi/extension/mashstep/__init__.py +++ b/cbpi/extension/mashstep/__init__.py @@ -175,9 +175,12 @@ class MashStep(CBPiStep): if self.cbpi.kettle is not None and self.timer is None: self.timer = Timer(int(self.props.get("Timer",0)) *60 ,on_update=self.on_timer_update, on_done=self.on_timer_done) -# elif self.cbpi.kettle is not None and self.timer: -# self.timer.start() -# self.timer.is_running = True + elif self.cbpi.kettle is not None: + try: + if self.timer.is_running == True: + self.timer.start() + except: + pass self.summary = "Waiting for Target Temp" await self.push_update() @@ -245,7 +248,7 @@ class WaitStep(CBPiStep): return StepResult.DONE -@parameters([Property.Select(label="toggle_type", options=["On", "Off"],description="Choose if Actor shuold be switched on or off in this step"), +@parameters([Property.Select(label="toggle_type", options=["On", "Off"],description="Choose if Actor should be switched on or off in this step"), Property.Actor(label="Actor",description="Actor that should be toggled during this step")]) class ToggleStep(CBPiStep): async def on_timer_done(self, timer): @@ -374,9 +377,13 @@ class BoilStep(CBPiStep): if self.cbpi.kettle is not None and self.timer is None: self.timer = Timer(int(self.props.get("Timer", 0)) *60 ,on_update=self.on_timer_update, on_done=self.on_timer_done) -# elif self.cbpi.kettle is not None and self.timer: -# self.timer.start() -# self.timer.is_running = True + + elif self.cbpi.kettle is not None: + try: + if self.timer.is_running == True: + self.timer.start() + except: + pass self.summary = "Waiting for Target Temp" if self.AutoMode == True: From 7c8351e06801ae0ce0876c4decfda1a467ddc481 Mon Sep 17 00:00:00 2001 From: avollkopf <43980694+avollkopf@users.noreply.github.com> Date: Wed, 3 Nov 2021 09:35:59 +0100 Subject: [PATCH 2/3] Update __init__.py --- cbpi/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cbpi/__init__.py b/cbpi/__init__.py index cc45160..a23d46a 100644 --- a/cbpi/__init__.py +++ b/cbpi/__init__.py @@ -1 +1 @@ -__version__ = "4.0.0.41" +__version__ = "4.0.0.42" From c43a0a25bf3e7738ea5f037043665ea80c0b297c Mon Sep 17 00:00:00 2001 From: avollkopf <43980694+avollkopf@users.noreply.github.com> Date: Wed, 3 Nov 2021 12:53:34 +0100 Subject: [PATCH 3/3] Fix for StrikeTemp in case you operate system in F BF i sending all temps in C and striketemp needs to be converterd to F if cbpi4 is running in F --- cbpi/controller/upload_controller.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cbpi/controller/upload_controller.py b/cbpi/controller/upload_controller.py index c523b47..dcfcba8 100644 --- a/cbpi/controller/upload_controller.py +++ b/cbpi/controller/upload_controller.py @@ -470,7 +470,11 @@ class UploadController: try: StrikeTemp=bf_recipe['data']['strikeTemp'] except: - StrikeTemp = None + StrikeTemp = None + # BF is sending all Temeprature values in °C. If system is running in F, values need to be converted + if StrikeTemp is not None and self.TEMP_UNIT != "C": + StrikeTemp = round((9.0 / 5.0 * float(StrikeTemp)+ 32)) + RecipeName = bf_recipe['name'] BoilTime = bf_recipe['boilTime'] mash_steps=bf_recipe['mash']['steps']