add parameter for bf recipe list length

This commit is contained in:
avollkopf 2024-06-18 17:28:31 +02:00
parent 45592733da
commit 31aa275d96
2 changed files with 17 additions and 1 deletions

View file

@ -1,3 +1,3 @@
__version__ = "4.4.2.a2"
__version__ = "4.4.2.a3"
__codename__ = "Yeast Starter"

View file

@ -61,6 +61,7 @@ class ConfigUpdate(CBPiExtension):
AddMashIn = self.cbpi.config.get("AddMashInStep", None)
bfuserid = self.cbpi.config.get("brewfather_user_id", None)
bfapikey = self.cbpi.config.get("brewfather_api_key", None)
bflistlength = self.cbpi.config.get("brewfather_list_length", None)
RecipeCreationPath = self.cbpi.config.get("RECIPE_CREATION_PATH", None)
BoilKettle = self.cbpi.config.get("BoilKettle", None)
CONFIG_STATUS = self.cbpi.config.get("CONFIG_STATUS", None)
@ -244,6 +245,21 @@ class ConfigUpdate(CBPiExtension):
await self.cbpi.config.add("brewfather_api_key", "", type=ConfigType.STRING, description="Brewfather API Key", source="craftbeerpi")
except:
logger.warning('Unable to update config')
## Check if Brewfather API Key is in config
if bflistlength is None:
logger.info("INIT Brewfather Recipe List Length")
try:
await self.cbpi.config.add("brewfather_list_length", 50, type=ConfigType.SELECT, description="Brewfather Recipe List length",
source="craftbeerpi",
options= [{"label": "5", "value": 5},
{"label": "10", "value": 10},
{"label": "25", "value": 25},
{"label": "50", "value": 50},
{"label": "100", "value": 100}])
except:
logger.warning('Unable to update config')
## Check if Brewfather API Key is in config