mirror of
https://github.com/Manuel83/craftbeerpi3
synced 2026-08-09 18:52:40 +02:00
tool tip for config properties
This commit is contained in:
@@ -14,9 +14,9 @@ class MashStep(StepBase):
|
||||
Just put the decorator @cbpi.step on top of a method
|
||||
'''
|
||||
# Properties
|
||||
temp = Property.Number("Temperature", configurable=True)
|
||||
kettle = StepProperty.Kettle("Kettle")
|
||||
timer = Property.Number("Timer in Minutes", configurable=True)
|
||||
temp = Property.Number("Temperature", configurable=True, description="Target Temperature of Mash Step")
|
||||
kettle = StepProperty.Kettle("Kettle", description="Kettle in which the mashing takes place")
|
||||
timer = Property.Number("Timer in Minutes", configurable=True, description="Timer is started when the target temperature is reached")
|
||||
|
||||
def init(self):
|
||||
'''
|
||||
@@ -66,8 +66,8 @@ class MashInStep(StepBase):
|
||||
Just put the decorator @cbpi.step on top of a method
|
||||
'''
|
||||
# Properties
|
||||
temp = Property.Number("Temperature", configurable=True)
|
||||
kettle = StepProperty.Kettle("Kettle")
|
||||
temp = Property.Number("Temperature", configurable=True, description="Target Temperature of Mash Step")
|
||||
kettle = StepProperty.Kettle("Kettle", description="Kettle in which the mashing takes place")
|
||||
s = False
|
||||
|
||||
@cbpi.action("Change Power")
|
||||
@@ -101,7 +101,7 @@ class MashInStep(StepBase):
|
||||
@cbpi.step
|
||||
class ChilStep(StepBase):
|
||||
|
||||
timer = Property.Number("Timer in Minutes", configurable=True, default_value=0)
|
||||
timer = Property.Number("Timer in Minutes", configurable=True, default_value=0, description="Timer is started immediately")
|
||||
|
||||
@cbpi.action("Stat Timer")
|
||||
def start(self):
|
||||
@@ -125,8 +125,8 @@ class ChilStep(StepBase):
|
||||
@cbpi.step
|
||||
class PumpStep(StepBase):
|
||||
|
||||
pump = StepProperty.Actor("Pump")
|
||||
timer = Property.Number("Timer in Minutes", configurable=True, default_value=0)
|
||||
pump = StepProperty.Actor("Pump", description="Pump actor gets toogled")
|
||||
timer = Property.Number("Timer in Minutes", configurable=True, default_value=0, description="Timer is started immediately")
|
||||
|
||||
@cbpi.action("Stat Timer")
|
||||
def start(self):
|
||||
@@ -156,16 +156,15 @@ class BoilStep(StepBase):
|
||||
Just put the decorator @cbpi.step on top of a method
|
||||
'''
|
||||
# Properties
|
||||
temp = Property.Number("Temperature", configurable=True, default_value=100)
|
||||
kettle = StepProperty.Kettle("Kettle")
|
||||
timer = Property.Number("Timer in Minutes", configurable=True, default_value=90)
|
||||
hop_1 = Property.Number("Hop 1 Addition", configurable=True)
|
||||
temp = Property.Number("Temperature", configurable=True, default_value=100, description="Target temperature for boiling")
|
||||
kettle = StepProperty.Kettle("Kettle", description="Kettle in which the boiling step takes place")
|
||||
timer = Property.Number("Timer in Minutes", configurable=True, default_value=90, description="Timer is started when target temperature is reached")
|
||||
hop_1 = Property.Number("Hop 1 Addition", configurable=True, description="Fist Hop alert")
|
||||
hop_1_added = Property.Number("",default_value=None)
|
||||
|
||||
hop_2 = Property.Number("Hop 2 Addition", configurable=True)
|
||||
hop_2 = Property.Number("Hop 2 Addition", configurable=True, description="Second Hop alert")
|
||||
hop_2_added = Property.Number("", default_value=None)
|
||||
hop_3 = Property.Number("Hop 3 Addition", configurable=True)
|
||||
hop_3_added = Property.Number("", default_value=None)
|
||||
hop_3_added = Property.Number("", default_value=None, description="Second Hop alert")
|
||||
|
||||
def init(self):
|
||||
'''
|
||||
|
||||
@@ -11,7 +11,12 @@ from modules.core.props import Property
|
||||
@cbpi.sensor
|
||||
class DummyTempSensor(SensorActive):
|
||||
|
||||
temp = Property.Number("Temperature", configurable=True, default_value=5)
|
||||
temp = Property.Number("Temperature", configurable=True, default_value=5, description="Dummy Temperature as decimal value")
|
||||
|
||||
@cbpi.action("My Custom Action")
|
||||
def my_action(self):
|
||||
print "HELLO WORLD"
|
||||
pass
|
||||
|
||||
def get_unit(self):
|
||||
'''
|
||||
@@ -29,7 +34,7 @@ class DummyTempSensor(SensorActive):
|
||||
'''
|
||||
while self.is_running() is True:
|
||||
self.data_received(self.temp)
|
||||
socketio.sleep(5)
|
||||
self.sleep(5)
|
||||
|
||||
@classmethod
|
||||
def init_global(cls):
|
||||
|
||||
@@ -6,10 +6,10 @@ from modules.core.props import Property
|
||||
@cbpi.fermentation_controller
|
||||
class Hysteresis(FermenterController):
|
||||
|
||||
heater_offset_min = Property.Number("Heater Offset ON", True, 0)
|
||||
heater_offset_max = Property.Number("Heater Offset OFF", True, 0)
|
||||
cooler_offset_min = Property.Number("Cooler Offset ON", True, 0)
|
||||
cooler_offset_max = Property.Number("Cooler Offset OFF", True, 0)
|
||||
heater_offset_min = Property.Number("Heater Offset ON", True, 0, description="Offset as decimal number when the heater is switched on. Should be geather then 'Heater Offset OFF'. For example 2 means the heater will be switched on if the current temperature is 2 degrees above the target temperature")
|
||||
heater_offset_max = Property.Number("Heater Offset OFF", True, 0, description="Offset as decimal number when the heater is switched off. Should be smaller then 'Heater Offset ON'. For example 1 means the heater will be switched off if the current temperature is 1 degrees above the target temperature")
|
||||
cooler_offset_min = Property.Number("Cooler Offset ON", True, 0, description="Offset as decimal number when the cooler is switched on. Should be geather then 'Cooler Offset OFF'. For example 2 means the cooler will be switched on if the current temperature is 2 degrees below the target temperature")
|
||||
cooler_offset_max = Property.Number("Cooler Offset OFF", True, 0, description="Offset as decimal number when the cooler is switched off. Should be less then 'Cooler Offset ON'. For example 1 means the cooler will be switched off if the current temperature is 1 degrees below the target temperature")
|
||||
|
||||
def stop(self):
|
||||
super(FermenterController, self).stop()
|
||||
|
||||
@@ -18,7 +18,7 @@ except Exception as e:
|
||||
@cbpi.actor
|
||||
class GPIOSimple(ActorBase):
|
||||
|
||||
gpio = Property.Select("GPIO", options=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27])
|
||||
gpio = Property.Select("GPIO", options=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27], description="GPIO to which the actor is connected")
|
||||
|
||||
def init(self):
|
||||
GPIO.setup(int(self.gpio), GPIO.OUT)
|
||||
@@ -35,7 +35,7 @@ class GPIOSimple(ActorBase):
|
||||
@cbpi.actor
|
||||
class GPIOPWM(ActorBase):
|
||||
|
||||
gpio = Property.Select("GPIO", options=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27])
|
||||
gpio = Property.Select("GPIO", options=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27], description="GPIO to which the actor is connected")
|
||||
duty_cylce = Property.Number("Duty Cycle", configurable=True)
|
||||
|
||||
p = None
|
||||
@@ -74,7 +74,7 @@ class GPIOPWM(ActorBase):
|
||||
@cbpi.actor
|
||||
class RelayBoard(ActorBase):
|
||||
|
||||
gpio = Property.Select("GPIO", options=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27])
|
||||
gpio = Property.Select("GPIO", options=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27], description="GPIO to which the actor is connected")
|
||||
|
||||
def init(self):
|
||||
GPIO.setup(int(self.gpio), GPIO.OUT)
|
||||
@@ -91,6 +91,7 @@ class RelayBoard(ActorBase):
|
||||
@cbpi.actor
|
||||
class Dummy(ActorBase):
|
||||
|
||||
|
||||
def on(self, power=100):
|
||||
'''
|
||||
Code to switch on the actor
|
||||
|
||||
@@ -8,8 +8,8 @@ class Hysteresis(KettleController):
|
||||
|
||||
# Custom Properties
|
||||
|
||||
on = Property.Number("Offset On", True, 0)
|
||||
off = Property.Number("Offset Off", True, 0)
|
||||
on = Property.Number("Offset On", True, 0, description="Offset below target temp when heater should switched on. Should be bigger then Offset Off")
|
||||
off = Property.Number("Offset Off", True, 0, description="Offset below target temp when heater should switched off. Should be smaller then Offset Off")
|
||||
|
||||
def stop(self):
|
||||
'''
|
||||
@@ -30,11 +30,9 @@ class Hysteresis(KettleController):
|
||||
'''
|
||||
while self.is_running():
|
||||
|
||||
self.actor_power(50)
|
||||
|
||||
if self.get_temp() < self.get_target_temp() - int(self.on):
|
||||
if self.get_temp() < self.get_target_temp() - float(self.on):
|
||||
self.heater_on(100)
|
||||
elif self.get_temp() >= self.get_target_temp() - int(self.off):
|
||||
elif self.get_temp() >= self.get_target_temp() - float(self.off):
|
||||
self.heater_off()
|
||||
else:
|
||||
self.heater_off()
|
||||
|
||||
@@ -66,8 +66,8 @@ class myThread (threading.Thread):
|
||||
@cbpi.sensor
|
||||
class ONE_WIRE_SENSOR(SensorPassive):
|
||||
|
||||
sensor_name = Property.Select("Sensor", getSensors())
|
||||
offset = Property.Number("Offset", True, 0)
|
||||
|
||||
offset = Property.Number("Offset", True, 0,description="Offset which is added to the received sensor data. positie and negatie values are possible" )
|
||||
|
||||
def init(self):
|
||||
|
||||
|
||||
+12
-15
@@ -274,24 +274,24 @@ class CraftBeerPi(ActorAPI, SensorAPI):
|
||||
if isinstance(tmpObj.__getattribute__(m), Property.Number):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
self.cache[key][name]["properties"].append(
|
||||
{"name": m, "label": t.label, "type": "number", "configurable": t.configurable})
|
||||
{"name": m, "label": t.label, "type": "number", "configurable": t.configurable, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), Property.Text):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
self.cache[key][name]["properties"].append(
|
||||
{"name": m, "label": t.label, "type": "text", "configurable": t.configurable})
|
||||
{"name": m, "label": t.label, "type": "text", "configurable": t.configurable, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), Property.Select):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
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, "description": t.description})
|
||||
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})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "actor", "configurable": t.configurable, "description": t.description})
|
||||
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})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "sensor", "configurable": t.configurable, "description": t.description})
|
||||
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})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "kettle", "configurable": t.configurable, "description": t.description})
|
||||
|
||||
for name, method in cls.__dict__.iteritems():
|
||||
if hasattr(method, "action"):
|
||||
@@ -353,25 +353,22 @@ class CraftBeerPi(ActorAPI, SensorAPI):
|
||||
for m in members:
|
||||
if isinstance(tmpObj.__getattribute__(m), StepProperty.Number):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
#self.cache[key][name]["properties"].append(t.__dict__)
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "number", "configurable": t.configurable, "default_value": t.default_value})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "number", "configurable": t.configurable, "default_value": t.default_value, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), StepProperty.Text):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
print t.__dict__
|
||||
#self.cache[key][name]["properties"].append(t.__dict__)
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "text", "configurable": t.configurable})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "text", "configurable": t.configurable, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), StepProperty.Select):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "select", "configurable": True, "options": t.options})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "select", "configurable": True, "options": t.options, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), StepProperty.Actor):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "actor", "configurable": t.configurable})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "actor", "configurable": t.configurable, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), StepProperty.Sensor):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "sensor", "configurable": t.configurable})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "sensor", "configurable": t.configurable, "description": t.description})
|
||||
elif isinstance(tmpObj.__getattribute__(m), StepProperty.Kettle):
|
||||
t = tmpObj.__getattribute__(m)
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "kettle", "configurable": t.configurable})
|
||||
self.cache[key][name]["properties"].append({"name": m, "label": t.label, "type": "kettle", "configurable": t.configurable, "description": t.description})
|
||||
|
||||
for name, method in cls.__dict__.iteritems():
|
||||
if hasattr(method, "action"):
|
||||
|
||||
+20
-10
@@ -3,55 +3,65 @@ class PropertyType(object):
|
||||
|
||||
class Property(object):
|
||||
class Select(PropertyType):
|
||||
def __init__(self, label, options):
|
||||
def __init__(self, label, options, description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.options = options
|
||||
self.description = description
|
||||
|
||||
class Number(PropertyType):
|
||||
def __init__(self, label, configurable=False, default_value=None, unit=""):
|
||||
def __init__(self, label, configurable=False, default_value=None, unit="", description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.configurable = configurable
|
||||
self.default_value = default_value
|
||||
self.description = description
|
||||
|
||||
class Text(PropertyType):
|
||||
def __init__(self, label, configurable=False, default_value=""):
|
||||
def __init__(self, label, configurable=False, default_value="", description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.configurable = configurable
|
||||
self.description = description
|
||||
|
||||
class Actor(PropertyType):
|
||||
def __init__(self, label):
|
||||
def __init__(self, label, description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.configurable = True
|
||||
self.description = description
|
||||
|
||||
class Sensor(PropertyType):
|
||||
def __init__(self, label):
|
||||
def __init__(self, label, description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.configurable = True
|
||||
self.description = description
|
||||
|
||||
class Kettle(PropertyType):
|
||||
def __init__(self, label):
|
||||
def __init__(self, label, description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.configurable = True
|
||||
self.description = description
|
||||
|
||||
|
||||
class StepProperty(Property):
|
||||
class Actor(PropertyType):
|
||||
def __init__(self, label):
|
||||
def __init__(self, label, description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.configurable = True
|
||||
self.description = description
|
||||
class Sensor(PropertyType):
|
||||
def __init__(self, label):
|
||||
def __init__(self, label, description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.configurable = True
|
||||
self.description = description
|
||||
class Kettle(PropertyType):
|
||||
def __init__(self, label):
|
||||
def __init__(self, label, description=""):
|
||||
PropertyType.__init__(self)
|
||||
self.label = label
|
||||
self.configurable = True
|
||||
self.configurable = True
|
||||
self.description = description
|
||||
+35
-35
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user