diff --git a/cbpi/__init__.py b/cbpi/__init__.py index d719dda..d10ec7f 100644 --- a/cbpi/__init__.py +++ b/cbpi/__init__.py @@ -1 +1 @@ -__version__ = "4.0.2.0.a9" +__version__ = "4.0.2.0.a10" diff --git a/cbpi/controller/basic_controller2.py b/cbpi/controller/basic_controller2.py index 53c3445..990f54e 100644 --- a/cbpi/controller/basic_controller2.py +++ b/cbpi/controller/basic_controller2.py @@ -22,7 +22,7 @@ class BasicController: self.logger = logging.getLogger(__name__) self.data = [] self.autostart = True - self._loop = asyncio.get_event_loop() + #self._loop = asyncio.get_event_loop() self.path = os.path.join(".", 'config', file) self.cbpi.app.on_cleanup.append(self.shutdown) @@ -100,7 +100,8 @@ class BasicController: await item.instance.start() item.instance.running = True - item.instance.task = self._loop.create_task(item.instance._run()) + item.instance.task = asyncio.get_event_loop().create_task(item.instance._run()) + #item.instance.task = self._loop.create_task(item.instance._run()) logging.info("{} started {}".format(self.name, id)) diff --git a/cbpi/controller/fermentation_controller.py b/cbpi/controller/fermentation_controller.py index 5a8d294..c70ab63 100644 --- a/cbpi/controller/fermentation_controller.py +++ b/cbpi/controller/fermentation_controller.py @@ -95,7 +95,7 @@ class FermentationController: self.cbpi = cbpi self.logger = logging.getLogger(__name__) self.path = os.path.join(".", 'config', "fermenter_data.json") - self._loop = asyncio.get_event_loop() + #self._loop = asyncio.get_event_loop() self.data = [] self.types = {} self.steptypes = {} @@ -480,7 +480,8 @@ class FermentationController: await item.instance.start() item.instance.running = True - item.instance.task = self._loop.create_task(item.instance._run()) + item.instance.task = asyncio.get_event_loop().create_task(item.instance._run()) + #item.instance.task = self._loop.create_task(item.instance._run()) logging.info("{} started {}".format(item.name, id)) diff --git a/cbpi/controller/step_controller.py b/cbpi/controller/step_controller.py index 434e799..6632982 100644 --- a/cbpi/controller/step_controller.py +++ b/cbpi/controller/step_controller.py @@ -20,7 +20,7 @@ class StepController: self.cbpi = cbpi self.logger = logging.getLogger(__name__) self.path = os.path.join(".", 'config', "step_data.json") - self._loop = asyncio.get_event_loop() + #self._loop = asyncio.get_event_loop() self.basic_data = {} self.step = None self.types = {} @@ -68,8 +68,9 @@ class StepController: self.profile = list(map(lambda item: self.create(item), self.profile)) if startActive is True: active_step = self.find_by_status("A") - if active_step is not None: - self._loop.create_task(self.start_step(active_step)) + if active_step is not None: + asyncio.get_event_loop().create_task(self.start_step(active_step)) + #self._loop.create_task(self.start_step(active_step)) async def add(self, item: Step): logging.debug("Add step") diff --git a/cbpi/extension/FermentationStep/__init__.py b/cbpi/extension/FermentationStep/__init__.py index cf0c552..9f254f9 100644 --- a/cbpi/extension/FermentationStep/__init__.py +++ b/cbpi/extension/FermentationStep/__init__.py @@ -217,6 +217,8 @@ class FermenterStep(CBPiFermentationStep): if self.endtime != 0 and self.timer is not None and self.timer.is_running == False: self.timer.start() self.timer.is_running = True + estimated_completion_time = datetime.fromtimestamp(time.time()+ self.fermentationtime) + self.cbpi.notify(self.name, 'Timer restarted. Estimated completion: {}'.format(estimated_completion_time.strftime("%d.%m, %H:%M")), NotificationType.INFO) self.summary = "Waiting for Target Temp" diff --git a/setup.py b/setup.py index 82c23a0..5ce1179 100644 --- a/setup.py +++ b/setup.py @@ -30,13 +30,13 @@ setup(name='cbpi', python_requires='>=3.9', install_requires=[ - "aiohttp==3.7.4", + "aiohttp==3.8.1", "aiohttp-auth==0.1.1", "aiohttp-route-decorator==0.1.4", "aiohttp-security==0.4.0", - "aiohttp-session==2.9.0", - "aiohttp-swagger==1.0.15", - "aiojobs==0.3.0 ", + "aiohttp-session==2.11.0", + "aiohttp-swagger==1.0.16", + "aiojobs==1.0.0 ", "aiosqlite==0.17.0", "cryptography==36.0.1", "requests==2.27.1",