-Ui Changes

-Brew Steps added
-Clean AddOn Dialog
This commit is contained in:
Manuel83
2017-06-25 21:29:45 +02:00
parent f0b7c6e640
commit 00739ea38f
21 changed files with 297 additions and 75 deletions
+127
View File
@@ -7,6 +7,7 @@ from modules.core.step import StepBase
from modules import cbpi
@cbpi.step
class MashStep(StepBase):
'''
@@ -69,6 +70,10 @@ class MashInStep(StepBase):
kettle = StepProperty.Kettle("Kettle")
s = False
@cbpi.action("Change Power")
def change_power(self):
self.actor_power(1, 50)
def init(self):
'''
Initialize Step. This method is called once at the beginning of the step
@@ -93,3 +98,125 @@ class MashInStep(StepBase):
@cbpi.step
class ChilStep(StepBase):
timer = Property.Number("Timer in Minutes", configurable=True, default_value=0)
@cbpi.action("Stat 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.step
class PumpStep(StepBase):
pump = StepProperty.Actor("Pump")
timer = Property.Number("Timer in Minutes", configurable=True, default_value=0)
@cbpi.action("Stat 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.step
class BoilStep(StepBase):
'''
Just put the decorator @cbpi.step on top of a method
'''
# Properties
temp = Property.Number("Temperature", configurable=True, default_value=100)
kettle = StepProperty.Kettle("Kettle")
timer = Property.Number("Timer in Minutes", configurable=True, default_value=90)
hop_1 = Property.Number("Hop 1 Addition", configurable=True)
hop_1_added = Property.Number("",default_value=None)
hop_2 = Property.Number("Hop 2 Addition", configurable=True)
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)
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.action("Start Timer Now")
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) >= int(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)
# Check if timer finished and go to next step
if self.is_timer_finished() == True:
self.next()
+18 -2
View File
@@ -10,21 +10,37 @@ from modules.core.props import Property
@cbpi.sensor
class DummyTempSensor(SensorActive):
temp = Property.Number("Temperature", configurable=True, default_value=5)
def get_unit(self):
'''
:return: Unit of the sensor as string. Should not be longer than 3 characters
'''
return "°C" if self.get_config_parameter("unit", "C") == "C" else "°F"
def stop(self):
'''
Stop the sensor. Is called when the sensor config is updated or the sensor is deleted
:return:
'''
pass
def execute(self):
'''
Active sensor has to handle his own loop
:return:
'''
while self.is_running():
self.data_received(self.temp)
socketio.sleep(5)
@classmethod
def init_global(cls):
'''
Called one at the startup for all sensors
:return:
'''
@@ -57,6 +57,11 @@ class GPIOPWM(ActorBase):
self.p.start(int(self.power))
def set_power(self, power):
'''
Optional: Set the power of your actor
:param power: int value between 0 - 100
:return:
'''
if power is not None:
self.power = int(power)
self.p.ChangeDutyCycle(self.power)
@@ -87,7 +92,13 @@ class RelayBoard(ActorBase):
class Dummy(ActorBase):
def on(self, power=100):
'''
Code to switch on the actor
:param power: int value between 0 - 100
:return:
'''
print "ON"
def off(self):
print "OFF"