craftbeerpi / craftbeerpi4

GNU General Public License v3.0
133 stars 83 forks source link

Recipe Handling - Active recipe can't be saved #54

Closed avollkopf closed 2 years ago

avollkopf commented 3 years ago

Recipes can only be saved from the recipe book. However, if the active recipe is changed or a recipe is created directly in the 'MashProfile', it can't be saved. This behavior may cause confusion.

Proposal: Either recipes can only be modified created in the recipe book or it should be also possible to save them directly from the mash profile.

avollkopf commented 3 years ago

@Manuel83 I have started to test really basic xml import for recipes. I am currently 'using' a custom actor plugin with a custom action.

For testing I just created an upload directoy under the config path and stored a beer.xml file.

beerxml reading seems to work so far.

{'action': 'load_xml', 'parameter': {}}
2021-03-11 20:52:43,805 - INFO - root - ActorController call all Action CUvcuTHnxL4h8ckmgD84ZM load_xml
2021-03-11 20:52:43,805 - INFO - cbpi4-RecipeImport - ./config/upload/beer.xml
2021-03-11 20:52:43,821 - INFO - cbpi4-RecipeImport - RecipeName:Cape Disappointment Pils
2021-03-11 20:52:43,827 - INFO - cbpi4-RecipeImport - BoilTime:90.0
2021-03-11 20:52:43,833 - INFO - cbpi4-RecipeImport - BoilAlerts:70.0
2021-03-11 20:52:43,833 - INFO - cbpi4-RecipeImport - BoilAlerts:10.0
2021-03-11 20:52:43,834 - INFO - cbpi4-RecipeImport - BoilAlerts:3.0
2021-03-11 20:52:43,839 - INFO - cbpi4-RecipeImport - FirstWortAlert:[60.0]
2021-03-11 20:52:43,845 - INFO - cbpi4-RecipeImport - Step:{'name': 'Malzrohr Einbauen', 'temp': 42.0, 'timer': 0.0}
2021-03-11 20:52:43,845 - INFO - cbpi4-RecipeImport - Step:{'name': 'Maischeschritt', 'temp': 43.0, 'timer': 20.0}
2021-03-11 20:52:43,846 - INFO - cbpi4-RecipeImport - Step:{'name': 'Maltoserast', 'temp': 63.0, 'timer': 40.0}
2021-03-11 20:52:43,846 - INFO - cbpi4-RecipeImport - Step:{'name': 'Verzuckerungsrast', 'temp': 72.0, 'timer': 40.0}
2021-03-11 20:52:43,846 - INFO - cbpi4-RecipeImport - Step:{'name': 'Abmaischen', 'temp': 78.0, 'timer': 10.0}

I guess I could now also create a recipe via the recipe_controlle -> create. It is just not clear to me on how to add steps to the created recipe. I somehow miss the link between the step controller and the recipe controller. I am also not sure how it would work through the api.

Do you have any recommendation?

Manuel83 commented 3 years ago

Yes, currently you manage recipes in the recipe book and load them. I agree with you it would be nice to save them back to the recipe book.

avollkopf commented 3 years ago

@Manuel83 How do you add steps in the recipe_book. The http endpoints do not seem to include this and I also can't find that in the recipe controller. A recipe can be created, saved, started cloned and deleted. But no steps can be added from the controller. Is this all currently handled from the client side? If this functionality would be also in the controller, one could start to add a rudimentary recipe upload function.

avollkopf commented 3 years ago

This feature will be added with these commits: https://github.com/Manuel83/craftbeerpi4/pull/80/commits/40020ba64d7d648bf56b93bd1352e9e4bc4accf8

https://github.com/Manuel83/craftbeerpi4-ui/pull/4/commits/70451d07ca574e5c9e3352b12c871f9490b1ddda

avollkopf commented 2 years ago

Implemented in my fork