mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-10 01:17:42 +01:00
use current fermenter recipe name when sending recipe to fermenter
This commit is contained in:
parent
fc14c786a4
commit
ecbb2d404d
5 changed files with 13 additions and 9 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
@ -66,7 +66,7 @@ jobs:
|
||||||
BUILD_CACHE_IMAGE_NAME=${LATEST_IMAGE}
|
BUILD_CACHE_IMAGE_NAME=${LATEST_IMAGE}
|
||||||
TAGS="${LATEST_IMAGE},${{ env.image-name }}:v${VERSION}"
|
TAGS="${LATEST_IMAGE},${{ env.image-name }}:v${VERSION}"
|
||||||
PUBLISH_IMAGE=true
|
PUBLISH_IMAGE=true
|
||||||
elif [[ $GITHUB_REF_NAME == development ]] || [[ $GITHUB_REF_NAME == development_fermentersteps ]]; then
|
elif [[ $GITHUB_REF_NAME == development ]]; then
|
||||||
PUBLISH_IMAGE=true
|
PUBLISH_IMAGE=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
__version__ = "4.0.2.0.a14"
|
__version__ = "4.0.2.0.a15"
|
||||||
|
|
|
@ -540,7 +540,7 @@ class FermentationController:
|
||||||
with open(path, "w") as file:
|
with open(path, "w") as file:
|
||||||
yaml.dump(data, file)
|
yaml.dump(data, file)
|
||||||
|
|
||||||
async def load_recipe(self, data, fermenterid):
|
async def load_recipe(self, data, fermenterid, name):
|
||||||
try:
|
try:
|
||||||
await self.shutdown(None, fermenterid)
|
await self.shutdown(None, fermenterid)
|
||||||
except:
|
except:
|
||||||
|
@ -553,6 +553,9 @@ class FermentationController:
|
||||||
item["props"]["Sensor"] = fermenter.sensor
|
item["props"]["Sensor"] = fermenter.sensor
|
||||||
list(map(lambda item: add_runtime_data(item), data.get("steps")))
|
list(map(lambda item: add_runtime_data(item), data.get("steps")))
|
||||||
fermenter.description = data['basic']['desc']
|
fermenter.description = data['basic']['desc']
|
||||||
|
if name is not None:
|
||||||
|
fermenter.brewname = name
|
||||||
|
else:
|
||||||
fermenter.brewname = data['basic']['name']
|
fermenter.brewname = data['basic']['name']
|
||||||
fermenter.steps=[]
|
fermenter.steps=[]
|
||||||
await self.update(fermenter)
|
await self.update(fermenter)
|
||||||
|
|
|
@ -69,13 +69,13 @@ class FermenterRecipeController:
|
||||||
os.remove(path)
|
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)
|
logging.info(recipe_path)
|
||||||
with open(recipe_path) as file:
|
with open(recipe_path) as file:
|
||||||
data = yaml.load(file, Loader=yaml.FullLoader)
|
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):
|
async def clone(self, id, new_name):
|
||||||
recipe_path = os.path.join(".", 'config', "fermenterrecipes", "%s.yaml" % id)
|
recipe_path = os.path.join(".", 'config', "fermenterrecipes", "%s.yaml" % id)
|
||||||
|
|
|
@ -117,7 +117,7 @@ class FermenterRecipeHttpEndpoints():
|
||||||
await self.controller.remove(name)
|
await self.controller.remove(name)
|
||||||
return web.Response(status=204)
|
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):
|
async def http_brew(self, request):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -137,9 +137,10 @@ class FermenterRecipeHttpEndpoints():
|
||||||
"200":
|
"200":
|
||||||
description: successful operation
|
description: successful operation
|
||||||
"""
|
"""
|
||||||
|
recipeid = request.match_info['recipeid']
|
||||||
name = request.match_info['name']
|
name = request.match_info['name']
|
||||||
fermenterid = request.match_info['fermenterid']
|
fermenterid = request.match_info['fermenterid']
|
||||||
await self.controller.brew(name,fermenterid)
|
await self.controller.brew(recipeid,fermenterid,name)
|
||||||
return web.Response(status=204)
|
return web.Response(status=204)
|
||||||
|
|
||||||
@request_mapping(path="/{id}/clone", method="POST", auth_required=False)
|
@request_mapping(path="/{id}/clone", method="POST", auth_required=False)
|
||||||
|
|
Loading…
Reference in a new issue