Smarthome Functionen
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

first_floor_east.py 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. import config
  5. import devices
  6. from function.modules import brightness_choose_n_action, timer_on_activation, heating_function
  7. import logging
  8. from function.rooms import room
  9. from function.videv import videv_switching, videv_switch_brightness, videv_switching_timer, videv_switch_brightness_color_temp, videv_heating, videv_multistate
  10. try:
  11. from config import APP_NAME as ROOT_LOGGER_NAME
  12. except ImportError:
  13. ROOT_LOGGER_NAME = 'root'
  14. logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
  15. class first_floor_east_floor(room):
  16. def __init__(self, mqtt_client):
  17. #
  18. # Device initialisation
  19. #
  20. # http://shelly1l-3C6105E4E629
  21. self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFE_FLOOR_MAIN_LIGHT_SHELLY)
  22. super().__init__(mqtt_client)
  23. ##### TEMPORARY ###################################################################################################################
  24. self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_FLOOR_MAIN_LIGHT_GUI)
  25. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
  26. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
  27. ##### TEMPORARY ###################################################################################################################
  28. #
  29. # Virtual Device Interface
  30. #
  31. self.main_light = videv_switching(
  32. mqtt_client, config.TOPIC_FFE_FLOOR_MAIN_LIGHT_VIDEV,
  33. self.main_light_shelly, devices.shelly.KEY_OUTPUT_0
  34. )
  35. class first_floor_east_kitchen(room):
  36. def __init__(self, mqtt_client):
  37. #
  38. # Device initialisation
  39. #
  40. # http://shelly1l-8CAAB5616C01
  41. self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFE_KITCHEN_MAIN_LIGHT_SHELLY)
  42. # http://shelly1-e89f6d85a466/
  43. self.circulation_pump_shelly = devices.shelly(mqtt_client, config.TOPIC_FFE_KITCHEN_CIRCULATION_PUMP_SHELLY)
  44. super().__init__(mqtt_client)
  45. #
  46. # Functionality initialisation
  47. #
  48. self.circulation_pump = timer_on_activation(self.circulation_pump_shelly, devices.shelly.KEY_OUTPUT_0, 10*60)
  49. ##### TEMPORARY ###################################################################################################################
  50. self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_KITCHEN_MAIN_LIGHT_GUI)
  51. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
  52. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
  53. self.gui_circulation_pump = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_KITCHEN_CIRCULATION_PUMP_GUI)
  54. self.gui_circulation_pump.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.circulation_pump_shelly.set_output_0_mcb)
  55. self.circulation_pump_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_circulation_pump.set_state_mcb)
  56. self.circulation_pump.add_callback(timer_on_activation.KEY_TIMER, None, self.gui_circulation_pump.set_timer_mcb, True)
  57. ##### TEMPORARY ###################################################################################################################
  58. #
  59. # Virtual Device Interface
  60. #
  61. self.main_light_videv = videv_switching(
  62. mqtt_client, config.TOPIC_FFE_KITCHEN_MAIN_LIGHT_VIDEV,
  63. self.main_light_shelly, devices.shelly.KEY_OUTPUT_0
  64. )
  65. self.circulation_pump_videv = videv_switching_timer(
  66. mqtt_client, config.TOPIC_FFE_KITCHEN_CIRCULATION_PUMP_VIDEV,
  67. self.circulation_pump_shelly, devices.shelly.KEY_OUTPUT_0,
  68. self.circulation_pump, timer_on_activation.KEY_TIMER
  69. )
  70. def all_off(self, device=None, key=None, data=None):
  71. self.circulation_pump_shelly.set_output_0(False)
  72. self.circulation_pump_shelly.set_output_1(False)
  73. return super().all_off(device, key, data)
  74. class first_floor_east_dining(room):
  75. def __init__(self, mqtt_client):
  76. #
  77. # Device initialisation
  78. #
  79. # http://shelly1l-84CCA8ADD055
  80. self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFE_DININGROOM_MAIN_LIGHT_SHELLY)
  81. self.floorlamp_powerplug = devices.silvercrest_powerplug(mqtt_client, config.TOPIC_FFE_DININGROOM_FLOOR_LAMP_POWERPLUG)
  82. if config.CHRISTMAS:
  83. self.garland_powerplug = devices.silvercrest_powerplug(mqtt_client, config.TOPIC_FFE_DININGROOM_GARLAND_POWERPLUG)
  84. super().__init__(mqtt_client)
  85. ##### TEMPORARY ###################################################################################################################
  86. self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_DININGROOM_MAIN_LIGHT_GUI)
  87. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
  88. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
  89. self.gui_floorlamp = devices.nodered_gui_switch(mqtt_client, config.TOPIC_FFE_DININGROOM_FLOOR_LAMP_GUI)
  90. self.gui_floorlamp.add_callback(devices.nodered_gui_switch.KEY_STATE, None, self.floorlamp_powerplug.set_output_0_mcb)
  91. self.floorlamp_powerplug.add_callback(devices.silvercrest_powerplug.KEY_OUTPUT_0, None, self.gui_floorlamp.set_state_mcb)
  92. ##### TEMPORARY ###################################################################################################################
  93. #
  94. # Functionality initialisation
  95. #
  96. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.floorlamp_powerplug.set_output_0_mcb, True)
  97. #
  98. # Virtual Device Interface
  99. #
  100. self.main_light_videv = videv_switching(
  101. mqtt_client, config.TOPIC_FFE_DININGROOM_MAIN_LIGHT_VIDEV,
  102. self.main_light_shelly, devices.shelly.KEY_OUTPUT_0
  103. )
  104. self.floorlamp_videv = videv_switching(
  105. mqtt_client, config.TOPIC_FFE_DININGROOM_FLOOR_LAMP_VIDEV,
  106. self.floorlamp_powerplug, devices.silvercrest_powerplug.KEY_OUTPUT_0
  107. )
  108. if config.CHRISTMAS:
  109. self.garland_videv = videv_switching(
  110. mqtt_client, config.TOPIC_FFE_DININGROOM_GARLAND_VIDEV,
  111. self.garland_powerplug, devices.silvercrest_powerplug.KEY_OUTPUT_0
  112. )
  113. def all_off(self, device=None, key=None, data=None):
  114. super().all_off(device, key, data)
  115. self.floorlamp_powerplug.set_output_0(False)
  116. if config.CHRISTMAS:
  117. self.garland_powerplug.set_output_0(False)
  118. class first_floor_east_sleep(room):
  119. def __init__(self, mqtt_client):
  120. #
  121. # Device initialisation
  122. #
  123. # http://shelly1l-E8DB84A254C7
  124. self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFE_SLEEP_MAIN_LIGHT_SHELLY)
  125. self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFE_SLEEP_MAIN_LIGHT_ZIGBEE)
  126. self.bed_light_di_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFE_SLEEP_BED_LIGHT_DI_ZIGBEE)
  127. self.bed_light_ma_powerplug = devices.silvercrest_powerplug(mqtt_client, config.TOPIC_FFE_SLEEP_BED_LIGHT_MA_POWERPLUG)
  128. self.heating_valve = devices.brennenstuhl_heatingvalve(mqtt_client, config.TOPIC_FFE_SLEEP_HEATING_VALVE_ZIGBEE)
  129. self.button_tradfri = devices.tradfri_button(mqtt_client, config.TOPIC_FFE_SLEEP_INPUT_DEVICE)
  130. super().__init__(mqtt_client)
  131. #
  132. # Functionality initialisation
  133. #
  134. # button / brightness function
  135. self.brightness_functions = brightness_choose_n_action(self.button_tradfri)
  136. self.brightness_functions.add(self.main_light_tradfri, self.main_light_shelly, devices.shelly.KEY_OUTPUT_0)
  137. self.brightness_functions.add(self.bed_light_di_tradfri, self.bed_light_di_tradfri, devices.tradfri_light.KEY_OUTPUT_0)
  138. # button / main light
  139. self.button_tradfri.add_callback(devices.tradfri_button.KEY_ACTION, devices.tradfri_button.ACTION_TOGGLE,
  140. self.main_light_shelly.toggle_output_0_mcb)
  141. # button / bed light
  142. self.button_tradfri.add_callback(devices.tradfri_button.KEY_ACTION, devices.tradfri_button.ACTION_LEFT,
  143. self.bed_light_di_tradfri.toggle_output_0_mcb)
  144. self.button_tradfri.add_callback(devices.tradfri_button.KEY_ACTION, devices.tradfri_button.ACTION_LEFT_LONG,
  145. self.bed_light_ma_powerplug.toggle_output_0_mcb)
  146. # heating function
  147. self.heating_function = heating_function(self.heating_valve, config.DEFAULT_TEMPERATURE_FFE_SLEEP)
  148. ##### TEMPORARY ###################################################################################################################
  149. # main light
  150. self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_SLEEP_MAIN_LIGHT_GUI)
  151. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
  152. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
  153. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
  154. self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
  155. self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_main_light.set_color_temp_mcb)
  156. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
  157. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.main_light_tradfri.set_color_temp_mcb)
  158. # bed light
  159. self.gui_bed_light_di = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_SLEEP_BED_LIGHT_DI_GUI)
  160. self.gui_bed_light_di.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.bed_light_di_tradfri.set_output_0_mcb)
  161. self.bed_light_di_tradfri.add_callback(devices.tradfri_light.KEY_OUTPUT_0, None, self.gui_bed_light_di.set_state_mcb)
  162. self.bed_light_di_tradfri.add_callback(devices.tradfri_light.KEY_OUTPUT_0, None, self.gui_bed_light_di.set_enable_mcb)
  163. self.gui_bed_light_di.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.bed_light_di_tradfri.set_brightness_mcb)
  164. self.bed_light_di_tradfri.add_callback(devices.tradfri_light.KEY_OUTPUT_0, None, self.gui_bed_light_di.set_enable_mcb)
  165. self.bed_light_di_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_bed_light_di.set_brightness_mcb)
  166. self.gui_bed_light_ma = devices.nodered_gui_switch(mqtt_client, config.TOPIC_FFE_SLEEP_BED_LIGHT_MA_GUI)
  167. self.gui_bed_light_ma.add_callback(devices.nodered_gui_switch.KEY_STATE, None, self.bed_light_ma_powerplug.set_output_0_mcb)
  168. self.bed_light_ma_powerplug.add_callback(devices.silvercrest_powerplug.KEY_OUTPUT_0, None, self.gui_bed_light_ma.set_state_mcb)
  169. # heating
  170. self.gui_heating = devices.nodered_gui_radiator(mqtt_client, config.TOPIC_FFE_SLEEP_HEATING_VALVE_GUI)
  171. self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_CURRENT, None, self.gui_heating.set_temperature_mcb, True)
  172. def set_heating_setpoint(device, key, data):
  173. self.heating_function.set(heating_function.KEY_USER_TEMPERATURE_SETPOINT, data)
  174. self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TEMP, None, set_heating_setpoint)
  175. self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_SETPOINT, None, self.gui_heating.set_setpoint_temperature_mcb, True)
  176. def boost(device, key, data):
  177. self.heating_function.set(heating_function.KEY_START_BOOST, data)
  178. self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_BOOST, None, boost)
  179. def setpoint_to_default(device, key, data):
  180. self.heating_function.set(heating_function.KEY_SET_DEFAULT_TEMPERATURE, data)
  181. self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TO_DEFAULT, None, setpoint_to_default)
  182. def away_mode(device, key, data):
  183. self.heating_function.set(heating_function.KEY_AWAY_MODE, data)
  184. self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_AWAY, None, away_mode)
  185. self.heating_function.add_callback(heating_function.KEY_AWAY_MODE, None, self.gui_heating.set_away_mcb)
  186. def summer_mode(device, key, data):
  187. self.heating_function.set(heating_function.KEY_SUMMER_MODE, data)
  188. self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SUMMER, None, summer_mode)
  189. self.heating_function.add_callback(heating_function.KEY_SUMMER_MODE, None, self.gui_heating.set_summer_mcb)
  190. self.heating_function.add_callback(heating_function.KEY_BOOST_TIMER, None, self.gui_heating.set_timer_mcb)
  191. # active device led
  192. self.gui_led_active_device = devices.nodered_gui_leds(mqtt_client, config.TOPIC_FFE_SLEEP_DEVICE_CHOOSER_LED)
  193. def update_active_device_led(device, key, data):
  194. for i in range(0, len(self.brightness_functions.brightness_device_list)):
  195. self.gui_led_active_device.set_led(devices.nodered_gui_leds.KEY_LED_LIST[i], data == i)
  196. self.brightness_functions.add_callback(brightness_choose_n_action.KEY_ACTIVE_DEVICE, None, update_active_device_led, True)
  197. ##### TEMPORARY ###################################################################################################################
  198. #
  199. # Virtual Device Interface
  200. #
  201. self.main_light_videv = videv_switch_brightness_color_temp(
  202. mqtt_client, config.TOPIC_FFE_SLEEP_MAIN_LIGHT_VIDEV,
  203. self.main_light_shelly, devices.shelly.KEY_OUTPUT_0,
  204. self.main_light_tradfri, devices.tradfri_light.KEY_BRIGHTNESS,
  205. self.main_light_tradfri, devices.tradfri_light.KEY_COLOR_TEMP
  206. )
  207. self.bed_light_di_videv = videv_switch_brightness(
  208. mqtt_client, config.TOPIC_FFE_SLEEP_BED_LIGHT_DI_VIDEV,
  209. self.bed_light_di_tradfri, devices.tradfri_light.KEY_OUTPUT_0,
  210. self.bed_light_di_tradfri, devices.tradfri_light.KEY_BRIGHTNESS,
  211. )
  212. self.bed_light_ma_videv = videv_switching(
  213. mqtt_client, config.TOPIC_FFE_SLEEP_BED_LIGHT_MA_VIDEV,
  214. self.bed_light_ma_powerplug, devices.silvercrest_powerplug.KEY_OUTPUT_0
  215. )
  216. self.heating_function_videv = videv_heating(
  217. mqtt_client, config.TOPIC_FFE_SLEEP_HEATING_VALVE_VIDEV,
  218. self.heating_function
  219. )
  220. self.brightness_functions_device_videv = videv_multistate(
  221. mqtt_client, config.TOPIC_FFE_SLEEP_ACTIVE_BRIGHTNESS_DEVICE_VIDEV,
  222. brightness_choose_n_action.KEY_ACTIVE_DEVICE, self.brightness_functions, 2
  223. )
  224. def all_off(self, device=None, key=None, data=None):
  225. super().all_off(device, key, data)
  226. self.bed_light_di_tradfri.set_output_0(False)
  227. self.bed_light_ma_powerplug.set_output_0(False)
  228. class first_floor_east_living(room):
  229. def __init__(self, mqtt_client):
  230. #
  231. # Device initialisation
  232. #
  233. # http://shelly1l-3C6105E3F910
  234. self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFE_LIVINGROOM_MAIN_LIGHT_SHELLY)
  235. self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFE_LIVINGROOM_MAIN_LIGHT_ZIGBEE)
  236. self.floorlamp_tradfri = devices.group(
  237. *[devices.tradfri_light(mqtt_client, config.TOPIC_FFE_LIVINGROOM_FLOOR_LAMP_ZIGBEE % i) for i in range(1, 7)])
  238. if config.CHRISTMAS:
  239. self.powerplug_xmas_tree = devices.silvercrest_powerplug(mqtt_client, config.TOPIC_FFE_LIVINGROOM_XMAS_TREE_POWERPLUG)
  240. self.powerplug_xmas_star = devices.silvercrest_powerplug(mqtt_client, config.TOPIC_FFE_LIVINGROOM_XMAS_STAR_POWERPLUG)
  241. super().__init__(mqtt_client)
  242. #
  243. # Functionality initialisation
  244. #
  245. # floor lamp synchronisation with main_light
  246. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.floorlamp_tradfri.set_output_0_mcb, True)
  247. ##### TEMPORARY ###################################################################################################################
  248. # main light
  249. self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_LIVINGROOM_MAIN_LIGHT_GUI)
  250. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
  251. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
  252. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
  253. self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
  254. self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_main_light.set_color_temp_mcb)
  255. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
  256. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.main_light_tradfri.set_color_temp_mcb)
  257. self.gui_floorlamp = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_LIVINGROOM_FLOOR_LAMP_GUI)
  258. self.gui_floorlamp.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.floorlamp_tradfri.set_output_0_mcb)
  259. self.gui_floorlamp.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.floorlamp_tradfri.set_brightness_mcb)
  260. self.gui_floorlamp.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.floorlamp_tradfri.set_color_temp_mcb)
  261. self.floorlamp_tradfri[0].add_callback(devices.tradfri_light.KEY_OUTPUT_0, None, self.gui_floorlamp.set_state_mcb)
  262. self.floorlamp_tradfri[0].add_callback(devices.tradfri_light.KEY_OUTPUT_0, None, self.gui_floorlamp.set_enable_mcb)
  263. self.floorlamp_tradfri[0].add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_floorlamp.set_brightness_mcb)
  264. self.floorlamp_tradfri[0].add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_floorlamp.set_color_temp_mcb)
  265. if config.CHRISTMAS:
  266. self.gui_xmas_tree = devices.nodered_gui_switch(mqtt_client, config.TOPIC_FFE_LIVINGROOM_XMAS_TREE_GUI)
  267. self.powerplug_xmas_tree.add_callback(devices.silvercrest_powerplug.KEY_OUTPUT_0, None, self.powerplug_xmas_star.set_output_0_mcb)
  268. self.powerplug_xmas_tree.add_callback(devices.silvercrest_powerplug.KEY_OUTPUT_0, None, self.gui_xmas_tree.set_state_mcb)
  269. self.gui_xmas_tree.add_callback(devices.nodered_gui_switch.KEY_STATE, None, self.powerplug_xmas_tree.set_output_0_mcb)
  270. ##### TEMPORARY ###################################################################################################################
  271. #
  272. # Virtual Device Interface
  273. #
  274. self.main_light_videv = videv_switch_brightness_color_temp(
  275. mqtt_client, config.TOPIC_FFE_LIVINGROOM_MAIN_LIGHT_VIDEV,
  276. self.main_light_shelly, devices.shelly.KEY_OUTPUT_0,
  277. self.main_light_tradfri, devices.tradfri_light.KEY_BRIGHTNESS,
  278. self.main_light_tradfri, devices.tradfri_light.KEY_COLOR_TEMP
  279. )
  280. self.floorlamp_videv = videv_switch_brightness_color_temp(
  281. mqtt_client, config.TOPIC_FFE_LIVINGROOM_FLOOR_LAMP_VIDEV,
  282. self.floorlamp_tradfri, devices.tradfri_light.KEY_OUTPUT_0,
  283. self.floorlamp_tradfri, devices.tradfri_light.KEY_BRIGHTNESS,
  284. self.floorlamp_tradfri, devices.tradfri_light.KEY_COLOR_TEMP
  285. )
  286. if config.CHRISTMAS:
  287. self.xmas_tree_videv = videv_switching(
  288. mqtt_client, config.TOPIC_FFE_LIVINGROOM_XMAS_TREE_VIDEV,
  289. self.powerplug_xmas_tree, devices.silvercrest_powerplug.KEY_OUTPUT_0
  290. )
  291. def all_off(self, device=None, key=None, data=None):
  292. super().all_off(device, key, data)
  293. self.floorlamp_tradfri.set_output_0(False)
  294. if config.CHRISTMAS:
  295. self.powerplug_xmas_tree.set_output_0(False)
  296. self.powerplug_xmas_star.set_output_0(False)