BF StrikeTemp test and some fixes

This commit is contained in:
avollkopf 2021-11-03 09:30:16 +01:00
parent ee2acda2e3
commit 326d24c48f
3 changed files with 23 additions and 11 deletions

View file

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

View file

@ -465,8 +465,12 @@ class UploadController:
async with bf_session.get(self.bf_url) as r: async with bf_session.get(self.bf_url) as r:
bf_recipe = await r.json() bf_recipe = await r.json()
await bf_session.close() await bf_session.close()
if bf_recipe !="": if bf_recipe !="":
try:
StrikeTemp=bf_recipe['data']['strikeTemp']
except:
StrikeTemp = None
RecipeName = bf_recipe['name'] RecipeName = bf_recipe['name']
BoilTime = bf_recipe['boilTime'] BoilTime = bf_recipe['boilTime']
mash_steps=bf_recipe['mash']['steps'] mash_steps=bf_recipe['mash']['steps']
@ -509,6 +513,7 @@ class UploadController:
MashIn_Flag = False MashIn_Flag = False
elif self.addmashin == "Yes": 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" step_type = self.mashin if self.mashin != "" else "MashInStep"
Notification = "Target temperature reached. Please add malt." Notification = "Target temperature reached. Please add malt."
MashIn_Flag = False MashIn_Flag = False
@ -517,7 +522,7 @@ class UploadController:
"AutoMode": self.AutoMode, "AutoMode": self.AutoMode,
"Kettle": self.id, "Kettle": self.id,
"Sensor": self.kettle.sensor, "Sensor": self.kettle.sensor,
"Temp": step_temp, "Temp": mashin_temp,
"Timer": 0, "Timer": 0,
"Notification": Notification "Notification": Notification
}, },

View file

@ -175,9 +175,12 @@ class MashStep(CBPiStep):
if self.cbpi.kettle is not None and self.timer is None: 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) 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: elif self.cbpi.kettle is not None:
# self.timer.start() try:
# self.timer.is_running = True if self.timer.is_running == True:
self.timer.start()
except:
pass
self.summary = "Waiting for Target Temp" self.summary = "Waiting for Target Temp"
await self.push_update() await self.push_update()
@ -245,7 +248,7 @@ class WaitStep(CBPiStep):
return StepResult.DONE 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")]) Property.Actor(label="Actor",description="Actor that should be toggled during this step")])
class ToggleStep(CBPiStep): class ToggleStep(CBPiStep):
async def on_timer_done(self, timer): 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: 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) 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() elif self.cbpi.kettle is not None:
# self.timer.is_running = True try:
if self.timer.is_running == True:
self.timer.start()
except:
pass
self.summary = "Waiting for Target Temp" self.summary = "Waiting for Target Temp"
if self.AutoMode == True: if self.AutoMode == True: