|
@@ -12,6 +12,7 @@ Targets:
|
12
|
12
|
"""
|
13
|
13
|
|
14
|
14
|
from base import common_base
|
|
15
|
+import config
|
15
|
16
|
import devices
|
16
|
17
|
from function.db import get_radiator_data, set_radiator_data
|
17
|
18
|
from function.helpers import now, sunset_time, sunrise_time
|
|
@@ -152,11 +153,13 @@ class heating_function(common_base):
|
152
|
153
|
AWAY_REDUCTION = 5
|
153
|
154
|
SUMMER_TEMPERATURE = 5
|
154
|
155
|
|
155
|
|
- def __init__(self, heating_valve, default_temperature):
|
|
156
|
+ def __init__(self, heating_valve):
|
|
157
|
+ self.heating_valve = heating_valve
|
|
158
|
+ self.default_temperature = config.DEFAULT_TEMPERATURE[heating_valve.topic]
|
156
|
159
|
db_data = get_radiator_data(heating_valve.topic)
|
157
|
160
|
super().__init__({
|
158
|
|
- self.KEY_USER_TEMPERATURE_SETPOINT: db_data[2] or default_temperature,
|
159
|
|
- self.KEY_TEMPERATURE_SETPOINT: db_data[3] or default_temperature,
|
|
161
|
+ self.KEY_USER_TEMPERATURE_SETPOINT: db_data[2] or self.default_temperature,
|
|
162
|
+ self.KEY_TEMPERATURE_SETPOINT: db_data[3] or self.default_temperature,
|
160
|
163
|
self.KEY_TEMPERATURE_CURRENT: None,
|
161
|
164
|
self.KEY_AWAY_MODE: db_data[0] or False,
|
162
|
165
|
self.KEY_SUMMER_MODE: db_data[1] or False,
|
|
@@ -165,8 +168,6 @@ class heating_function(common_base):
|
165
|
168
|
self.KEY_BOOST_TIMER: 0
|
166
|
169
|
})
|
167
|
170
|
#
|
168
|
|
- self.default_temperature = default_temperature
|
169
|
|
- self.heating_valve = heating_valve
|
170
|
171
|
self.heating_valve.set_heating_setpoint(self[self.KEY_TEMPERATURE_SETPOINT])
|
171
|
172
|
#
|
172
|
173
|
self.heating_valve.add_callback(self.heating_valve.KEY_HEATING_SETPOINT, None, self.get_radiator_setpoint)
|