mirror of
https://github.com/Manuel83/craftbeerpi3
synced 2026-08-10 02:55:27 +02:00
Allow to use actor, sensor and kettle dropdown for actor and sensor
config.
This commit is contained in:
@@ -283,6 +283,15 @@ class CraftBeerPi(ActorAPI, SensorAPI):
|
|||||||
t = tmpObj.__getattribute__(m)
|
t = tmpObj.__getattribute__(m)
|
||||||
self.cache[key][name]["properties"].append(
|
self.cache[key][name]["properties"].append(
|
||||||
{"name": m, "label": t.label, "type": "select", "configurable": True, "options": t.options})
|
{"name": m, "label": t.label, "type": "select", "configurable": True, "options": t.options})
|
||||||
|
elif isinstance(tmpObj.__getattribute__(m), Property.Actor):
|
||||||
|
t = tmpObj.__getattribute__(m)
|
||||||
|
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "actor", "configurable": t.configurable})
|
||||||
|
elif isinstance(tmpObj.__getattribute__(m), Property.Sensor):
|
||||||
|
t = tmpObj.__getattribute__(m)
|
||||||
|
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "sensor", "configurable": t.configurable})
|
||||||
|
elif isinstance(tmpObj.__getattribute__(m), Property.Kettle):
|
||||||
|
t = tmpObj.__getattribute__(m)
|
||||||
|
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "kettle", "configurable": t.configurable})
|
||||||
|
|
||||||
for name, method in cls.__dict__.iteritems():
|
for name, method in cls.__dict__.iteritems():
|
||||||
if hasattr(method, "action"):
|
if hasattr(method, "action"):
|
||||||
|
|||||||
@@ -21,6 +21,24 @@ class Property(object):
|
|||||||
self.label = label
|
self.label = label
|
||||||
self.configurable = configurable
|
self.configurable = configurable
|
||||||
|
|
||||||
|
class Actor(PropertyType):
|
||||||
|
def __init__(self, label):
|
||||||
|
PropertyType.__init__(self)
|
||||||
|
self.label = label
|
||||||
|
self.configurable = True
|
||||||
|
class Sensor(PropertyType):
|
||||||
|
def __init__(self, label):
|
||||||
|
PropertyType.__init__(self)
|
||||||
|
self.label = label
|
||||||
|
self.configurable = True
|
||||||
|
|
||||||
|
class Kettle(PropertyType):
|
||||||
|
def __init__(self, label):
|
||||||
|
PropertyType.__init__(self)
|
||||||
|
self.label = label
|
||||||
|
self.configurable = True
|
||||||
|
|
||||||
|
|
||||||
class StepProperty(Property):
|
class StepProperty(Property):
|
||||||
class Actor(PropertyType):
|
class Actor(PropertyType):
|
||||||
def __init__(self, label):
|
def __init__(self, label):
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user