christmas tree added

This commit is contained in:
Dirk Alders 2022-12-24 12:08:08 +01:00
parent 931f1c9809
commit be3b31bf60
2 changed files with 33 additions and 0 deletions

16
.vscode/launch.json vendored Normal file
View File

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

View File

@ -180,6 +180,8 @@ class first_floor_east_living(room_shelly_tradfri_light):
for i in range(1, 7):
setattr(self, 'floorlamp_tradfri_%d' % i,
devices.tradfri_light(mqtt_client, topic="zigbee_og_e/light/living_floorlamp_%d" % i))
if config.CHRISTMAS:
self.powerplug_xmas_tree = devices.silvercrest_powerplug(mqtt_client, "zigbee_og_e/powerplug/xmas-tree")
#
self.gui_switch_floorlamp = devices.nodered_gui(mqtt_client, topic="gui/ffe_sw_living_floorlamp")
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):
self.gui_color_temp_floorlamp.enable(False)
self.gui_color_temp_floorlamp.set_feedback(0)
#
if config.CHRISTMAS:
self.gui_switch_xmas_tree = devices.nodered_gui(mqtt_client, "gui/ffe_sw_livingroom_xmas_tree")
#
# Callback initialisation
#
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):
self.gui_color_temp_floorlamp.add_callback(
devices.nodered_gui.KEY_COLOR_TEMP, None, self.set_color_temp_floorlamp)
#
if config.CHRISTMAS:
self.powerplug_xmas_tree.add_callback(
devices.silvercrest_powerplug.KEY_OUTPUT_0, None, self.powerplug_xmas_action)
self.gui_switch_xmas_tree.add_callback(devices.nodered_gui.KEY_STATE, None, self.gui_switch_command_xmas)
#
self.cvi = changed_value_indicator()
def all_off(self, device=None, key=None, data=None):
@ -254,3 +264,10 @@ class first_floor_east_living(room_shelly_tradfri_light):
logger.info("Setting color_temp \"%s\" floorlamp: %.1f", type(self).__name__, data)
for device in self.__floorlamp_devices__():
device.set_color_temp(data * 10)
def powerplug_xmas_action(self, device, key, data):
self.gui_switch_xmas_tree.set_feedback(data)
def gui_switch_command_xmas(self, device, key, data):
logger.info("Switching \"%s\" xmas-tree: %s", type(self).__name__, data)
self.powerplug_xmas_tree.set_output_0(data)