|
@@ -4,6 +4,9 @@ from datetime import datetime
|
4
|
4
|
from pprint import pprint
|
5
|
5
|
|
6
|
6
|
from .variable_type import VariableType
|
|
7
|
+from pyheatpump.logger import logger_init
|
|
8
|
+
|
|
9
|
+logger = logger_init()
|
7
|
10
|
|
8
|
11
|
class VariableValue(RowClass):
|
9
|
12
|
type: VariableType = None
|
|
@@ -12,12 +15,18 @@ class VariableValue(RowClass):
|
12
|
15
|
value: int = None
|
13
|
16
|
|
14
|
17
|
def __init__(self, **kwargs):
|
|
18
|
+ logger.debug("""Create VariableValue object with attributes\n
|
|
19
|
+ :type:{}
|
|
20
|
+ :address:{}
|
|
21
|
+ :value:{}""".format(*kwargs.values()))
|
15
|
22
|
if 'type' in kwargs.keys() and type(kwargs['type']) != VariableType:
|
16
|
23
|
kwargs['type'] = VariableType.get(kwargs['type'])
|
17
|
24
|
|
|
25
|
+
|
18
|
26
|
super().__init__(**kwargs)
|
19
|
27
|
|
20
|
28
|
def insert(self):
|
|
29
|
+
|
21
|
30
|
try:
|
22
|
31
|
sql(
|
23
|
32
|
"""
|
|
@@ -26,7 +35,7 @@ class VariableValue(RowClass):
|
26
|
35
|
VALUES
|
27
|
36
|
('{}', {}, {})
|
28
|
37
|
""".format(
|
29
|
|
- self.type, self.address, self.vaule
|
|
38
|
+ self.type, self.address, self.value
|
30
|
39
|
))
|
31
|
40
|
return True
|
32
|
41
|
except Exception as e:
|