Browse Source

added first floor west functionality

tags/v1.0.0
Dirk Alders 2 years ago
parent
commit
249112b351
2 changed files with 67 additions and 52 deletions
  1. 2
    1
      devices/__init__.py
  2. 65
    51
      function/__init__.py

+ 2
- 1
devices/__init__.py View File

@@ -199,7 +199,8 @@ class shelly(base):
199 199
     RX_KEYS = [KEY_OUTPUT_0, KEY_OUTPUT_1, KEY_INPUT_0,
200 200
                KEY_INPUT_1, KEY_OVERTEMPERATURE, KEY_TEMPERATURE]
201 201
     RX_IGNORE_TOPICS = [KEY_OUTPUT_0 + '/' + TX_TOPIC, KEY_OUTPUT_1 + '/' + TX_TOPIC,
202
-                        KEY_OUTPUT_0 + '/' + "energy", KEY_OUTPUT_1 + '/' + "energy"]
202
+                        KEY_OUTPUT_0 + '/' + "energy", KEY_OUTPUT_1 + '/' + "energy",
203
+                        'input_event/0', 'input_event/1']
203 204
     RX_IGNORE_KEYS = ['temperature_f']
204 205
     RX_FILTER_DATA_KEYS = [KEY_INPUT_0, KEY_INPUT_1,
205 206
                            KEY_OUTPUT_0, KEY_OUTPUT_1, KEY_OVERTEMPERATURE]

+ 65
- 51
function/__init__.py View File

@@ -6,13 +6,12 @@ import devices
6 6
 import inspect
7 7
 import logging
8 8
 
9
-# TODO: implement first floor west and dirk (ground floor west)
10 9
 # TODO: implement bed light dirk fading by input device
11 10
 # TODO: implement heating function sleep_madi
12
-# TODO: implement garland
13 11
 # TODO: implement circulation pump
14 12
 # TODO: implement switch off functionality (except of switch off button transportation)
15
-# TODO: WARNING - Got a message from "shellies/floor_eg_w"with unparsed content "event" and "event_cnt"
13
+# TODO: implement garland (incl. day events like sunset, sunrise, ...)
14
+# TODO: implement existing nodered functionality "dirk" (ground floor west)
16 15
 # TODO: implement warning message (incl. fixing all_functions.devicelist
17 16
 
18 17
 try:
@@ -27,6 +26,17 @@ class all_functions(object):
27 26
         self.rooms = {}
28 27
         self.__devices__ = None
29 28
         #
29
+        # ground floor west
30
+        #
31
+        self.gfw_floor = ground_floor_west_floor(mqtt_client)
32
+        self.gfw_marion = ground_floor_west_marion(mqtt_client)
33
+        self.gfw_dirk = ground_floor_west_dirk(mqtt_client)
34
+        #
35
+        # first floor west
36
+        #
37
+        self.ffw_julian = first_floor_west_julian(mqtt_client)
38
+        self.ffw_living = first_floor_west_living(mqtt_client)
39
+        #
30 40
         # first floor east
31 41
         #
32 42
         self.ffe_floor = first_floor_east_floor(mqtt_client)
@@ -35,18 +45,9 @@ class all_functions(object):
35 45
         self.ffe_sleep_madi = first_floor_east_sleep_madi(mqtt_client)
36 46
         self.ffe_living = first_floor_east_living(mqtt_client)
37 47
         #
38
-        # ground floor west
39
-        #
40
-        self.gfw_floor = ground_floor_west_floor(mqtt_client)
41
-        self.gfw_marion = ground_floor_west_marion(mqtt_client)
42
-        self.gfw_dirk = ground_floor_west_dirk(mqtt_client)
43
-        #
44
-        # Input devices and Off Buttons
48
+        # Input devices sleep_madi
45 49
         #
46 50
         self.ffe_button_tradfri_sleep = devices.tradfri_button(mqtt_client, topic="zigbee_og_e/input_device/og_east")
47
-        #
48
-        # Callback initialisation
49
-        #
50 51
         self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "toggle",
51 52
                                                    self.ffe_sleep_madi.toggle_main_light)
52 53
         self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "brightness_up_click",
@@ -161,6 +162,57 @@ class room_shelly_silvercrest_light(room_shelly_tradfri_light):
161 162
         self.main_light_tradfri.mqtt_client.send(self.main_light_tradfri.topic + "/get", '{"state": ""}')
162 163
 
163 164
 
