-Custom Web View Examples Added

-UI Adjustment for small screens. Brew Steps are displayed above the
kettles.
-
This commit is contained in:
Manuel83
2017-09-27 20:13:36 +02:00
parent 813b2f0035
commit 547804be2b
25 changed files with 408 additions and 38 deletions
+35 -2
View File
@@ -1,3 +1,5 @@
from modules.core.proptypes import Property
import time
class Base(object):
@@ -192,8 +194,40 @@ class FermenterController(ControllerBase):
return self.get_sensor_value(int(self.api.cache.get("fermenter").get(id).sensor))
class Timer(object):
timer_end = Property.Number("TIMER_END", configurable=False)
class Step(Base):
def start_timer(self, timer):
if self.timer_end is not None:
return
self.timer_end = int(time.time()) + timer
def stop_timer(self):
if self.timer_end is not None:
self.timer_end = None
def is_timer_running(self):
if self.timer_end is not None:
return True
else:
return False
def timer_remaining(self):
if self.timer_end is not None:
return self.timer_end - int(time.time())
else:
return None
def is_timer_finished(self):
if self.timer_end is None:
return None
if self.timer_end <= int(time.time()):
return True
else:
return False
class Step(Base, Timer):
@classmethod
@@ -226,7 +260,6 @@ class Step(Base):
for a in kwds:
super(Step, self).__setattr__(a, kwds.get(a))
self.api = kwds.get("api")
self.id = kwds.get("id")
self.name = kwds.get("name")
+4
View File
@@ -72,11 +72,14 @@ class ActorCore(object):
def init_one(self, id):
try:
print "INIT ONE ACTOR", id
actor = self.cbpi.cache["actors"][id]
clazz = self.cbpi.cache[self.key].get(actor.type)["class"]
cfg = actor.config.copy()
cfg.update(dict(cbpi=self.cbpi, id=id))
self.cbpi.cache["actors"][id].instance = clazz(**cfg)
actor.state = 0
actor.power = 100
self.cbpi.emit("INIT_ACTOR", id=id)
except Exception as e:
print e
@@ -277,6 +280,7 @@ class CraftBeerPI(object):
FORMAT = '%(asctime)-15s - %(levelname)s - %(message)s'
logging.basicConfig(filename='./logs/app.log', level=logging.INFO, format=FORMAT)
self.cache["messages"] = []
self.cache["version"] = "3.1"
self.modules = {}
self.cache["users"] = {'manuel': {'pw': 'secret'}}
self.addon = Addon(self)