From a0e89fe4dcad7d65bbb4aed58d304fee07b9487c Mon Sep 17 00:00:00 2001 From: avollkopf <43980694+avollkopf@users.noreply.github.com> Date: Sat, 20 Nov 2021 11:13:51 +0100 Subject: [PATCH 1/2] Update kettle controller/mashsteps --- cbpi/__init__.py | 2 +- cbpi/controller/kettle_controller.py | 12 ++++++++++-- cbpi/extension/mashstep/__init__.py | 6 +++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cbpi/__init__.py b/cbpi/__init__.py index 4efd974..8ec8c56 100644 --- a/cbpi/__init__.py +++ b/cbpi/__init__.py @@ -1 +1 @@ -__version__ = "4.0.0.45" +__version__ = "4.0.0.46" diff --git a/cbpi/controller/kettle_controller.py b/cbpi/controller/kettle_controller.py index c00b790..a97d75b 100644 --- a/cbpi/controller/kettle_controller.py +++ b/cbpi/controller/kettle_controller.py @@ -23,7 +23,7 @@ class KettleController(BasicController): await item.instance.stop() await self.push_udpate() except Exception as e: - logging.error("Faild to switch on KettleLogic {} {}".format(id, e)) + logging.error("Failed to switch on KettleLogic {} {}".format(id, e)) async def set_target_temp(self, id, target_temp): try: @@ -31,5 +31,13 @@ class KettleController(BasicController): item.target_temp = target_temp await self.save() except Exception as e: - logging.error("Faild to set Target Temp {} {}".format(id, e)) + logging.error("Failed to set Target Temp {} {}".format(id, e)) + async def stop(self, id): + try: + logging.info("Stop Kettele {}".format(id)) + item = self.find_by_id(id) + await item.instance.stop() + await self.push_udpate() + except Exception as e: + logging.error("Failed to switch off KettleLogic {} {}".format(id, e)) diff --git a/cbpi/extension/mashstep/__init__.py b/cbpi/extension/mashstep/__init__.py index f6cf6cc..2fe8dfd 100644 --- a/cbpi/extension/mashstep/__init__.py +++ b/cbpi/extension/mashstep/__init__.py @@ -119,7 +119,7 @@ class MashInStep(CBPiStep): if (self.kettle.instance is None or self.kettle.instance.state == False) and (auto_state is True): await self.cbpi.kettle.toggle(self.kettle.id) elif (self.kettle.instance.state == True) and (auto_state is False): - await self.kettle.instance.stop() + await self.cbpi.kettle.stop(self.kettle.id) await self.push_update() except Exception as e: @@ -211,7 +211,7 @@ class MashStep(CBPiStep): if (self.kettle.instance is None or self.kettle.instance.state == False) and (auto_state is True): await self.cbpi.kettle.toggle(self.kettle.id) elif (self.kettle.instance.state == True) and (auto_state is False): - await self.kettle.instance.stop() + await self.cbpi.kettle.stop(self.kettle.id) await self.push_update() except Exception as e: @@ -436,7 +436,7 @@ class BoilStep(CBPiStep): if (self.kettle.instance is None or self.kettle.instance.state == False) and (auto_state is True): await self.cbpi.kettle.toggle(self.kettle.id) elif (self.kettle.instance.state == True) and (auto_state is False): - await self.kettle.instance.stop() + await self.cbpi.kettle.stop(self.kettle.id) await self.push_update() except Exception as e: From 19f3a16154fdfb69181fa92440b7e2cda17bad5d Mon Sep 17 00:00:00 2001 From: avollkopf <43980694+avollkopf@users.noreply.github.com> Date: Sun, 21 Nov 2021 13:59:54 +0100 Subject: [PATCH 2/2] minor bug fix Error message showed up when no instance of kettle was active --- cbpi/__init__.py | 2 +- cbpi/controller/kettle_controller.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cbpi/__init__.py b/cbpi/__init__.py index 8ec8c56..7455d4e 100644 --- a/cbpi/__init__.py +++ b/cbpi/__init__.py @@ -1 +1 @@ -__version__ = "4.0.0.46" +__version__ = "4.0.0.47" diff --git a/cbpi/controller/kettle_controller.py b/cbpi/controller/kettle_controller.py index a97d75b..3c26a95 100644 --- a/cbpi/controller/kettle_controller.py +++ b/cbpi/controller/kettle_controller.py @@ -35,9 +35,10 @@ class KettleController(BasicController): async def stop(self, id): try: - logging.info("Stop Kettele {}".format(id)) + logging.info("Stop Kettle {}".format(id)) item = self.find_by_id(id) - await item.instance.stop() + if item.instance: + await item.instance.stop() await self.push_udpate() except Exception as e: logging.error("Failed to switch off KettleLogic {} {}".format(id, e))