|
@@ -5,9 +5,10 @@
|
5
|
5
|
import config
|
6
|
6
|
import devices
|
7
|
7
|
from function.modules import brightness_choose_n_action, timer_on_activation, heating_function
|
8
|
|
-import logging
|
9
|
8
|
from function.rooms import room
|
10
|
9
|
from function.videv import videv_switching, videv_switch_brightness, videv_switching_timer, videv_switch_brightness_color_temp, videv_heating, videv_multistate
|
|
10
|
+import logging
|
|
11
|
+
|
11
|
12
|
try:
|
12
|
13
|
from config import APP_NAME as ROOT_LOGGER_NAME
|
13
|
14
|
except ImportError:
|
|
@@ -24,12 +25,6 @@ class first_floor_east_floor(room):
|
24
|
25
|
self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFE_FLOOR_MAIN_LIGHT_SHELLY)
|
25
|
26
|
super().__init__(mqtt_client)
|
26
|
27
|
|
27
|
|
- ##### TEMPORARY ###################################################################################################################
|
28
|
|
- self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_FLOOR_MAIN_LIGHT_GUI)
|
29
|
|
- self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
30
|
|
- self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
31
|
|
- ##### TEMPORARY ###################################################################################################################
|
32
|
|
-
|
33
|
28
|
#
|
34
|
29
|
# Virtual Device Interface
|
35
|
30
|
#
|
|
@@ -57,17 +52,6 @@ class first_floor_east_kitchen(room):
|
57
|
52
|
self.circulation_pump = timer_on_activation(self.circulation_pump_shelly, devices.shelly.KEY_OUTPUT_0, 10*60)
|
58
|
53
|
self.circulation_pump_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, True, self.main_light_shelly.flash_0_mcb, True)
|
59
|
54
|
|
60
|
|
- ##### TEMPORARY ###################################################################################################################
|
61
|
|
- self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_KITCHEN_MAIN_LIGHT_GUI)
|
62
|
|
- self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
63
|
|
- self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
64
|
|
-
|
65
|
|
- self.gui_circulation_pump = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_KITCHEN_CIRCULATION_PUMP_GUI)
|
66
|
|
- self.gui_circulation_pump.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.circulation_pump_shelly.set_output_0_mcb)
|
67
|
|
- self.circulation_pump_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_circulation_pump.set_state_mcb)
|
68
|
|
- self.circulation_pump.add_callback(timer_on_activation.KEY_TIMER, None, self.gui_circulation_pump.set_timer_mcb, True)
|
69
|
|
- ##### TEMPORARY ###################################################################################################################
|
70
|
|
-
|
71
|
55
|
#
|
72
|
56
|
# Virtual Device Interface
|
73
|
57
|
#
|
|
@@ -81,11 +65,6 @@ class first_floor_east_kitchen(room):
|
81
|
65
|
self.circulation_pump, timer_on_activation.KEY_TIMER
|
82
|
66
|
)
|
83
|
67
|
|
84
|
|
- def all_off(self, device=None, key=None, data=None):
|
85
|
|
- self.circulation_pump_shelly.set_output_0(False)
|
86
|
|
- self.circulation_pump_shelly.set_output_1(False)
|
87
|
|
- return super().all_off(device, key, data)
|
88
|
|
-
|
89
|
68
|
|
90
|
69
|
class first_floor_east_dining(room):
|
91
|
70
|
def __init__(self, mqtt_client):
|
|
@@ -99,16 +78,6 @@ class first_floor_east_dining(room):
|
99
|
78
|
self.garland_powerplug = devices.silvercrest_powerplug(mqtt_client, config.TOPIC_FFE_DININGROOM_GARLAND_POWERPLUG)
|
100
|
79
|
super().__init__(mqtt_client)
|
101
|
80
|
|
102
|
|
- ##### TEMPORARY ###################################################################################################################
|
103
|
|
- self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_DININGROOM_MAIN_LIGHT_GUI)
|
104
|
|
- self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
105
|
|
- self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
106
|
|
-
|
107
|
|
- self.gui_floorlamp = devices.nodered_gui_switch(mqtt_client, config.TOPIC_FFE_DININGROOM_FLOOR_LAMP_GUI)
|
108
|
|
- self.gui_floorlamp.add_callback(devices.nodered_gui_switch.KEY_STATE, None, self.floorlamp_powerplug.set_output_0_mcb)
|
109
|
|
- self.floorlamp_powerplug.add_callback(devices.silvercrest_powerplug.KEY_OUTPUT_0, None, self.gui_floorlamp.set_state_mcb)
|
110
|
|
- ##### TEMPORARY ###################################################################################################################
|
111
|
|
-
|
112
|
81
|
#
|
113
|
82
|
# Functionality initialisation
|
114
|
83
|
#
|
|
@@ -131,12 +100,6 @@ class first_floor_east_dining(room):
|
131
|
100
|
self.garland_powerplug, devices.silvercrest_powerplug.KEY_OUTPUT_0
|
132
|
101
|
)
|
133
|
102
|
|
134
|
|
- def all_off(self, device=None, key=None, data=None):
|
135
|
|
- super().all_off(device, key, data)
|
136
|
|
- self.floorlamp_powerplug.set_output_0(False)
|
137
|
|
- if config.CHRISTMAS:
|
138
|
|
- self.garland_powerplug.set_output_0(False)
|
139
|
|
-
|
140
|
103
|
|
141
|
104
|
class first_floor_east_sleep(room):
|
142
|
105
|
def __init__(self, mqtt_client):
|
|
@@ -173,68 +136,6 @@ class first_floor_east_sleep(room):
|
173
|
136
|
# heating function
|
174
|
137
|
self.heating_function = heating_function(self.heating_valve, config.DEFAULT_TEMPERATURE_FFE_SLEEP)
|
175
|
138
|
|
176
|
|
- ##### TEMPORARY ###################################################################################################################
|
177
|
|
- # main light
|
178
|
|
- self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_SLEEP_MAIN_LIGHT_GUI)
|
179
|
|
- self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
180
|
|
- self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
181
|
|
-
|
182
|
|
- self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
|
183
|
|
- self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
|
184
|
|
- self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_main_light.set_color_temp_mcb)
|
185
|
|
- self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
|
186
|
|
- self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.main_light_tradfri.set_color_temp_mcb)
|
187
|
|
- # bed light
|
188
|
|
- self.gui_bed_light_di = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_SLEEP_BED_LIGHT_DI_GUI)
|
189
|
|
- self.gui_bed_light_di.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.bed_light_di_tradfri.set_output_0_mcb)
|
190
|
|
- self.bed_light_di_tradfri.add_callback(devices.tradfri_light.KEY_OUTPUT_0, None, self.gui_bed_light_di.set_state_mcb)
|
191
|
|
- self.bed_light_di_tradfri.add_callback(devices.tradfri_light.KEY_OUTPUT_0, None, self.gui_bed_light_di.set_enable_mcb)
|
192
|
|
- self.gui_bed_light_di.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.bed_light_di_tradfri.set_brightness_mcb)
|
193
|
|
- self.bed_light_di_tradfri.add_callback(devices.tradfri_light.KEY_OUTPUT_0, None, self.gui_bed_light_di.set_enable_mcb)
|
194
|
|
- self.bed_light_di_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_bed_light_di.set_brightness_mcb)
|
195
|
|
-
|
196
|
|
- self.gui_bed_light_ma = devices.nodered_gui_switch(mqtt_client, config.TOPIC_FFE_SLEEP_BED_LIGHT_MA_GUI)
|
197
|
|
- self.gui_bed_light_ma.add_callback(devices.nodered_gui_switch.KEY_STATE, None, self.bed_light_ma_powerplug.set_output_0_mcb)
|
198
|
|
- self.bed_light_ma_powerplug.add_callback(devices.silvercrest_powerplug.KEY_OUTPUT_0, None, self.gui_bed_light_ma.set_state_mcb)
|
199
|
|
-
|
200
|
|
- # heating
|
201
|
|
- self.gui_heating = devices.nodered_gui_radiator(mqtt_client, config.TOPIC_FFE_SLEEP_HEATING_VALVE_GUI)
|
202
|
|
- self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_CURRENT, None, self.gui_heating.set_temperature_mcb, True)
|
203
|
|
-
|
204
|
|
- def set_heating_setpoint(device, key, data):
|
205
|
|
- self.heating_function.set(heating_function.KEY_USER_TEMPERATURE_SETPOINT, data)
|
206
|
|
- self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TEMP, None, set_heating_setpoint)
|
207
|
|
- self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_SETPOINT, None, self.gui_heating.set_setpoint_temperature_mcb, True)
|
208
|
|
-
|
209
|
|
- def boost(device, key, data):
|
210
|
|
- self.heating_function.set(heating_function.KEY_START_BOOST, data)
|
211
|
|
- self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_BOOST, None, boost)
|
212
|
|
-
|
213
|
|
- def setpoint_to_default(device, key, data):
|
214
|
|
- self.heating_function.set(heating_function.KEY_SET_DEFAULT_TEMPERATURE, data)
|
215
|
|
- self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TO_DEFAULT, None, setpoint_to_default)
|
216
|
|
-
|
217
|
|
- def away_mode(device, key, data):
|
218
|
|
- self.heating_function.set(heating_function.KEY_AWAY_MODE, data)
|
219
|
|
- self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_AWAY, None, away_mode)
|
220
|
|
- self.heating_function.add_callback(heating_function.KEY_AWAY_MODE, None, self.gui_heating.set_away_mcb)
|
221
|
|
-
|
222
|
|
- def summer_mode(device, key, data):
|
223
|
|
- self.heating_function.set(heating_function.KEY_SUMMER_MODE, data)
|
224
|
|
- self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SUMMER, None, summer_mode)
|
225
|
|
- self.heating_function.add_callback(heating_function.KEY_SUMMER_MODE, None, self.gui_heating.set_summer_mcb)
|
226
|
|
-
|
227
|
|
- self.heating_function.add_callback(heating_function.KEY_BOOST_TIMER, None, self.gui_heating.set_timer_mcb)
|
228
|
|
-
|
229
|
|
- # active device led
|
230
|
|
- self.gui_led_active_device = devices.nodered_gui_leds(mqtt_client, config.TOPIC_FFE_SLEEP_DEVICE_CHOOSER_LED)
|
231
|
|
-
|
232
|
|
- def update_active_device_led(device, key, data):
|
233
|
|
- for i in range(0, len(self.brightness_functions.brightness_device_list)):
|
234
|
|
- self.gui_led_active_device.set_led(devices.nodered_gui_leds.KEY_LED_LIST[i], data == i)
|
235
|
|
- self.brightness_functions.add_callback(brightness_choose_n_action.KEY_ACTIVE_DEVICE, None, update_active_device_led, True)
|
236
|
|
- ##### TEMPORARY ###################################################################################################################
|
237
|
|
-
|
238
|
139
|
#
|
239
|
140
|
# Virtual Device Interface
|
240
|
141
|
#
|
|
@@ -262,11 +163,6 @@ class first_floor_east_sleep(room):
|
262
|
163
|
brightness_choose_n_action.KEY_ACTIVE_DEVICE, self.brightness_functions, 2
|
263
|
164
|
)
|
264
|
165
|
|
265
|
|
- def all_off(self, device=None, key=None, data=None):
|
266
|
|
- super().all_off(device, key, data)
|
267
|
|
- self.bed_light_di_tradfri.set_output_0(False)
|
268
|
|
- self.bed_light_ma_powerplug.set_output_0(False)
|
269
|
|
-
|
270
|
166
|
|
271
|
167
|
class first_floor_east_living(room):
|
272
|
168
|
def __init__(self, mqtt_client):
|
|
@@ -290,33 +186,6 @@ class first_floor_east_living(room):
|
290
|
186
|
# floor lamp synchronisation with main_light
|
291
|
187
|
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.floorlamp_tradfri.set_output_0_mcb, True)
|
292
|
188
|
|
293
|
|
- ##### TEMPORARY ###################################################################################################################
|
294
|
|
- # main light
|
295
|
|
- self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_LIVINGROOM_MAIN_LIGHT_GUI)
|
296
|
|
- self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
297
|
|
- self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
298
|
|
- self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
|
299
|
|
- self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
|
300
|
|
- self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_main_light.set_color_temp_mcb)
|
301
|
|
- self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
|
302
|
|
- self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.main_light_tradfri.set_color_temp_mcb)
|
303
|
|
-
|
304
|
|
- self.gui_floorlamp = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_LIVINGROOM_FLOOR_LAMP_GUI)
|
305
|
|
- self.gui_floorlamp.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.floorlamp_tradfri.set_output_0_mcb)
|
306
|
|
- self.gui_floorlamp.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.floorlamp_tradfri.set_brightness_mcb)
|
307
|
|
- self.gui_floorlamp.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.floorlamp_tradfri.set_color_temp_mcb)
|
308
|
|
- self.floorlamp_tradfri[0].add_callback(devices.tradfri_light.KEY_OUTPUT_0, None, self.gui_floorlamp.set_state_mcb)
|
309
|
|
- self.floorlamp_tradfri[0].add_callback(devices.tradfri_light.KEY_OUTPUT_0, None, self.gui_floorlamp.set_enable_mcb)
|
310
|
|
- self.floorlamp_tradfri[0].add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_floorlamp.set_brightness_mcb)
|
311
|
|
- self.floorlamp_tradfri[0].add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_floorlamp.set_color_temp_mcb)
|
312
|
|
-
|
313
|
|
- if config.CHRISTMAS:
|
314
|
|
- self.gui_xmas_tree = devices.nodered_gui_switch(mqtt_client, config.TOPIC_FFE_LIVINGROOM_XMAS_TREE_GUI)
|
315
|
|
- self.powerplug_xmas_tree.add_callback(devices.silvercrest_powerplug.KEY_OUTPUT_0, None, self.powerplug_xmas_star.set_output_0_mcb)
|
316
|
|
- self.powerplug_xmas_tree.add_callback(devices.silvercrest_powerplug.KEY_OUTPUT_0, None, self.gui_xmas_tree.set_state_mcb)
|
317
|
|
- self.gui_xmas_tree.add_callback(devices.nodered_gui_switch.KEY_STATE, None, self.powerplug_xmas_tree.set_output_0_mcb)
|
318
|
|
- ##### TEMPORARY ###################################################################################################################
|
319
|
|
-
|
320
|
189
|
#
|
321
|
190
|
# Virtual Device Interface
|
322
|
191
|
#
|
|
@@ -337,10 +206,3 @@ class first_floor_east_living(room):
|
337
|
206
|
mqtt_client, config.TOPIC_FFE_LIVINGROOM_XMAS_TREE_VIDEV,
|
338
|
207
|
self.powerplug_xmas_tree, devices.silvercrest_powerplug.KEY_OUTPUT_0
|
339
|
208
|
)
|
340
|
|
-
|
341
|
|
- def all_off(self, device=None, key=None, data=None):
|
342
|
|
- super().all_off(device, key, data)
|
343
|
|
- self.floorlamp_tradfri.set_output_0(False)
|
344
|
|
- if config.CHRISTMAS:
|
345
|
|
- self.powerplug_xmas_tree.set_output_0(False)
|
346
|
|
- self.powerplug_xmas_star.set_output_0(False)
|