call bf recipes at startup and add list to state parameters. -> recudtion of bf api calls

This commit is contained in:
avollkopf 2024-06-29 07:02:15 +02:00
parent 3bf8a9ba6b
commit 598f1e9dce
3 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,3 @@
__version__ = "4.4.2.a4"
__version__ = "4.4.2.a5"
__codename__ = "Yeast Starter"

View file

@ -43,6 +43,7 @@ class SystemHttpEndpoints:
fermentersteps=self.cbpi.fermenter.get_fermenter_steps(),
config=self.cbpi.config.get_state(),
notifications=self.cbpi.notification.get_state(),
bf_recipes=await self.cbpi.upload.get_brewfather_recipes(0),
version=__version__,
guiversion=version,
codename=__codename__)

View file

@ -159,6 +159,23 @@ class UploadHttpEndpoints():
return web.json_response(bf_list)
@request_mapping(path='/bfupdate/', method="GET", auth_required=False)
async def get_bf_update(self, request):
"""
---
description: Get recipe list update from Brewfather App
tags:
- Upload
responses:
"200":
description: successful operation
"""
#offset = request.match_info['offset']
bf_list = await self.controller.get_brewfather_recipes()
self.cbpi.ws.send(dict(topic="bfupdate", data=bf_list))
return web.Response(status=200)
@request_mapping(path='/bf', method="POST", auth_required=False)
async def create_bf_recipe(self, request):
"""