Merge pull request #63 from prash3r/kbh-whirlpool-step

imports the whirlpool hop addition kbh with timer
This commit is contained in:
Alexander Vollkopf 2022-10-02 16:10:23 +02:00 committed by GitHub
commit 24ae03405c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -193,8 +193,14 @@ class UploadController:
pass pass
# get the hop addition times # get the hop addition times
c.execute('SELECT Zeit FROM Hopfengaben WHERE Vorderwuerze <> 1 AND Vorderwuerze <> 5 AND SudID = ?', (Recipe_ID,)) c.execute('SELECT Zeit FROM Hopfengaben WHERE Vorderwuerze <> 1 AND SudID = ?', (Recipe_ID,))
hops = c.fetchall() hops = c.fetchall()
whirlpool = []
for hop in hops:
if hop[0] < 0:
whirlpool.append(hop)
for whirl in whirlpool:
hops.remove(whirl)
# get the misc addition times # get the misc addition times
c.execute('SELECT Zugabedauer FROM WeitereZutatenGaben WHERE Zeitpunkt = 1 AND SudID = ?', (Recipe_ID,)) c.execute('SELECT Zugabedauer FROM WeitereZutatenGaben WHERE Zeitpunkt = 1 AND SudID = ?', (Recipe_ID,))
@ -307,8 +313,11 @@ class UploadController:
await self.create_step(step_string) await self.create_step(step_string)
await self.create_Whirlpool_Cooldown() if not whirlpool:
await self.create_Whirlpool_Cooldown()
else :
await self.create_Whirlpool_Cooldown(str(abs(whirlpool[0][0]))) # from kbh this value comes as negative but must be positive
self.cbpi.notify('KBH Recipe created', name, NotificationType.INFO) self.cbpi.notify('KBH Recipe created', name, NotificationType.INFO)
except: except:
@ -946,13 +955,13 @@ class UploadController:
alert="Yes" alert="Yes"
return alert return alert
async def create_Whirlpool_Cooldown(self): async def create_Whirlpool_Cooldown(self, time : str = "15"):
# Add Waitstep as Whirlpool # Add Waitstep as Whirlpool
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.boilid, "Kettle": self.boilid,
"Timer": "15" "Timer": time
}, },
"status_text": "", "status_text": "",
"status": "I", "status": "I",
@ -965,7 +974,7 @@ class UploadController:
step_name = "CoolDown" step_name = "CoolDown"
cooldown_sensor = "" cooldown_sensor = ""
step_temp = "" step_temp = ""
step_timer = "15" step_timer = time
if step_type == "CooldownStep": if step_type == "CooldownStep":
cooldown_sensor = self.cbpi.config.get("steps_cooldown_sensor", None) cooldown_sensor = self.cbpi.config.get("steps_cooldown_sensor", None)
if cooldown_sensor is None or cooldown_sensor == '': if cooldown_sensor is None or cooldown_sensor == '':