Quellcode durchsuchen

old gui interface removed and clean up

videv_dev
Dirk Alders vor 1 Jahr
Ursprung
Commit
5fc096c9c7

+ 2
- 140
function/first_floor_east.py Datei anzeigen

@@ -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)

+ 1
- 68
function/first_floor_west.py Datei anzeigen

@@ -4,10 +4,10 @@
4 4
 
5 5
 import config
6 6
 import devices
7
-import logging
8 7
 from function.modules import heating_function
9 8
 from function.rooms import room
10 9
 from function.videv import videv_switch_brightness, videv_switch_brightness_color_temp, videv_heating
10
+import logging
11 11
 
12 12
 
13 13
 try:
@@ -27,18 +27,6 @@ class first_floor_west_julian(room):
27 27
         self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_ZIGBEE)
28 28
         super().__init__(mqtt_client)
29 29
 
30
-        ##### TEMPORARY ###################################################################################################################
31
-        self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_GUI)
32
-        self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
33
-        self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
34
-
35
-        self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
36
-        self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
37
-        self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_main_light.set_color_temp_mcb)
38
-        self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
39
-        self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.main_light_tradfri.set_color_temp_mcb)
40
-        ##### TEMPORARY ###################################################################################################################
41
-
42 30
         #
43 31
         # Virtual Device Interface
44 32
         #
@@ -63,36 +51,6 @@ class first_floor_west_bath(room):
63 51
         # heating function
64 52
         self.heating_function = heating_function(self.heating_valve, config.DEFAULT_TEMPERATURE_FFW_BATH)
65 53
 
66
-        ##### TEMPORARY ###################################################################################################################
67
-        self.gui_heating = devices.nodered_gui_radiator(mqtt_client, config.TOPIC_FFW_BATH_HEATING_VALVE_GUI)
68
-        self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_CURRENT, None, self.gui_heating.set_temperature_mcb, True)
69
-
70
-        def set_heating_setpoint(device, key, data):
71
-            self.heating_function.set(heating_function.KEY_USER_TEMPERATURE_SETPOINT, data)
72
-        self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TEMP, None, set_heating_setpoint)
73
-        self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_SETPOINT, None, self.gui_heating.set_setpoint_temperature_mcb, True)
74
-
75
-        def boost(device, key, data):
76
-            self.heating_function.set(heating_function.KEY_START_BOOST, data)
77
-        self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_BOOST, None, boost)
78
-
79
-        def setpoint_to_default(device, key, data):
80
-            self.heating_function.set(heating_function.KEY_SET_DEFAULT_TEMPERATURE, data)
81
-        self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TO_DEFAULT, None, setpoint_to_default)
82
-
83
-        def away_mode(device, key, data):
84
-            self.heating_function.set(heating_function.KEY_AWAY_MODE, data)
85
-        self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_AWAY, None, away_mode)
86
-        self.heating_function.add_callback(heating_function.KEY_AWAY_MODE, None, self.gui_heating.set_away_mcb)
87
-
88
-        def summer_mode(device, key, data):
89
-            self.heating_function.set(heating_function.KEY_SUMMER_MODE, data)
90
-        self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SUMMER, None, summer_mode)
91
-        self.heating_function.add_callback(heating_function.KEY_SUMMER_MODE, None, self.gui_heating.set_summer_mcb)
92
-
93
-        self.heating_function.add_callback(heating_function.KEY_BOOST_TIMER, None, self.gui_heating.set_timer_mcb)
94
-        ##### TEMPORARY ###################################################################################################################
95
-
96 54
         #
97 55
         # Virtual Device Interface
98 56
         #
@@ -101,9 +59,6 @@ class first_floor_west_bath(room):
101 59
             self.heating_function
102 60
         )
103 61
 
104
-    def all_off(self):
105
-        pass
106
-
107 62
 
108 63
 class first_floor_west_living(room):
109 64
     def __init__(self, mqtt_client):
