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

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
         for i in range(1, 7):
180
         for i in range(1, 7):
181
             setattr(self, 'floorlamp_tradfri_%d' % i,
181
             setattr(self, 'floorlamp_tradfri_%d' % i,
182
                     devices.tradfri_light(mqtt_client, topic="zigbee_og_e/light/living_floorlamp_%d" % i))
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
         self.gui_switch_floorlamp = devices.nodered_gui(mqtt_client, topic="gui/ffe_sw_living_floorlamp")
186
         self.gui_switch_floorlamp = devices.nodered_gui(mqtt_client, topic="gui/ffe_sw_living_floorlamp")
185
         self.gui_brightness_floorlamp = devices.nodered_gui(mqtt_client, "gui/ffe_br_livingroom_floorlamp")
187
         self.gui_brightness_floorlamp = devices.nodered_gui(mqtt_client, "gui/ffe_br_livingroom_floorlamp")
189
         self.gui_color_temp_floorlamp.enable(False)
191
         self.gui_color_temp_floorlamp.enable(False)
190
         self.gui_color_temp_floorlamp.set_feedback(0)
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
         # Callback initialisation
197
         # Callback initialisation
193
         #
198
         #
194
         self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.floorlamp_synchronisation)
199
         self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.floorlamp_synchronisation)
204
         self.gui_color_temp_floorlamp.add_callback(
209
         self.gui_color_temp_floorlamp.add_callback(
205
             devices.nodered_gui.KEY_COLOR_TEMP, None, self.set_color_temp_floorlamp)
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
         self.cvi = changed_value_indicator()
217
         self.cvi = changed_value_indicator()
208
 
218
 
209
     def all_off(self, device=None, key=None, data=None):
219
     def all_off(self, device=None, key=None, data=None):
254
         logger.info("Setting color_temp \"%s\" floorlamp: %.1f", type(self).__name__, data)
264
         logger.info("Setting color_temp \"%s\" floorlamp: %.1f", type(self).__name__, data)
255
         for device in self.__floorlamp_devices__():
265
         for device in self.__floorlamp_devices__():
256
             device.set_color_temp(data * 10)
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