updated libs and fix eventloop from lib_update branch

This commit is contained in:
avollkopf 2022-03-02 12:35:16 +01:00
parent 3cf48fff04
commit 662e8b4497
6 changed files with 17 additions and 12 deletions

View file

@ -1 +1 @@
__version__ = "4.0.2.0.a9" __version__ = "4.0.2.0.a10"

View file

@ -22,7 +22,7 @@ class BasicController:
self.logger = logging.getLogger(__name__) self.logger = logging.getLogger(__name__)
self.data = [] self.data = []
self.autostart = True self.autostart = True
self._loop = asyncio.get_event_loop() #self._loop = asyncio.get_event_loop()
self.path = os.path.join(".", 'config', file) self.path = os.path.join(".", 'config', file)
self.cbpi.app.on_cleanup.append(self.shutdown) self.cbpi.app.on_cleanup.append(self.shutdown)
@ -100,7 +100,8 @@ class BasicController:
await item.instance.start() await item.instance.start()
item.instance.running = True 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)) logging.info("{} started {}".format(self.name, id))

View file

@ -95,7 +95,7 @@ class FermentationController:
self.cbpi = cbpi self.cbpi = cbpi
self.logger = logging.getLogger(__name__) self.logger = logging.getLogger(__name__)
self.path = os.path.join(".", 'config', "fermenter_data.json") self.path = os.path.join(".", 'config', "fermenter_data.json")
self._loop = asyncio.get_event_loop() #self._loop = asyncio.get_event_loop()
self.data = [] self.data = []
self.types = {} self.types = {}
self.steptypes = {} self.steptypes = {}
@ -480,7 +480,8 @@ class FermentationController:
await item.instance.start() await item.instance.start()
item.instance.running = True 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)) logging.info("{} started {}".format(item.name, id))

View file

@ -20,7 +20,7 @@ class StepController:
self.cbpi = cbpi self.cbpi = cbpi
self.logger = logging.getLogger(__name__) self.logger = logging.getLogger(__name__)
self.path = os.path.join(".", 'config', "step_data.json") 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.basic_data = {}
self.step = None self.step = None
self.types = {} self.types = {}
@ -68,8 +68,9 @@ class StepController:
self.profile = list(map(lambda item: self.create(item), self.profile)) self.profile = list(map(lambda item: self.create(item), self.profile))
if startActive is True: if startActive is True:
active_step = self.find_by_status("A") active_step = self.find_by_status("A")
if active_step is not None: if active_step is not None:
self._loop.create_task(self.start_step(active_step)) 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): async def add(self, item: Step):
logging.debug("Add step") logging.debug("Add step")

View file

@ -217,6 +217,8 @@ class FermenterStep(CBPiFermentationStep):
if self.endtime != 0 and self.timer is not None and self.timer.is_running == False: if self.endtime != 0 and self.timer is not None and self.timer.is_running == False:
self.timer.start() self.timer.start()
self.timer.is_running = True 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" self.summary = "Waiting for Target Temp"

View file

@ -30,13 +30,13 @@ setup(name='cbpi',
python_requires='>=3.9', python_requires='>=3.9',
install_requires=[ install_requires=[
"aiohttp==3.7.4", "aiohttp==3.8.1",
"aiohttp-auth==0.1.1", "aiohttp-auth==0.1.1",
"aiohttp-route-decorator==0.1.4", "aiohttp-route-decorator==0.1.4",
"aiohttp-security==0.4.0", "aiohttp-security==0.4.0",
"aiohttp-session==2.9.0", "aiohttp-session==2.11.0",
"aiohttp-swagger==1.0.15", "aiohttp-swagger==1.0.16",
"aiojobs==0.3.0 ", "aiojobs==1.0.0 ",
"aiosqlite==0.17.0", "aiosqlite==0.17.0",
"cryptography==36.0.1", "cryptography==36.0.1",
"requests==2.27.1", "requests==2.27.1",