mirror of
https://github.com/Manuel83/craftbeerpi3
synced 2026-08-10 02:55:27 +02:00
-Custom Web View Examples Added
-UI Adjustment for small screens. Brew Steps are displayed above the kettles. -
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user