@@ -115,18 +70,6 @@ class first_floor_west_living(room):
115 70
         self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_ZIGBEE)
116 71
         super().__init__(mqtt_client)
117 72
 
118
-        ##### TEMPORARY ###################################################################################################################
119
-        self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_GUI)
120
-        self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
121
-        self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
122
-
123
-        self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
124
-        self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
125
-        self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_main_light.set_color_temp_mcb)
126
-        self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
127
-        self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.main_light_tradfri.set_color_temp_mcb)
128
-        ##### TEMPORARY ###################################################################################################################
129
-
130 73
         #
131 74
         # Virtual Device Interface
132 75
         #
@@ -148,16 +91,6 @@ class first_floor_west_sleep(room):
148 91
         self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_ZIGBEE)
149 92
         super().__init__(mqtt_client)
150 93
 
151
-        ##### TEMPORARY ###################################################################################################################
152
-        self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_GUI)
153
-        self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
154
-        self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
155
-
156
-        self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
157
-        self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
158
-        self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
159
-        ##### TEMPORARY ###################################################################################################################
160
-
161 94
         #
162 95
         # Virtual Device Interface
163 96
         #

+ 3
- 122
function/ground_floor_west.py Datei anzeigen

@@ -4,10 +4,10 @@
4 4
 
5 5
 import config
6 6
 import devices
7
-from function.modules import brightness_choose_n_action, heating_function
8
-import logging
7
+from function.modules import brightness_choose_n_action, heating_function, switched_light
9 8
 from function.rooms import room
10 9
 from function.videv import videv_switching, videv_switch_brightness_color_temp, videv_heating, videv_multistate, videv_audio_player
10
+import logging
11 11
 import task
12 12
 
13 13
 try:
@@ -34,19 +34,7 @@ class ground_floor_west_floor(room):
34 34
         # Functionality initialisation
35 35
         #
36 36
         # Request silvercrest data of lead light after power on
37
-        self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, True, self.main_light_tradfri[0].request_data, True)
38
-
39
-        ##### TEMPORARY ###################################################################################################################
40
-        self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_GFW_FLOOR_MAIN_LIGHT_GUI)
41
-        self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
42
-        self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
43
-
44
-        self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
45
-        self.main_light_tradfri[0].add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
46
-        self.main_light_tradfri[0].add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_main_light.set_color_temp_mcb)
47
-        self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
48
-        self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.main_light_tradfri.set_color_temp_mcb)
49
-        ##### TEMPORARY ###################################################################################################################
37
+        switched_light(self.main_light_shelly, devices.shelly.KEY_OUTPUT_0, self.main_light_tradfri)
50 38
 
51 39
         #
52 40
         # Virtual Device Interface
@@ -75,40 +63,6 @@ class ground_floor_west_marion(room):
75 63
         # heating function
76 64
         self.heating_function = heating_function(self.heating_valve, config.DEFAULT_TEMPERATURE_GFW_MARION)
77 65
 
