Smarthome Functionen
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

first_floor_west.py 9.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. import config
  5. import devices
  6. import logging
  7. from function.modules import heating_function
  8. from function.rooms import room
  9. from function.videv import videv_switch_brightness, videv_switch_brightness_color_temp, videv_heating
  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_west_julian(room):
  16. def __init__(self, mqtt_client):
  17. #
  18. # Device initialisation
  19. #
  20. # http://shelly1l-3C6105E43452
  21. self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_SHELLY)
  22. self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_ZIGBEE)
  23. super().__init__(mqtt_client)
  24. ##### TEMPORARY ###################################################################################################################
  25. self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_GUI)
  26. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
  27. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
  28. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
  29. self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
  30. self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_main_light.set_color_temp_mcb)
  31. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
  32. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.main_light_tradfri.set_color_temp_mcb)
  33. ##### TEMPORARY ###################################################################################################################
  34. #
  35. # Virtual Device Interface
  36. #
  37. self.main_light_videv = videv_switch_brightness_color_temp(
  38. mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_VIDEV,
  39. self.main_light_shelly, devices.shelly.KEY_OUTPUT_0,
  40. self.main_light_tradfri, devices.tradfri_light.KEY_BRIGHTNESS,
  41. self.main_light_tradfri, devices.tradfri_light.KEY_COLOR_TEMP
  42. )
  43. class first_floor_west_bath(room):
  44. def __init__(self, mqtt_client):
  45. #
  46. # Device initialisation
  47. #
  48. self.heating_valve = devices.brennenstuhl_heatingvalve(mqtt_client, config.TOPIC_FFW_BATH_HEATING_VALVE_ZIGBEE)
  49. super().__init__(mqtt_client)
  50. #
  51. # Functionality initialisation
  52. #
  53. # heating function
  54. self.heating_function = heating_function(self.heating_valve, config.DEFAULT_TEMPERATURE_FFW_BATH)
  55. ##### TEMPORARY ###################################################################################################################
  56. self.gui_heating = devices.nodered_gui_radiator(mqtt_client, config.TOPIC_FFW_BATH_HEATING_VALVE_GUI)
  57. self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_CURRENT, None, self.gui_heating.set_temperature_mcb, True)
  58. def set_heating_setpoint(device, key, data):
  59. self.heating_function.set(heating_function.KEY_USER_TEMPERATURE_SETPOINT, data)
  60. self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TEMP, None, set_heating_setpoint)
  61. self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_SETPOINT, None, self.gui_heating.set_setpoint_temperature_mcb, True)
  62. def boost(device, key, data):
  63. self.heating_function.set(heating_function.KEY_START_BOOST, data)
  64. self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_BOOST, None, boost)
  65. def setpoint_to_default(device, key, data):
  66. self.heating_function.set(heating_function.KEY_SET_DEFAULT_TEMPERATURE, data)
  67. self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TO_DEFAULT, None, setpoint_to_default)
  68. def away_mode(device, key, data):
  69. self.heating_function.set(heating_function.KEY_AWAY_MODE, data)
  70. self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_AWAY, None, away_mode)
  71. self.heating_function.add_callback(heating_function.KEY_AWAY_MODE, None, self.gui_heating.set_away_mcb)
  72. def summer_mode(device, key, data):
  73. self.heating_function.set(heating_function.KEY_SUMMER_MODE, data)
  74. self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SUMMER, None, summer_mode)
  75. self.heating_function.add_callback(heating_function.KEY_SUMMER_MODE, None, self.gui_heating.set_summer_mcb)
  76. self.heating_function.add_callback(heating_function.KEY_BOOST_TIMER, None, self.gui_heating.set_timer_mcb)
  77. ##### TEMPORARY ###################################################################################################################
  78. #
  79. # Virtual Device Interface
  80. #
  81. self.heating_function_videv = videv_heating(
  82. mqtt_client, config.TOPIC_FFW_BATH_HEATING_VALVE_VIDEV,
  83. self.heating_function
  84. )
  85. def all_off(self):
  86. pass
  87. class first_floor_west_living(room):
  88. def __init__(self, mqtt_client):
  89. #
  90. # Device initialisation
  91. #
  92. # http://shelly1l-84CCA8ACE6A1
  93. self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_SHELLY)
  94. self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_ZIGBEE)
  95. super().__init__(mqtt_client)
  96. ##### TEMPORARY ###################################################################################################################
  97. self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_GUI)
  98. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
  99. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
  100. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
  101. self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
  102. self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_main_light.set_color_temp_mcb)
  103. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
  104. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.main_light_tradfri.set_color_temp_mcb)
  105. ##### TEMPORARY ###################################################################################################################
  106. #
  107. # Virtual Device Interface
  108. #
  109. self.main_light_videv = videv_switch_brightness_color_temp(
  110. mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_VIDEV,
  111. self.main_light_shelly, devices.shelly.KEY_OUTPUT_0,
  112. self.main_light_tradfri, devices.tradfri_light.KEY_BRIGHTNESS,
  113. self.main_light_tradfri, devices.tradfri_light.KEY_COLOR_TEMP
  114. )
  115. class first_floor_west_sleep(room):
  116. def __init__(self, mqtt_client):
  117. #
  118. # Device initialisation
  119. #
  120. # http://shelly1-3494546A51F2
  121. self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_SHELLY)
  122. self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_ZIGBEE)
  123. super().__init__(mqtt_client)
  124. ##### TEMPORARY ###################################################################################################################
  125. self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_GUI)
  126. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
  127. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
  128. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
  129. self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
  130. self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
  131. ##### TEMPORARY ###################################################################################################################
  132. #
  133. # Virtual Device Interface
  134. #
  135. self.main_light_videv = videv_switch_brightness(
  136. mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_VIDEV,
  137. self.main_light_shelly, devices.shelly.KEY_OUTPUT_0,
  138. self.main_light_tradfri, devices.tradfri_light.KEY_BRIGHTNESS
  139. )