mirror of
https://github.com/Manuel83/craftbeerpi3
synced 2026-09-19 15:59:07 +02:00
- Recipe Book
- BugFixes - Refactoring
This commit is contained in:
@@ -8,6 +8,7 @@ class Dummy(Actor):
|
||||
|
||||
@cbpi.addon.actor.action("WOHOO")
|
||||
def myaction(self):
|
||||
print "WOOHOO"
|
||||
pass
|
||||
|
||||
def on(self, power=100):
|
||||
@@ -29,6 +30,7 @@ class MyController(KettleController):
|
||||
def run(self):
|
||||
while self.is_running():
|
||||
|
||||
|
||||
self.sleep(1)
|
||||
|
||||
@cbpi.addon.fermenter.controller()
|
||||
@@ -38,6 +40,8 @@ class MyController2(FermenterController):
|
||||
def run(self):
|
||||
while self.is_running():
|
||||
print "HALLO"
|
||||
|
||||
self.get_target_temp()
|
||||
self.sleep(1)
|
||||
|
||||
@cbpi.addon.core.initializer(order=200)
|
||||
|
||||
@@ -24,7 +24,7 @@ class Dummy(Sensor):
|
||||
@cbpi.addon.sensor.action("WOHOO")
|
||||
def myaction(self):
|
||||
|
||||
print "SENSOR ACTION HALLO!!!"
|
||||
self.api.notify(headline="WOHOO", message="HALLO")
|
||||
|
||||
def execute(self):
|
||||
while True:
|
||||
@@ -32,7 +32,7 @@ class Dummy(Sensor):
|
||||
self.update_value(int(self.text))
|
||||
except:
|
||||
pass
|
||||
self.api.sleep(1)
|
||||
self.api.sleep(5)
|
||||
|
||||
@cbpi.addon.core.action(key="clear", label="Clear all Logs")
|
||||
def woohoo(cbpi):
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from modules.core.basetypes import Step
|
||||
from modules.core.core import cbpi
|
||||
from modules.core.proptypes import Property
|
||||
import time
|
||||
|
||||
|
||||
@cbpi.addon.step.type("Dummy Step")
|
||||
@@ -22,4 +23,223 @@ class Dummy(Step):
|
||||
|
||||
def reset(self):
|
||||
|
||||
self.stop_timer()
|
||||
self.stop_timer()
|
||||
|
||||
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
@cbpi.addon.step.type("Dummy Step")
|
||||
class MashStep(Step):
|
||||
'''
|
||||
Just put the decorator @cbpi.step on top of a method
|
||||
'''
|
||||
# Properties
|
||||
temp = Property.Number("Temperature", configurable=True, description="Target Temperature of Mash Step")
|
||||
kettle = Property.Kettle("Kettle", description="Kettle in which the mashing takes place")
|
||||
timer = Property.Number("Timer in Minutes", configurable=True, description="Timer is started when the target temperature is reached")
|
||||
|
||||
def init(self):
|
||||
'''
|
||||
Initialize Step. This method is called once at the beginning of the step
|
||||
:return:
|
||||
'''
|
||||
# set target tep
|
||||
self.set_target_temp(self.temp, self.kettle)
|
||||
|
||||
@cbpi.addon.step.action("Start Timer")
|
||||
def start(self):
|
||||
'''
|
||||
Custom Action which can be execute form the brewing dashboard.
|
||||
All method with decorator @cbpi.action("YOUR CUSTOM NAME") will be available in the user interface
|
||||
:return:
|
||||
'''
|
||||
if self.is_timer_finished() is None:
|
||||
self.start_timer(int(self.timer) * 60)
|
||||
|
||||
def reset(self):
|
||||
self.stop_timer()
|
||||
self.set_target_temp(self.temp, self.kettle)
|
||||
|
||||
def finish(self):
|
||||
self.set_target_temp(0, self.kettle)
|
||||
|
||||
def execute(self):
|
||||
'''
|
||||
This method is execute in an interval
|
||||
:return:
|
||||
'''
|
||||
|
||||
# Check if Target Temp is reached
|
||||
if self.get_kettle_temp(self.kettle) >= float(self.temp):
|
||||
# Check if Timer is Running
|
||||
if self.is_timer_finished() is None:
|
||||
self.start_timer(int(self.timer) * 60)
|
||||
|
||||
# Check if timer finished and go to next step
|
||||
if self.is_timer_finished() == True:
|
||||
self.notify("Mash Step Completed!", "Starting the next step", timeout=None)
|
||||
self.next()
|
||||
|
||||
|
||||
@cbpi.addon.step.type("MashInStep")
|
||||
class MashInStep(Step):
|
||||
'''
|
||||
Just put the decorator @cbpi.step on top of a method
|
||||
'''
|
||||
# Properties
|
||||
temp = Property.Number("Temperature", configurable=True, description="Target Temperature of Mash Step")
|
||||
kettle = Property.Kettle("Kettle", description="Kettle in which the mashing takes place")
|
||||
s = False
|
||||
|
||||
|
||||
def init(self):
|
||||
'''
|
||||
Initialize Step. This method is called once at the beginning of the step
|
||||
:return:
|
||||
'''
|
||||
# set target tep
|
||||
self.s = False
|
||||
self.set_target_temp(self.temp, self.kettle)
|
||||
|
||||
|
||||
|
||||
def execute(self):
|
||||
'''
|
||||
This method is execute in an interval
|
||||
:return:
|
||||
'''
|
||||
|
||||
# Check if Target Temp is reached
|
||||
if self.get_kettle_temp(self.kettle) >= float(self.temp) and self.s is False:
|
||||
self.s = True
|
||||
self.notify("Step Temp Reached!", "Please press the next button to continue", timeout=None)
|
||||
|
||||
|
||||
|
||||
@cbpi.addon.step.type("MashInStep")
|
||||
class ChilStep(Step):
|
||||
|
||||
timer = Property.Number("Timer in Minutes", configurable=True, default_value=0, description="Timer is started immediately")
|
||||
|
||||
@cbpi.addon.step.action("Start Timer")
|
||||
def start(self):
|
||||
if self.is_timer_finished() is None:
|
||||
self.start_timer(int(self.timer) * 60)
|
||||
|
||||
def reset(self):
|
||||
self.stop_timer()
|
||||
|
||||
|
||||
def finish(self):
|
||||
pass
|
||||
|
||||
def execute(self):
|
||||
if self.is_timer_finished() is None:
|
||||
self.start_timer(int(self.timer) * 60)
|
||||
|
||||
if self.is_timer_finished() == True:
|
||||
self.next()
|
||||
|
||||
@cbpi.addon.step.type("MashInStep")
|
||||
class PumpStep(Step):
|
||||
|
||||
pump = Property.Actor("Pump", description="Pump actor gets toogled")
|
||||
timer = Property.Number("Timer in Minutes", configurable=True, default_value=0, description="Timer is started immediately")
|
||||
|
||||
@cbpi.addon.step.action("Start Timer")
|
||||
def start(self):
|
||||
if self.is_timer_finished() is None:
|
||||
self.start_timer(int(self.timer) * 60)
|
||||
|
||||
def reset(self):
|
||||
self.stop_timer()
|
||||
|
||||
|
||||
def finish(self):
|
||||
self.actor_off(int(self.pump))
|
||||
|
||||
def init(self):
|
||||
self.actor_on(int(self.pump))
|
||||
|
||||
def execute(self):
|
||||
if self.is_timer_finished() is None:
|
||||
self.start_timer(int(self.timer) * 60)
|
||||
|
||||
if self.is_timer_finished() == True:
|
||||
self.next()
|
||||
|
||||
@cbpi.addon.step.type("MashInStep")
|
||||
class BoilStep(Step):
|
||||
'''
|
||||
Just put the decorator @cbpi.step on top of a method
|
||||
'''
|
||||
# Properties
|
||||
temp = Property.Number("Temperature", configurable=True, default_value=100, description="Target temperature for boiling")
|
||||
kettle = Property.Kettle("Kettle", description="Kettle in which the boiling step takes place")
|
||||
timer = Property.Number("Timer in Minutes", configurable=True, default_value=90, description="Timer is started when target temperature is reached")
|
||||
hop_1 = Property.Number("Hop 1 Addition", configurable=True, description="Fist Hop alert")
|
||||
hop_1_added = Property.Number("",default_value=None)
|
||||
hop_2 = Property.Number("Hop 2 Addition", configurable=True, description="Second Hop alert")
|
||||
hop_2_added = Property.Number("", default_value=None)
|
||||
hop_3 = Property.Number("Hop 3 Addition", configurable=True)
|
||||
hop_3_added = Property.Number("", default_value=None, description="Third Hop alert")
|
||||
hop_4 = Property.Number("Hop 4 Addition", configurable=True)
|
||||
hop_4_added = Property.Number("", default_value=None, description="Fourth Hop alert")
|
||||
hop_5 = Property.Number("Hop 5 Addition", configurable=True)
|
||||
hop_5_added = Property.Number("", default_value=None, description="Fives Hop alert")
|
||||
|
||||
def init(self):
|
||||
'''
|
||||
Initialize Step. This method is called once at the beginning of the step
|
||||
:return:
|
||||
'''
|
||||
# set target tep
|
||||
self.set_target_temp(self.temp, self.kettle)
|
||||
|
||||
@cbpi.addon.step.action("Start Timer")
|
||||
def start(self):
|
||||
'''
|
||||
Custom Action which can be execute form the brewing dashboard.
|
||||
All method with decorator @cbpi.action("YOUR CUSTOM NAME") will be available in the user interface
|
||||
:return:
|
||||
'''
|
||||
if self.is_timer_finished() is None:
|
||||
self.start_timer(int(self.timer) * 60)
|
||||
|
||||
def reset(self):
|
||||
self.stop_timer()
|
||||
self.set_target_temp(self.temp, self.kettle)
|
||||
|
||||
def finish(self):
|
||||
self.set_target_temp(0, self.kettle)
|
||||
|
||||
|
||||
def check_hop_timer(self, number, value):
|
||||
|
||||
if self.__getattribute__("hop_%s_added" % number) is not True and time.time() > (
|
||||
self.timer_end - (int(self.timer) * 60 - int(value) * 60)):
|
||||
self.__setattr__("hop_%s_added" % number, True)
|
||||
self.notify("Hop Alert", "Please add Hop %s" % number, timeout=None)
|
||||
|
||||
def execute(self):
|
||||
'''
|
||||
This method is execute in an interval
|
||||
:return:
|
||||
'''
|
||||
# Check if Target Temp is reached
|
||||
if self.get_kettle_temp(self.kettle) >= float(self.temp):
|
||||
# Check if Timer is Running
|
||||
if self.is_timer_finished() is None:
|
||||
self.start_timer(int(self.timer) * 60)
|
||||
else:
|
||||
self.check_hop_timer(1, self.hop_1)
|
||||
self.check_hop_timer(2, self.hop_2)
|
||||
self.check_hop_timer(3, self.hop_3)
|
||||
self.check_hop_timer(4, self.hop_4)
|
||||
self.check_hop_timer(5, self.hop_5)
|
||||
# Check if timer finished and go to next step
|
||||
if self.is_timer_finished() == True:
|
||||
self.notify("Boil Step Completed!", "Starting the next step", timeout=None)
|
||||
self.next()
|
||||
|
||||
Reference in New Issue
Block a user