use current fermenter recipe name when sending recipe to fermenter

This commit is contained in:
avollkopf 2022-03-05 16:07:15 +01:00
parent fc14c786a4
commit ecbb2d404d
5 changed files with 13 additions and 9 deletions

View file

@ -66,7 +66,7 @@ jobs:
BUILD_CACHE_IMAGE_NAME=${LATEST_IMAGE}
TAGS="${LATEST_IMAGE},${{ env.image-name }}:v${VERSION}"
PUBLISH_IMAGE=true
elif [[ $GITHUB_REF_NAME == development ]] || [[ $GITHUB_REF_NAME == development_fermentersteps ]]; then
elif [[ $GITHUB_REF_NAME == development ]]; then
PUBLISH_IMAGE=true
fi

View file

@ -1 +1 @@
__version__ = "4.0.2.0.a14"
__version__ = "4.0.2.0.a15"

View file

@ -540,7 +540,7 @@ class FermentationController:
with open(path, "w") as file:
yaml.dump(data, file)
async def load_recipe(self, data, fermenterid):
async def load_recipe(self, data, fermenterid, name):
try:
await self.shutdown(None, fermenterid)
except:
@ -553,7 +553,10 @@ class FermentationController:
item["props"]["Sensor"] = fermenter.sensor
list(map(lambda item: add_runtime_data(item), data.get("steps")))
fermenter.description = data['basic']['desc']
fermenter.brewname = data['basic']['name']
if name is not None:
fermenter.brewname = name
else:
fermenter.brewname = data['basic']['name']
fermenter.steps=[]
await self.update(fermenter)
for item in data.get("steps"):

View file

@ -69,13 +69,13 @@ class FermenterRecipeController:
os.remove(path)
async def brew(self, name, fermenterid):
async def brew(self, recipeid, fermenterid, name):
recipe_path = os.path.join(".", 'config', "fermenterrecipes", "%s.yaml" % name)
recipe_path = os.path.join(".", 'config', "fermenterrecipes", "%s.yaml" % recipeid)
logging.info(recipe_path)
with open(recipe_path) as file:
data = yaml.load(file, Loader=yaml.FullLoader)
await self.cbpi.fermenter.load_recipe(data, fermenterid)
await self.cbpi.fermenter.load_recipe(data, fermenterid, name)
async def clone(self, id, new_name):
recipe_path = os.path.join(".", 'config', "fermenterrecipes", "%s.yaml" % id)

View file

@ -117,7 +117,7 @@ class FermenterRecipeHttpEndpoints():
await self.controller.remove(name)
return web.Response(status=204)
@request_mapping(path="/{name}/{fermenterid}/brew", method="POST", auth_required=False)
@request_mapping(path="/{recipeid}/{fermenterid}/{name}/brew", method="POST", auth_required=False)
async def http_brew(self, request):
"""
@ -137,9 +137,10 @@ class FermenterRecipeHttpEndpoints():
"200":
description: successful operation
"""
recipeid = request.match_info['recipeid']
name = request.match_info['name']
fermenterid = request.match_info['fermenterid']
await self.controller.brew(name,fermenterid)
await self.controller.brew(recipeid,fermenterid,name)
return web.Response(status=204)
@request_mapping(path="/{id}/clone", method="POST", auth_required=False)