Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve robustness of Fermentation Hysteresis #221

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions modules/base_plugins/fermenter_hysteresis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,27 @@ def stop(self):
def run(self):
while self.is_running():

target_temp = self.get_target_temp()
temp = self.get_temp()
try:

if temp + float(self.heater_offset_min) <= target_temp:
self.heater_on(100)
target_temp = self.get_target_temp()
temp = self.get_temp()

if temp + float(self.heater_offset_max) >= target_temp:
self.heater_off()
if target_temp is not None and temp is not None:

if temp >= target_temp + float(self.cooler_offset_min):
self.cooler_on(100)
if temp + float(self.heater_offset_min) <= target_temp:
self.heater_on(100)

if temp <= target_temp + float(self.cooler_offset_max):
self.cooler_off()
if temp + float(self.heater_offset_max) >= target_temp:
self.heater_off()

if temp >= target_temp + float(self.cooler_offset_min):
self.cooler_on(100)

if temp <= target_temp + float(self.cooler_offset_max):
self.cooler_off()

except Exception as e:
cbpi.notify("Fermentation Loop Stuck", "Please check the CraftBeerPi system.\r\nError %s" % (str(e)), type="danger", timeout=None)
self.sleep(60)

self.sleep(1)