165
+class ground_floor_west_floor(room_shelly_silvercrest_light):
166
+    # https://shelly1l-84CCA8AD1148
167
+    def __init__(self, mqtt_client):
168
+        super().__init__(mqtt_client, "shellies/floor_eg_w", "gui/gfw_sw_floor",
169
+                         "zigbee_eg_w/light/floor_eg_w/a", "gui/gfw_br_floor", "gui/gfw_ct_floor")
170
+        #
171
+        # Callback initialisation
172
+        #
173
+        self.main_light_tradfri_2 = devices.tradfri_light(mqtt_client, "zigbee_eg_w/light/floor_eg_w/b")
174
+        self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS,
175
+                                             None, self.sync_brightness_main_light)
176
+        self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP,
177
+                                             None, self.sync_color_temp_main_light)
178
+
179
+    def send_init_message_main_light(self):
180
+        return super().send_init_message_main_light()
181
+        self.main_light_tradfri_2.mqtt_client.send(self.main_light_tradfri_2.topic + "/get", '{"state": ""}')
182
+
183
+    def sync_brightness_main_light(self, device, key, data):
184
+        self.main_light_tradfri_2.set_brightness(data)
185
+
186
+    def sync_color_temp_main_light(self, device, key, data):
187
+        self.main_light_tradfri_2.set_color_temp(data)
188
+
189
+
190
+class ground_floor_west_marion(room_shelly):
191
+    # https://shelly1l-E8DB84A1E067
192
+    def __init__(self, mqtt_client):
193
+        super().__init__(mqtt_client, "shellies/marion", "gui/gfw_sw_marion")
194
+
195
+
196
+class ground_floor_west_dirk(room_shelly_tradfri_light):
197
+    # https://shelly1l-3C6105E44F27
198
+    def __init__(self, mqtt_client):
199
+        super().__init__(mqtt_client, "shellies/dirk", "gui/gfw_sw_dirk",
200
+                         "zigbee_eg_w/light/dirk", "gui/gfw_br_dirk", "gui/gfw_ct_dirk")
201
+
202
+
203
+class first_floor_west_julian(room_shelly_tradfri_light):
204
+    # http://shelly1l-3C6105E43452
205
+    def __init__(self, mqtt_client):
206
+        super().__init__(mqtt_client, "shellies/julian", "gui/ffw_sw_julian",
207
+                         "zigbee_og_e/light/julian", "gui/ffw_br_julian", "gui/ffw_ct_julian")
208
+
209
+
210
+class first_floor_west_living(room_shelly):
211
+    # http://shelly1l-84CCA8ACE6A1
212
+    def __init__(self, mqtt_client):
213
+        super().__init__(mqtt_client, "shellies/living_mika", "gui/ffw_sw_living")
214
+
215
+
164 216
 class first_floor_east_floor(room_shelly):
165 217
     def __init__(self, mqtt_client):
166 218
         # http://shelly1l-3C6105E4E629
@@ -341,41 +393,3 @@ class first_floor_east_living(room_shelly_tradfri_light):
341 393
         logger.info("Setting color_temp \"%s\" floorlamp: %.1f", type(self).__name__, data)
342 394
         for device in self.__floorlamp_devices__():
343 395
             device.set_color_temp(data * 10)
344
-
345
-
346
-class ground_floor_west_floor(room_shelly_silvercrest_light):
347
-    # https://shelly1l-84CCA8AD1148
348
-    def __init__(self, mqtt_client):
349
-        super().__init__(mqtt_client, "shellies/floor_eg_w", "gui/gfw_sw_floor",
350
-                         "zigbee_eg_w/light/floor_eg_w/a", "gui/gfw_br_floor", "gui/gfw_ct_floor")
351
-        #
352
-        # Callback initialisation
353
-        #
354
-        self.main_light_tradfri_2 = devices.tradfri_light(mqtt_client, "zigbee_eg_w/light/floor_eg_w/b")
355
-        self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS,
356
-                                             None, self.sync_brightness_main_light)
357
-        self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP,
358
-                                             None, self.sync_color_temp_main_light)
359
-
360
-    def send_init_message_main_light(self):
361
-        return super().send_init_message_main_light()
362
-        self.main_light_tradfri_2.mqtt_client.send(self.main_light_tradfri_2.topic + "/get", '{"state": ""}')
363
-
364
-    def sync_brightness_main_light(self, device, key, data):
365
-        self.main_light_tradfri_2.set_brightness(data)
366
-
367
-    def sync_color_temp_main_light(self, device, key, data):
368
-        self.main_light_tradfri_2.set_color_temp(data)
369
-
370
-
371
-class ground_floor_west_marion(room_shelly):
372
-    # https://shelly1l-E8DB84A1E067
373
-    def __init__(self, mqtt_client):
374
-        super().__init__(mqtt_client, "shellies/marion", "gui/gfw_sw_marion")
375
-
376
-
377
-class ground_floor_west_dirk(room_shelly_tradfri_light):
378
-    # https://shelly1l-3C6105E44F27
379
-    def __init__(self, mqtt_client):
380
-        super().__init__(mqtt_client, "shellies/dirk", "gui/gfw_sw_dirk",
381
-                         "zigbee_eg_w/light/dirk", "gui/gfw_br_dirk", "gui/gfw_ct_dirk")

Loading…
Cancel
Save