78
-        ##### TEMPORARY ###################################################################################################################
79
-        self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_GFW_MARION_MAIN_LIGHT_GUI)
80
-        self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
81
-        self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
82
-
83
-        self.gui_heating = devices.nodered_gui_radiator(mqtt_client, config.TOPIC_GFW_MARION_HEATING_VALVE_GUI)
84
-        self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_CURRENT, None, self.gui_heating.set_temperature_mcb, True)
85
-
86
-        def set_heating_setpoint(device, key, data):
87
-            self.heating_function.set(heating_function.KEY_USER_TEMPERATURE_SETPOINT, data)
88
-        self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TEMP, None, set_heating_setpoint)
89
-        self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_SETPOINT, None, self.gui_heating.set_setpoint_temperature_mcb, True)
90
-
91
-        def boost(device, key, data):
92
-            self.heating_function.set(heating_function.KEY_START_BOOST, data)
93
-        self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_BOOST, None, boost)
94
-
95
-        def setpoint_to_default(device, key, data):
96
-            self.heating_function.set(heating_function.KEY_SET_DEFAULT_TEMPERATURE, data)
97
-        self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TO_DEFAULT, None, setpoint_to_default)
98
-
99
-        def away_mode(device, key, data):
100
-            self.heating_function.set(heating_function.KEY_AWAY_MODE, data)
101
-        self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_AWAY, None, away_mode)
102
-        self.heating_function.add_callback(heating_function.KEY_AWAY_MODE, None, self.gui_heating.set_away_mcb)
103
-
104
-        def summer_mode(device, key, data):
105
-            self.heating_function.set(heating_function.KEY_SUMMER_MODE, data)
106
-        self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SUMMER, None, summer_mode)
107
-        self.heating_function.add_callback(heating_function.KEY_SUMMER_MODE, None, self.gui_heating.set_summer_mcb)
108
-
109
-        self.heating_function.add_callback(heating_function.KEY_BOOST_TIMER, None, self.gui_heating.set_timer_mcb)
110
-        ##### TEMPORARY ###################################################################################################################
111
-
112 66
         #
113 67
         # Virtual Device Interface
114 68
         #
@@ -128,10 +82,6 @@ class ground_floor_west_dirk(room):
128 82
     STATE_ACTIVE_DEVICE_AMPLIFIER = 2
129 83
     STATE_ACTIVE_DEVICE_MAX_VALUE = STATE_ACTIVE_DEVICE_AMPLIFIER
130 84
     #
131
-    LED_ACTIVE_DEVICE_MAIN_LIGHT = devices.nodered_gui_leds.KEY_LED_0
132
-    LED_ACTIVE_DEVICE_DESK_LIGHT = devices.nodered_gui_leds.KEY_LED_1
133
-    LED_ACTIVE_DEVICE_AMPLIFIER = devices.nodered_gui_leds.KEY_LED_2
134
-    #
135 85
     KEY_POWERPLUG_AMPLIFIER = devices.my_powerplug.KEY_OUTPUT_0
136 86
     KEY_POWERPLUG_CD_PLAYER = devices.my_powerplug.KEY_OUTPUT_2
137 87
     KEY_POWERPLUG_DESK_LIGHT = devices.my_powerplug.KEY_OUTPUT_1
@@ -194,71 +144,6 @@ class ground_floor_west_dirk(room):
194 144
         # heating function
195 145
         self.heating_function = heating_function(self.heating_valve, config.DEFAULT_TEMPERATURE_GFW_DIRK)
196 146
 
197
-        ##### TEMPORARY ###################################################################################################################
198
-        self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_GFW_DIRK_MAIN_LIGHT_GUI)
199
-        self.gui_desk_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_GFW_DIRK_DESK_LIGHT_GUI)
200
-        self.gui_amplifier = devices.nodered_gui_switch(mqtt_client, config.TOPIC_GFW_DIRK_AMPLIFIER_GUI)
201
-        self.gui_cd_player = devices.nodered_gui_switch(mqtt_client, config.TOPIC_GFW_DIRK_CD_PLAYER_GUI)
202
-        self.gui_pc_dock = devices.nodered_gui_switch(mqtt_client, config.TOPIC_GFW_DIRK_PC_DOCK_GUI)
203
-        # Callback initialisation
204
-        self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
205
-        self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
206
-        self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
207
-        self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
208
-        self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
209
-        self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_main_light.set_color_temp_mcb)
210
-        self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
211
-        self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.main_light_tradfri.set_color_temp_mcb)
212
-        self.gui_desk_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.powerplug_common.set_output_1_mcb)
213
-        self.powerplug_common.add_callback(self.KEY_POWERPLUG_DESK_LIGHT, None, self.gui_desk_light.set_state_mcb)
214
-        self.gui_desk_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.desk_light_tradfri.set_brightness_mcb)
215
-        self.gui_desk_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.desk_light_tradfri.set_color_temp_mcb)
216
-        self.powerplug_common.add_callback(self.KEY_POWERPLUG_DESK_LIGHT, None, self.gui_desk_light.set_enable_mcb)
217
-        self.desk_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_desk_light.set_brightness_mcb)
218
-        self.desk_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_desk_light.set_color_temp_mcb)
219
-        self.gui_amplifier.add_callback(devices.nodered_gui_switch.KEY_STATE, None, self.powerplug_common.set_output_0_mcb)
220
-        self.powerplug_common.add_callback(self.KEY_POWERPLUG_AMPLIFIER, None, self.gui_amplifier.set_state_mcb)
221
-        self.gui_cd_player.add_callback(devices.nodered_gui_switch.KEY_STATE, None, self.powerplug_common.set_output_2_mcb)
222
-        self.powerplug_common.add_callback(self.KEY_POWERPLUG_CD_PLAYER, None, self.gui_cd_player.set_state_mcb)
223
-        self.gui_pc_dock.add_callback(devices.nodered_gui_switch.KEY_STATE, None, self.powerplug_common.set_output_3_mcb)
224
-        self.powerplug_common.add_callback(self.KEY_POWERPLUG_PC_DOCK, None, self.gui_pc_dock.set_state_mcb)
225
-
226
-        self.gui_heating = devices.nodered_gui_radiator(mqtt_client, config.TOPIC_GFW_DIRK_HEATING_VALVE_GUI)
227
-        self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_CURRENT, None, self.gui_heating.set_temperature_mcb, True)
228
-
229
-        def set_heating_setpoint(device, key, data):
230
-            self.heating_function.set(heating_function.KEY_USER_TEMPERATURE_SETPOINT, data)
231
-        self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TEMP, None, set_heating_setpoint)
232
-        self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_SETPOINT, None, self.gui_heating.set_setpoint_temperature_mcb, True)
233
-
234
-        def boost(device, key, data):
235
-            self.heating_function.set(heating_function.KEY_START_BOOST, data)
236
-        self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_BOOST, None, boost)
237
-
238
-        def setpoint_to_default(device, key, data):
239
-            self.heating_function.set(heating_function.KEY_SET_DEFAULT_TEMPERATURE, data)
240
-        self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TO_DEFAULT, None, setpoint_to_default)
241
-
242
-        def away_mode(device, key, data):
243
-            self.heating_function.set(heating_function.KEY_AWAY_MODE, data)
244
-        self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_AWAY, None, away_mode)
245
-        self.heating_function.add_callback(heating_function.KEY_AWAY_MODE, None, self.gui_heating.set_away_mcb)
246
-
247
-        def summer_mode(device, key, data):
248
-            self.heating_function.set(heating_function.KEY_SUMMER_MODE, data)
249
-        self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SUMMER, None, summer_mode)
250
-        self.heating_function.add_callback(heating_function.KEY_SUMMER_MODE, None, self.gui_heating.set_summer_mcb)
251
-
252
-        self.heating_function.add_callback(heating_function.KEY_BOOST_TIMER, None, self.gui_heating.set_timer_mcb)
253
-
254
-        self.gui_led_active_device = devices.nodered_gui_leds(mqtt_client, config.TOPIC_GFW_DIRK_DEVICE_CHOOSER_LED)
255
-
256
-        def update_active_device_led(device, key, data):
257
-            for i in range(0, len(self.brightness_functions.brightness_device_list)):
258
-                self.gui_led_active_device.set_led(devices.nodered_gui_leds.KEY_LED_LIST[i], data == i)
259
-        self.brightness_functions.add_callback(brightness_choose_n_action.KEY_ACTIVE_DEVICE, None, update_active_device_led, True)
260
-        ##### TEMPORARY ###################################################################################################################
261
-
262 147
         #
