Merge pull request #3 from avollkopf/development

Using BF StrikeTemp for MashIn if available
This commit is contained in:
Alexander Vollkopf 2021-11-04 07:13:40 +01:00 committed by GitHub
commit d594870528
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 12 deletions

View file

@ -1 +1 @@
__version__ = "4.0.0.41"
__version__ = "4.0.0.42"

View file

@ -166,7 +166,7 @@ def plugins_add(package_name):
return
if package_name == 'autostart':
print("Add cradtbeerpi.service to systemd")
print("Add craftbeerpi.service to systemd")
try:
if os.path.exists(os.path.join("/etc/systemd/system","craftbeerpi.service")) is False:
srcfile = os.path.join(".", "config", "craftbeerpi.service")
@ -209,7 +209,7 @@ def plugin_remove(package_name):
return
if package_name == 'autostart':
print("Remove cradtbeerpi.service from systemd")
print("Remove craftbeerpi.service from systemd")
try:
status = os.popen('systemctl list-units --type=service --state=running | grep craftbeerpi.service').read()
if status.find("craftbeerpi.service") != -1:

View file

@ -465,8 +465,16 @@ class UploadController:
async with bf_session.get(self.bf_url) as r:
bf_recipe = await r.json()
await bf_session.close()
if bf_recipe !="":
try:
StrikeTemp=bf_recipe['data']['strikeTemp']
except:
StrikeTemp = None
# BF is sending all Temeprature values in °C. If system is running in F, values need to be converted
if StrikeTemp is not None and self.TEMP_UNIT != "C":
StrikeTemp = round((9.0 / 5.0 * float(StrikeTemp)+ 32))
RecipeName = bf_recipe['name']
BoilTime = bf_recipe['boilTime']
mash_steps=bf_recipe['mash']['steps']
@ -509,6 +517,7 @@ class UploadController:
MashIn_Flag = False
elif self.addmashin == "Yes":
mashin_temp = str(round(StrikeTemp)) if StrikeTemp is not None else step_temp
step_type = self.mashin if self.mashin != "" else "MashInStep"
Notification = "Target temperature reached. Please add malt."
MashIn_Flag = False
@ -517,7 +526,7 @@ class UploadController:
"AutoMode": self.AutoMode,
"Kettle": self.id,
"Sensor": self.kettle.sensor,
"Temp": step_temp,
"Temp": mashin_temp,
"Timer": 0,
"Notification": Notification
},

View file

@ -175,9 +175,12 @@ class MashStep(CBPiStep):
if self.cbpi.kettle is not None and self.timer is None:
self.timer = Timer(int(self.props.get("Timer",0)) *60 ,on_update=self.on_timer_update, on_done=self.on_timer_done)
# elif self.cbpi.kettle is not None and self.timer:
# self.timer.start()
# self.timer.is_running = True
elif self.cbpi.kettle is not None:
try:
if self.timer.is_running == True:
self.timer.start()
except:
pass
self.summary = "Waiting for Target Temp"
await self.push_update()
@ -245,7 +248,7 @@ class WaitStep(CBPiStep):
return StepResult.DONE
@parameters([Property.Select(label="toggle_type", options=["On", "Off"],description="Choose if Actor shuold be switched on or off in this step"),
@parameters([Property.Select(label="toggle_type", options=["On", "Off"],description="Choose if Actor should be switched on or off in this step"),
Property.Actor(label="Actor",description="Actor that should be toggled during this step")])
class ToggleStep(CBPiStep):
async def on_timer_done(self, timer):
@ -374,9 +377,13 @@ class BoilStep(CBPiStep):
if self.cbpi.kettle is not None and self.timer is None:
self.timer = Timer(int(self.props.get("Timer", 0)) *60 ,on_update=self.on_timer_update, on_done=self.on_timer_done)
# elif self.cbpi.kettle is not None and self.timer:
# self.timer.start()
# self.timer.is_running = True
elif self.cbpi.kettle is not None:
try:
if self.timer.is_running == True:
self.timer.start()
except:
pass
self.summary = "Waiting for Target Temp"
if self.AutoMode == True: