- Recipe Book

- BugFixes
- Refactoring
This commit is contained in:
Manuel83
2017-11-22 00:10:11 +01:00
parent 6253cb9976
commit 13836a5680
17 changed files with 660 additions and 63 deletions
+21
View File
@@ -227,6 +227,8 @@ class Timer(object):
return False
class Step(Base, Timer):
@@ -267,6 +269,25 @@ class Step(Base, Timer):
self.value = None
self.__dirty = False
def set_target_temp(self, temp, id=None):
temp = float(temp)
try:
if id is None:
self.api.emit("SET_TARGET_TEMP", id=self.kettle_id, temp=temp)
else:
self.api.emit("SET_TARGET_TEMP", id=id, temp=temp)
except Exception as e:
self.api.notify("Faild to set Target Temp", "", type="warning")
def get_kettle_temp(self, id=None):
id = int(id)
if id is None:
id = self.kettle_id
return self.api.sensor.get_value(int(self.api.cache.get("kettle").get(id).sensor))
def is_dirty(self):
return self.__dirty
+10 -1
View File
@@ -364,13 +364,22 @@ class CraftBeerPI(object):
method.callback = True
self.cache[key] = method
def get_config_parameter(self, key, default):
def get_config_parameter(self, key, default=None):
cfg = self.cache["config"].get(key)
if cfg is None:
return default
else:
return cfg.value
def set_config_parameter(self, name, value):
from modules.config import Config
with self._app.app_context():
update_data = {"name": name, "value": value}
self.cache.get("config")[name].__dict__.update(**update_data)
c = Config.update(**update_data)
self.ws_emit("UPDATE_CONFIG", c)
def emit(self, key, **kwargs):
if self.eventbus.get(key) is not None: