Added BoilKettle to settings

- Boilkettle is used for Boil, Whirlpool and Cooldown step
- If no kettle is selected, standard MASH_TUN will be used for these steps
This commit is contained in:
avollkopf 2021-09-21 18:06:23 +02:00
parent e1e7de2924
commit bd2cb1b497
3 changed files with 27 additions and 6 deletions

View file

@ -1 +1 @@
__version__ = "4.0.0.36" __version__ = "4.0.0.37"

View file

@ -262,7 +262,7 @@ class UploadController:
step_string = { "name": "Boil Step", step_string = { "name": "Boil Step",
"props": { "props": {
"AutoMode": self.AutoMode, "AutoMode": self.AutoMode,
"Kettle": self.id, "Kettle": self.boilid,
"Sensor": self.kettle.sensor, "Sensor": self.kettle.sensor,
"Temp": int(self.BoilTemp), "Temp": int(self.BoilTemp),
"Timer": BoilTime, "Timer": BoilTime,
@ -388,7 +388,7 @@ class UploadController:
# Boil step including hop alarms and alarm for first wort hops -> Automode is set tu yes # Boil step including hop alarms and alarm for first wort hops -> Automode is set tu yes
Hops = self.getBoilAlerts(hops, miscs, "xml") Hops = self.getBoilAlerts(hops, miscs, "xml")
step_kettle = self.id step_kettle = self.boilid
step_type = self.boil if self.boil != "" else "BoilStep" step_type = self.boil if self.boil != "" else "BoilStep"
step_time = str(int(boil_time)) step_time = str(int(boil_time))
step_temp = self.BoilTemp step_temp = self.BoilTemp
@ -570,7 +570,7 @@ class UploadController:
# Boil step including hop alarms and alarm for first wort hops -> Automode is set tu yes # Boil step including hop alarms and alarm for first wort hops -> Automode is set tu yes
Hops = self.getBoilAlerts(hops , miscs, "bf") Hops = self.getBoilAlerts(hops , miscs, "bf")
step_kettle = self.id step_kettle = self.boilid
step_time = str(int(BoilTime)) step_time = str(int(BoilTime))
step_type = self.boil if self.boil != "" else "BoilStep" step_type = self.boil if self.boil != "" else "BoilStep"
step_temp = self.BoilTemp step_temp = self.BoilTemp
@ -669,7 +669,7 @@ class UploadController:
if self.cooldown != "WaiStep" and self.cooldown !="": if self.cooldown != "WaiStep" and self.cooldown !="":
step_string = { "name": "Whirlpool", step_string = { "name": "Whirlpool",
"props": { "props": {
"Kettle": self.id, "Kettle": self.boilid,
"Timer": "15" "Timer": "15"
}, },
"status_text": "", "status_text": "",
@ -692,7 +692,7 @@ class UploadController:
step_temp = int(self.CoolDownTemp) step_temp = int(self.CoolDownTemp)
step_string = { "name": "Cooldown", step_string = { "name": "Cooldown",
"props": { "props": {
"Kettle": self.id, "Kettle": self.boilid,
"Timer": step_timer, "Timer": step_timer,
"Temp": step_temp, "Temp": step_temp,
"Sensor": cooldown_sensor "Sensor": cooldown_sensor
@ -705,6 +705,7 @@ class UploadController:
def get_config_values(self): def get_config_values(self):
self.kettle = None self.kettle = None
self.boilkettle = None
#Define MashSteps #Define MashSteps
self.TEMP_UNIT = self.cbpi.config.get("TEMP_UNIT", "C") self.TEMP_UNIT = self.cbpi.config.get("TEMP_UNIT", "C")
self.AutoMode = self.cbpi.config.get("AutoMode", "Yes") self.AutoMode = self.cbpi.config.get("AutoMode", "Yes")
@ -720,6 +721,9 @@ class UploadController:
self.CoolDownTemp = self.cbpi.config.get("steps_cooldown_temp", 25) self.CoolDownTemp = self.cbpi.config.get("steps_cooldown_temp", 25)
# get default Kettle from Settings # get default Kettle from Settings
self.id = self.cbpi.config.get('MASH_TUN', None) self.id = self.cbpi.config.get('MASH_TUN', None)
self.boilid = self.cbpi.config.get('BoilKettle', None)
if self.boilid is None:
self.boilid = self.id
# If next parameter is Yes, MashIn Ste will be added before first mash step if not included in recipe # If next parameter is Yes, MashIn Ste will be added before first mash step if not included in recipe
self.addmashin = self.cbpi.config.get('AddMashInStep', "Yes") self.addmashin = self.cbpi.config.get('AddMashInStep', "Yes")
@ -727,8 +731,15 @@ class UploadController:
self.kettle = self.cbpi.kettle.find_by_id(self.id) self.kettle = self.cbpi.kettle.find_by_id(self.id)
except: except:
self.cbpi.notify('Recipe Upload', 'No default Kettle defined. Please specify default Kettle in settings', NotificationType.ERROR) self.cbpi.notify('Recipe Upload', 'No default Kettle defined. Please specify default Kettle in settings', NotificationType.ERROR)
try:
self.boilkettle = self.cbpi.kettle.find_by_id(self.boilid)
except:
pass
config_values = { "kettle": self.kettle, config_values = { "kettle": self.kettle,
"kettle_id": str(self.id), "kettle_id": str(self.id),
"boilkettle": self.boilkettle,
"boilkettle_id": str(self.boilid),
"mashin": str(self.mashin), "mashin": str(self.mashin),
"mash": str(self.mash), "mash": str(self.mash),
"mashout": str(self.mashout), "mashout": str(self.mashout),
@ -740,6 +751,7 @@ class UploadController:
"temp_unit": str(self.TEMP_UNIT), "temp_unit": str(self.TEMP_UNIT),
"AutoMode": str(self.AutoMode) "AutoMode": str(self.AutoMode)
} }
logging.info(config_values)
return config_values return config_values
async def create_recipe(self, name): async def create_recipe(self, name):

View file

@ -165,6 +165,15 @@ class ConfigUpdate(CBPiExtension):
except: except:
logger.warning('Unable to update config') logger.warning('Unable to update config')
## Check if Kettle for Boil, Whirlpool and Cooldown is in config
BoilKettle = self.cbpi.config.get("BoilKettle", None)
if BoilKettle is None:
logger.info("INIT BoilKettle")
try:
await self.cbpi.config.add("BoilKettle", "", ConfigType.KETTLE, "Define Kettle that is used for Boil, Whirlpool and Cooldown. If not selected, MASH_TUN will be used")
except:
logger.warning('Unable to update config')
def setup(cbpi): def setup(cbpi):
cbpi.plugin.register("ConfigUpdate", ConfigUpdate) cbpi.plugin.register("ConfigUpdate", ConfigUpdate)