Skip to content

Commit 6a062e1

Browse files
authored
Add DataType and ProductType Enum (#21)
1 parent 36fa92f commit 6a062e1

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

tahoma_api/models.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __init__(
4343
ui_class: str,
4444
qualified_name: Optional[str] = None,
4545
states: Optional[List[Dict[str, Any]]] = None,
46-
type: str,
46+
type: int,
4747
**_: Any
4848
) -> None:
4949
self.id = deviceurl
@@ -59,7 +59,7 @@ def __init__(
5959
self.widget = widget
6060
self.ui_class = ui_class
6161
self.qualified_name = qualified_name
62-
self.type = type
62+
self.type = ProductType(type)
6363

6464

6565
class Definition:
@@ -134,10 +134,10 @@ def __len__(self) -> int:
134134
class State:
135135
__slots__ = "name", "value", "type"
136136

137-
def __init__(self, name: str, value: str, type: str, **_: Any):
137+
def __init__(self, name: str, value: str, type: int, **_: Any):
138138
self.name = name
139139
self.value = value
140-
self.type = type
140+
self.type = DataType(type)
141141

142142

143143
class States:
@@ -248,3 +248,23 @@ class Scenario:
248248
def __init__(self, label: str, oid: str, **_: Any):
249249
self.label = label
250250
self.oid = oid
251+
252+
253+
class ProductType(Enum):
254+
ACTUATOR = 1
255+
SENSOR = 2
256+
VIDEO = 3
257+
CONTROLLABLE = 4
258+
GATEWAY = 5
259+
INFRASTRUCTURE_COMPONENT = 6
260+
261+
262+
class DataType(Enum):
263+
INTEGER = 1
264+
FLOAT = 2
265+
STRING = 3
266+
BLOB = 4
267+
DATE = 5
268+
BOOLEAN = 6
269+
JSON_ARRAY = 10
270+
JSON_OBJECT = 11

0 commit comments

Comments
 (0)