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:
@@ -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
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user