mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-21 22:48:16 +01:00
adaption for kleiner Brauhelfer 2.6 database change (old DB version of KBH won't work)
This commit is contained in:
parent
50ff14184c
commit
72ea6ac2d7
2 changed files with 12 additions and 16 deletions
|
@ -1,3 +1,3 @@
|
||||||
__version__ = "4.1.12.a1"
|
__version__ = "4.2.0.a1"
|
||||||
__codename__ = "Groundhog Day"
|
__codename__ = "Indian Summer"
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ class UploadController:
|
||||||
# load beerxml file located in upload folder
|
# load beerxml file located in upload folder
|
||||||
self.path = self.cbpi.config_folder.get_upload_file("kbh.db")
|
self.path = self.cbpi.config_folder.get_upload_file("kbh.db")
|
||||||
if os.path.exists(self.path) is False:
|
if os.path.exists(self.path) is False:
|
||||||
self.cbpi.notify("File Not Found", "Please upload a kbh V2 databsel file", NotificationType.ERROR)
|
self.cbpi.notify("File Not Found", "Please upload a kbh V2 database file", NotificationType.ERROR)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Get Recipe Nmae
|
# Get Recipe Nmae
|
||||||
|
@ -179,19 +179,19 @@ class UploadController:
|
||||||
c.execute('SELECT Sudname FROM Sud WHERE ID = ?', (Recipe_ID,))
|
c.execute('SELECT Sudname FROM Sud WHERE ID = ?', (Recipe_ID,))
|
||||||
row = c.fetchone()
|
row = c.fetchone()
|
||||||
name = row[0]
|
name = row[0]
|
||||||
|
|
||||||
# get MashIn Temp
|
# get MashIn Temp
|
||||||
mashin_temp = None
|
mashin_temp = None
|
||||||
c.execute('SELECT Temp FROM Rasten WHERE Typ = 0 AND SudID = ?', (Recipe_ID,))
|
c.execute('SELECT TempWasser FROM Maischplan WHERE Typ = 0 AND SudID = ?', (Recipe_ID,))
|
||||||
row = c.fetchone()
|
row = c.fetchone()
|
||||||
try:
|
try:
|
||||||
if self.cbpi.config.get("TEMP_UNIT", "C") == "C":
|
if self.cbpi.config.get("TEMP_UNIT", "C") == "C":
|
||||||
mashin_temp = str(int(row[0]))
|
mashin_temp = str(float(row[0]))
|
||||||
else:
|
else:
|
||||||
mashin_temp = str(round(9.0 / 5.0 * int(row[0]) + 32))
|
mashin_temp = str(round(9.0 / 5.0 * float(row[0]) + 32))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
logging.error(mashin_temp)
|
||||||
# get the hop addition times
|
# get the hop addition times
|
||||||
c.execute('SELECT Zeit, Name FROM Hopfengaben WHERE Vorderwuerze <> 1 AND SudID = ?', (Recipe_ID,))
|
c.execute('SELECT Zeit, Name FROM Hopfengaben WHERE Vorderwuerze <> 1 AND SudID = ?', (Recipe_ID,))
|
||||||
hops = c.fetchall()
|
hops = c.fetchall()
|
||||||
|
@ -201,11 +201,9 @@ class UploadController:
|
||||||
whirlpool.append(hop)
|
whirlpool.append(hop)
|
||||||
for whirl in whirlpool:
|
for whirl in whirlpool:
|
||||||
hops.remove(whirl)
|
hops.remove(whirl)
|
||||||
|
|
||||||
# get the misc addition times
|
# get the misc addition times
|
||||||
c.execute('SELECT Zugabedauer, Name FROM WeitereZutatenGaben WHERE Zeitpunkt = 1 AND SudID = ?', (Recipe_ID,))
|
c.execute('SELECT Zugabedauer, Name FROM WeitereZutatenGaben WHERE Zeitpunkt = 1 AND SudID = ?', (Recipe_ID,))
|
||||||
miscs = c.fetchall()
|
miscs = c.fetchall()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
c.execute('SELECT Zeit, Name FROM Hopfengaben WHERE Vorderwuerze = 1 AND SudID = ?', (Recipe_ID,))
|
c.execute('SELECT Zeit, Name FROM Hopfengaben WHERE Vorderwuerze = 1 AND SudID = ?', (Recipe_ID,))
|
||||||
FW_Hops = c.fetchall()
|
FW_Hops = c.fetchall()
|
||||||
|
@ -216,9 +214,7 @@ class UploadController:
|
||||||
c.execute('SELECT Kochdauer FROM Sud WHERE ID = ?', (Recipe_ID,))
|
c.execute('SELECT Kochdauer FROM Sud WHERE ID = ?', (Recipe_ID,))
|
||||||
row = c.fetchone()
|
row = c.fetchone()
|
||||||
BoilTime = str(int(row[0]))
|
BoilTime = str(int(row[0]))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await self.create_recipe(name)
|
await self.create_recipe(name)
|
||||||
|
|
||||||
if mashin_temp is not None:
|
if mashin_temp is not None:
|
||||||
|
@ -238,7 +234,7 @@ class UploadController:
|
||||||
}
|
}
|
||||||
await self.create_step(step_string)
|
await self.create_step(step_string)
|
||||||
|
|
||||||
for row in c.execute('SELECT Name, Temp, Dauer FROM Rasten WHERE Typ <> 0 AND SudID = ?', (Recipe_ID,)):
|
for row in c.execute('SELECT Name, TempRast, DauerRast FROM Maischplan WHERE Typ <> 0 AND SudID = ?', (Recipe_ID,)):
|
||||||
if mashin_temp is None and self.addmashin == "Yes":
|
if mashin_temp is None and self.addmashin == "Yes":
|
||||||
step_type = self.mashin if self.mashin != "" else "MashInStep"
|
step_type = self.mashin if self.mashin != "" else "MashInStep"
|
||||||
step_string = { "name": "MashIn",
|
step_string = { "name": "MashIn",
|
||||||
|
@ -246,7 +242,7 @@ class UploadController:
|
||||||
"AutoMode": self.AutoMode,
|
"AutoMode": self.AutoMode,
|
||||||
"Kettle": self.id,
|
"Kettle": self.id,
|
||||||
"Sensor": self.kettle.sensor,
|
"Sensor": self.kettle.sensor,
|
||||||
"Temp": str(int(row[1])) if self.TEMP_UNIT == "C" else str(round(9.0 / 5.0 * int(row[1]) + 32)),
|
"Temp": str(float(row[1])) if self.TEMP_UNIT == "C" else str(round(9.0 / 5.0 * float(row[1]) + 32)),
|
||||||
"Timer": "0",
|
"Timer": "0",
|
||||||
"Notification": "Target temperature reached. Please add malt."
|
"Notification": "Target temperature reached. Please add malt."
|
||||||
},
|
},
|
||||||
|
@ -263,7 +259,7 @@ class UploadController:
|
||||||
"AutoMode": self.AutoMode,
|
"AutoMode": self.AutoMode,
|
||||||
"Kettle": self.id,
|
"Kettle": self.id,
|
||||||
"Sensor": self.kettle.sensor,
|
"Sensor": self.kettle.sensor,
|
||||||
"Temp": str(int(row[1])) if self.TEMP_UNIT == "C" else str(round(9.0 / 5.0 * int(row[1]) + 32)),
|
"Temp": str(float(row[1])) if self.TEMP_UNIT == "C" else str(round(9.0 / 5.0 * float(row[1]) + 32)),
|
||||||
"Timer": str(int(row[2]))
|
"Timer": str(int(row[2]))
|
||||||
},
|
},
|
||||||
"status_text": "",
|
"status_text": "",
|
||||||
|
|
Loading…
Reference in a new issue