Smarthome Functionen
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

first_floor_east.py 21KB

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