263 148
         # Virtual Device Interface
264 149
         #
@@ -303,10 +188,6 @@ class ground_floor_west_dirk(room):
303 188
         #
304 189
         self.delayed_task_remote = task.delayed(1.0, self.send_audio_source)
305 190
 
306
-    def all_off(self, device=None, key=None, data=None):
307
-        super().all_off(device, key, data)
308
-        self.powerplug_common.set_output_all(False)
309
-
310 191
     def audio_source_selector(self, device, key, data):
311 192
         if device == self.powerplug_common and key == self.KEY_POWERPLUG_CD_PLAYER:
312 193
             # switch on of cd player

+ 5
- 2
function/modules.py Datei anzeigen

@@ -25,6 +25,11 @@ except ImportError:
25 25
 logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
26 26
 
27 27
 
28
+class switched_light(object):
29
+    def __init__(self, sw_device, sw_key, li_device):
30
+        sw_device.add_callback(devices.shelly.KEY_OUTPUT_0, True, li_device.request_data, True)
31
+
32
+
28 33
 class brightness_choose_n_action(common_base):
29 34
     KEY_ACTIVE_DEVICE = 'active_device'
30 35
     #
@@ -54,8 +59,6 @@ class brightness_choose_n_action(common_base):
54 59
         callback_device: A device for installing callback which are executed, when the device is switched on or off. It needs the following method:
55 60
         * .add_callback(key, data or None, callback, on_changes_only)
56 61
         """
57
-        if len(self.brightness_device_list) >= len(devices.nodered_gui_leds.KEY_LED_LIST):
58
-            raise ValueError("Number of devices is limited by number of leds in devices.nodered_gui_leds.")
59 62
         self.brightness_device_list.append(brightness_device)
60 63
         self.callback_device_list.append((callback_device, callback_key))
61 64
         self.device_states.append(False)

+ 0
- 15
function/stairway.py Datei anzeigen

@@ -36,21 +36,6 @@ class stairway(room):
36 36
             timer_value=config.USER_ON_TIME_STAIRWAYS
37 37
         )
38 38
 
39
-        ##### TEMPORARY ###################################################################################################################
40
-        self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_STW_STAIRWAY_MAIN_LIGHT_GUI)
41
-        self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
42
-        self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
43
-        self.motion_sensor_light.add_callback(motion_sensor_light.KEY_TIMER, None, self.gui_main_light.set_timer_mcb)
44
-
45
-        def set_led(device, key, data):
46
-            if key == motion_sensor_light.KEY_MOTION_SENSOR_0:
47
-                self.gui_main_light.set_led(devices.nodered_gui_light.KEY_LED_0, data)
48
-            if key == motion_sensor_light.KEY_MOTION_SENSOR_1:
49
-                self.gui_main_light.set_led(devices.nodered_gui_light.KEY_LED_1, data)
50
-        self.motion_sensor_light.add_callback(motion_sensor_light.KEY_MOTION_SENSOR_0, None, set_led)
51
-        self.motion_sensor_light.add_callback(motion_sensor_light.KEY_MOTION_SENSOR_1, None, set_led)
52
-        ##### TEMPORARY ###################################################################################################################
53
-
54 39
         #
55 40
         # Virtual Device Interface
56 41
         #

+ 3
- 1
function/videv.py Datei anzeigen

@@ -48,7 +48,9 @@ class base(mqtt_base):
48 48
         # send default data to videv interface
49 49
 
50 50
     def __rx_ext_device_data__(self, ext_device, ext_key, data):
51
-        self.__tx__(self.__display_dict__[(id(ext_device), ext_key)], data)
51
+        my_key = self.__display_dict__[(id(ext_device), ext_key)]
52
+        self[my_key] = data
53
+        self.__tx__(my_key, data)
52 54
 
53 55
     def __tx__(self, key, data):
54 56
         if key in self.__control_dict__:

Laden…
Abbrechen
Speichern