Browse Source

christmas tree added

tags/v1.0.0
Dirk Alders 2 years ago
parent
commit
be3b31bf60
2 changed files with 33 additions and 0 deletions
  1. 16
    0
      .vscode/launch.json
  2. 17
    0
      function/first_floor_east.py

+ 16
- 0
.vscode/launch.json View File

@@ -0,0 +1,16 @@
1
+{
2
+    // Verwendet IntelliSense zum Ermitteln möglicher Attribute.
3
+    // Zeigen Sie auf vorhandene Attribute, um die zugehörigen Beschreibungen anzuzeigen.
4
+    // Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387
5
+    "version": "0.2.0",
6
+    "configurations": [
7
+        {
8
+            "name": "Python: Main File execution",
9
+            "type": "python",
10
+            "request": "launch",
11
+            "program": "${workspaceFolder}/smart_brain.py",
12
+            "console": "integratedTerminal",
13
+            "justMyCode": true
14
+        }
15
+    ]
16
+}

+ 17
- 0
function/first_floor_east.py View File

@@ -180,6 +180,8 @@ class first_floor_east_living(room_shelly_tradfri_light):
180 180
         for i in range(1, 7):
181 181
             setattr(self, 'floorlamp_tradfri_%d' % i,
182 182
                     devices.tradfri_light(mqtt_client, topic="zigbee_og_e/light/living_floorlamp_%d" % i))
183
+        if config.CHRISTMAS:
184
+            self.powerplug_xmas_tree = devices.silvercrest_powerplug(mqtt_client, "zigbee_og_e/powerplug/xmas-tree")
183 185
         #
184 186
         self.gui_switch_floorlamp = devices.nodered_gui(mqtt_client, topic="gui/ffe_sw_living_floorlamp")
185 187
         self.gui_brightness_floorlamp = devices.nodered_gui(mqtt_client, "gui/ffe_br_livingroom_floorlamp")
@@ -189,6 +191,9 @@ class first_floor_east_living(room_shelly_tradfri_light):
189 191
         self.gui_color_temp_floorlamp.enable(False)
190 192
         self.gui_color_temp_floorlamp.set_feedback(0)
191 193
         #
194
+        if config.CHRISTMAS:
195
+            self.gui_switch_xmas_tree = devices.nodered_gui(mqtt_client, "gui/ffe_sw_livingroom_xmas_tree")
196
+        #
192 197
         # Callback initialisation
193 198
         #
194 199
         self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.floorlamp_synchronisation)
@@ -204,6 +209,11 @@ class first_floor_east_living(room_shelly_tradfri_light):
204 209
         self.gui_color_temp_floorlamp.add_callback(
205 210
             devices.nodered_gui.KEY_COLOR_TEMP, None, self.set_color_temp_floorlamp)
206 211
         #
212
+        if config.CHRISTMAS:
213
+            self.powerplug_xmas_tree.add_callback(
214
+                devices.silvercrest_powerplug.KEY_OUTPUT_0, None, self.powerplug_xmas_action)
215
+            self.gui_switch_xmas_tree.add_callback(devices.nodered_gui.KEY_STATE, None, self.gui_switch_command_xmas)
216
+        #
207 217
         self.cvi = changed_value_indicator()
208 218
 
209 219
     def all_off(self, device=None, key=None, data=None):
@@ -254,3 +264,10 @@ class first_floor_east_living(room_shelly_tradfri_light):
254 264
         logger.info("Setting color_temp \"%s\" floorlamp: %.1f", type(self).__name__, data)
255 265
         for device in self.__floorlamp_devices__():
256 266
             device.set_color_temp(data * 10)
267
+
268
+    def powerplug_xmas_action(self, device, key, data):
269
+        self.gui_switch_xmas_tree.set_feedback(data)
270
+
271
+    def gui_switch_command_xmas(self, device, key, data):
272
+        logger.info("Switching \"%s\" xmas-tree: %s", type(self).__name__, data)
273
+        self.powerplug_xmas_tree.set_output_0(data)

Loading…
Cancel
Save