craftbeerpi4-pione/core/api/property.py

113 lines
3.2 KiB
Python
Raw Normal View History

2018-11-16 20:35:59 +01:00
__all__ = ["PropertyType", "Property"]
2018-11-01 19:50:04 +01:00
class PropertyType(object):
pass
class Property(object):
class Select(PropertyType):
2018-11-29 21:59:08 +01:00
2018-12-09 22:20:33 +01:00
'''
Select Property. The user can select value from list set as options parameter
'''
2018-11-01 19:50:04 +01:00
def __init__(self, label, options, description=""):
2018-11-29 21:59:08 +01:00
'''
:param label:
:param options:
:param description:
'''
2018-11-01 19:50:04 +01:00
PropertyType.__init__(self)
self.label = label
self.options = options
self.description = description
class Number(PropertyType):
2018-12-09 22:20:33 +01:00
'''
The user can set a number value
'''
2018-11-01 19:50:04 +01:00
def __init__(self, label, configurable=False, default_value=None, unit="", description=""):
2018-11-29 21:59:08 +01:00
'''
Test
:param label:
:param configurable:
:param default_value:
:param unit:
:param description:
'''
2018-11-01 19:50:04 +01:00
PropertyType.__init__(self)
self.label = label
self.configurable = configurable
self.default_value = default_value
self.description = description
class Text(PropertyType):
2018-12-09 22:20:33 +01:00
'''
The user can set a text value
'''
2018-11-01 19:50:04 +01:00
def __init__(self, label, configurable=False, default_value="", description=""):
2018-11-29 21:59:08 +01:00
'''
:param label:
:param configurable:
:param default_value:
:param description:
'''
2018-11-01 19:50:04 +01:00
PropertyType.__init__(self)
self.label = label
self.configurable = configurable
self.default_value = default_value
self.description = description
class Actor(PropertyType):
2018-12-09 22:20:33 +01:00
'''
The user select an actor which is available in the system. The value of this variable will be the actor id
'''
2018-11-01 19:50:04 +01:00
def __init__(self, label, description=""):
2018-11-29 21:59:08 +01:00
'''
:param label:
:param description:
'''
2018-11-01 19:50:04 +01:00
PropertyType.__init__(self)
self.label = label
self.configurable = True
self.description = description
class Sensor(PropertyType):
2018-12-09 22:20:33 +01:00
'''
The user select a sensor which is available in the system. The value of this variable will be the sensor id
'''
2018-11-01 19:50:04 +01:00
def __init__(self, label, description=""):
2018-11-29 21:59:08 +01:00
'''
:param label:
:param description:
'''
2018-11-01 19:50:04 +01:00
PropertyType.__init__(self)
self.label = label
self.configurable = True
self.description = description
class Kettle(PropertyType):
2018-12-09 22:20:33 +01:00
'''
The user select a kettle which is available in the system. The value of this variable will be the kettle id
'''
2018-11-01 19:50:04 +01:00
def __init__(self, label, description=""):
2018-11-29 21:59:08 +01:00
'''
:param label:
:param description:
'''
2018-11-01 19:50:04 +01:00
PropertyType.__init__(self)
self.label = label
self.configurable = True
self.description = description