mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-25 16:38:36 +01:00
add First_Wort_text and fix error in json_recipe_creation #367
This commit is contained in:
parent
2bc5bbb183
commit
d1c38af3ae
2 changed files with 28 additions and 10 deletions
|
@ -291,7 +291,8 @@ class UploadController:
|
|||
"Sensor": self.boilkettle.sensor,
|
||||
"Temp": int(self.BoilTemp),
|
||||
"Timer": BoilTime,
|
||||
"First_Wort": FirstWort,
|
||||
"First_Wort": FirstWort[0],
|
||||
"First_Wort_text": FirstWort[1],
|
||||
"LidAlert": "Yes",
|
||||
"Hop_1": Hops[0][0],
|
||||
"Hop_1_text": Hops[0][1],
|
||||
|
@ -363,7 +364,7 @@ class UploadController:
|
|||
elif e["Hopfen_{}_Kochzeit".format(idx)] == "Whirlpool":
|
||||
alert = float(1)
|
||||
else:
|
||||
self.api.notify(headline="No Number at Hoptime", message="Please change json-File at Hopfen_{}_Kochzeit".format(idx), type="danger")
|
||||
self.cbpi.notify("No Number at Hoptime", "Please change json-File at Hopfen_{}_Kochzeit".format(idx), NotificationType.ERROR)
|
||||
alert = float(1)
|
||||
hops.append({"name":hops_name,"time":alert})
|
||||
|
||||
|
@ -516,7 +517,8 @@ class UploadController:
|
|||
"Sensor": sensor,
|
||||
"Temp": step_temp,
|
||||
"Timer": step_time,
|
||||
"First_Wort": FirstWort,
|
||||
"First_Wort": FirstWort[0],
|
||||
"First_Wort_text": FirstWort[1],
|
||||
"LidAlert": LidAlert,
|
||||
"Hop_1": Hops[0][0],
|
||||
"Hop_1_text": Hops[0][1],
|
||||
|
@ -668,7 +670,8 @@ class UploadController:
|
|||
"Sensor": sensor,
|
||||
"Temp": step_temp,
|
||||
"Timer": step_time,
|
||||
"First_Wort": FirstWort,
|
||||
"First_Wort": FirstWort[0],
|
||||
"First_Wort_text": FirstWort[1],
|
||||
"LidAlert": LidAlert,
|
||||
"Hop_1": Hops[0][0],
|
||||
"Hop_1_text": Hops[0][1],
|
||||
|
@ -876,7 +879,8 @@ class UploadController:
|
|||
"Sensor": sensor,
|
||||
"Temp": step_temp,
|
||||
"Timer": step_time,
|
||||
"First_Wort": FirstWort,
|
||||
"First_Wort": FirstWort[0],
|
||||
"First_Wort_text": FirstWort[1],
|
||||
"LidAlert": LidAlert,
|
||||
"Hop_1": Hops[0][0],
|
||||
"Hop_1_text": Hops[0][1],
|
||||
|
@ -937,7 +941,7 @@ class UploadController:
|
|||
alerts.append([float(misc[0]), misc[1]])
|
||||
elif recipe_type == "json":
|
||||
alerts.append([float(misc['time']), misc['name']])
|
||||
## Dedupe and order the additions by their time, to prevent? multiple alerts at the same time
|
||||
## Dedupe and order the additions by their time
|
||||
## CBP should have these additions in reverse
|
||||
alerts = sorted(alerts, key=lambda x:x[0], reverse=True)
|
||||
hop_alerts = []
|
||||
|
@ -950,9 +954,12 @@ class UploadController:
|
|||
|
||||
def getFirstWort(self, hops, recipe_type):
|
||||
alert = "No"
|
||||
names = []
|
||||
if recipe_type == "kbh":
|
||||
if len(hops) != 0:
|
||||
alert = "Yes"
|
||||
for hop in hops:
|
||||
names.append(hop[1])
|
||||
elif recipe_type == "xml":
|
||||
for hop in hops:
|
||||
use = hop.find('USE').text
|
||||
|
@ -960,14 +967,19 @@ class UploadController:
|
|||
if use != 'First Wort':
|
||||
continue
|
||||
alert = "Yes"
|
||||
names.append(hop.find('NAME').text)
|
||||
elif recipe_type == "bf":
|
||||
for hop in hops:
|
||||
if hop['use'] == "First Wort":
|
||||
alert="Yes"
|
||||
names.append(hop['name']) ## TODO: Testing
|
||||
elif recipe_type == "json":
|
||||
for hop in hops:
|
||||
if len(hops) != 0:
|
||||
alert = "Yes"
|
||||
return alert
|
||||
for hop in hops:
|
||||
names.append(hop['name'])
|
||||
|
||||
return [alert, " and ".join(names)]
|
||||
|
||||
async def create_Whirlpool_Cooldown(self):
|
||||
# Add Waitstep as Whirlpool
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import asyncio
|
||||
from pickle import NONE
|
||||
|
||||
from cbpi.api import parameters, Property, action
|
||||
from cbpi.api.step import StepResult, CBPiStep
|
||||
|
@ -322,6 +323,7 @@ class ActorStep(CBPiStep):
|
|||
Property.Select(label="LidAlert",options=["Yes","No"], description="Trigger Alert to remove lid if temp is close to boil"),
|
||||
Property.Select(label="AutoMode",options=["Yes","No"], description="Switch Kettlelogic automatically on and off -> Yes"),
|
||||
Property.Select("First_Wort", options=["Yes","No"], description="First Wort Hop alert if set to Yes"),
|
||||
Property.Text("First_Wort_text", configurable = True, description="First Wort Hop alert text"),
|
||||
Property.Number("Hop_1", configurable = True, description="First Hop alert (minutes before finish)"),
|
||||
Property.Text("Hop_1_text", configurable = True, description="First Hop alert text"),
|
||||
Property.Number("Hop_2", configurable=True, description="Second Hop alert (minutes before finish)"),
|
||||
|
@ -373,6 +375,7 @@ class BoilStep(CBPiStep):
|
|||
self.AutoMode = True if self.props.get("AutoMode", "No") == "Yes" else False
|
||||
self.first_wort_hop_flag = False
|
||||
self.first_wort_hop=self.props.get("First_Wort", "No")
|
||||
self.first_wort_hop_text=self.props.get("First_Wort_text", None)
|
||||
self.hops_added=["","","","","",""]
|
||||
self.remaining_seconds = None
|
||||
|
||||
|
@ -418,6 +421,9 @@ class BoilStep(CBPiStep):
|
|||
async def run(self):
|
||||
if self.first_wort_hop_flag == False and self.first_wort_hop == "Yes":
|
||||
self.first_wort_hop_flag = True
|
||||
if self.first_wort_hop_text is not None and self.first_wort_hop_text != "":
|
||||
self.cbpi.notify('First Wort Hop Addition!', 'Please add %s for first wort' % self.first_wort_hop_text, NotificationType.INFO)
|
||||
else:
|
||||
self.cbpi.notify('First Wort Hop Addition!', 'Please add hops for first wort', NotificationType.INFO)
|
||||
|
||||
while self.running == True:
|
||||
|
|
Loading…
Reference in a new issue