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_west.py 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. import config
  5. import devices
  6. from function.db import get_radiator_data, set_radiator_data
  7. from function.modules import heating_function
  8. from function.rooms import room, room_collection
  9. from function.videv import videv_switch_brightness, videv_switch_brightness_color_temp, videv_heating
  10. import logging
  11. try:
  12. from config import APP_NAME as ROOT_LOGGER_NAME
  13. except ImportError:
  14. ROOT_LOGGER_NAME = 'root'
  15. logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
  16. class first_floor_west(room_collection):
  17. def __init__(self, mqtt_client):
  18. super().__init__(mqtt_client)
  19. self.bath = first_floor_west_bath(mqtt_client)
  20. self.julian = first_floor_west_julian(mqtt_client)
  21. self.livingroom = first_floor_west_living(mqtt_client)
  22. self.sleep = first_floor_west_sleep(mqtt_client)
  23. class first_floor_west_julian(room):
  24. def __init__(self, mqtt_client):
  25. #
  26. # Device initialisation
  27. #
  28. # http://shelly1l-3C6105E43452
  29. # main light
  30. self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_SHELLY)
  31. self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_ZIGBEE)
  32. # heating function
  33. self.heating_valve = devices.brennenstuhl_heatingvalve(mqtt_client, config.TOPIC_FFW_JULIAN_HEATING_VALVE_ZIGBEE)
  34. super().__init__(mqtt_client)
  35. #
  36. # Functionality initialisation
  37. #
  38. # heating function
  39. self.heating_function = heating_function(
  40. self.heating_valve,
  41. config.DEFAULT_TEMPERATURE[self.heating_valve.topic],
  42. **get_radiator_data(self.heating_valve.topic)
  43. )
  44. self.heating_function.add_callback(None, None, set_radiator_data, True)
  45. #
  46. # Virtual Device Interface
  47. #
  48. # main light
  49. self.main_light_videv = videv_switch_brightness_color_temp(
  50. mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_VIDEV,
  51. self.main_light_shelly, devices.shelly.KEY_OUTPUT_0,
  52. self.main_light_tradfri, devices.tradfri_light.KEY_BRIGHTNESS,
  53. self.main_light_tradfri, devices.tradfri_light.KEY_COLOR_TEMP
  54. )
  55. # # heating function
  56. # self.heating_function_videv = videv_heating(
  57. # mqtt_client, config.TOPIC_FFW_JULIAN_HEATING_VALVE_VIDEV,
  58. # self.heating_function
  59. # )
  60. class first_floor_west_bath(room):
  61. def __init__(self, mqtt_client):
  62. #
  63. # Device initialisation
  64. #
  65. # heating function
  66. self.heating_valve = devices.brennenstuhl_heatingvalve(mqtt_client, config.TOPIC_FFW_BATH_HEATING_VALVE_ZIGBEE)
  67. super().__init__(mqtt_client)
  68. #
  69. # Functionality initialisation
  70. #
  71. # heating function
  72. self.heating_function = heating_function(
  73. self.heating_valve,
  74. config.DEFAULT_TEMPERATURE[self.heating_valve.topic],
  75. **get_radiator_data(self.heating_valve.topic)
  76. )
  77. self.heating_function.add_callback(None, None, set_radiator_data, True)
  78. #
  79. # Virtual Device Interface
  80. #
  81. # heating function
  82. self.heating_function_videv = videv_heating(
  83. mqtt_client, config.TOPIC_FFW_BATH_HEATING_VALVE_VIDEV,
  84. self.heating_function
  85. )
  86. class first_floor_west_living(room):
  87. def __init__(self, mqtt_client):
  88. #
  89. # Device initialisation
  90. #
  91. # http://shelly1l-84CCA8ACE6A1
  92. # main light
  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. # # heating function
  96. # self.heating_valve = devices.brennenstuhl_heatingvalve(mqtt_client, config.TOPIC_FFW_LIVINGROOM_HEATING_VALVE_ZIGBEE)
  97. super().__init__(mqtt_client)
  98. #
  99. # Functionality initialisation
  100. #
  101. # # heating function
  102. # self.heating_function = heating_function(
  103. # self.heating_valve,
  104. # config.DEFAULT_TEMPERATURE[self.heating_valve.topic],
  105. # **get_radiator_data(self.heating_valve.topic)
  106. # )
  107. # self.heating_function.add_callback(None, None, set_radiator_data, True)
  108. #
  109. # Virtual Device Interface
  110. #
  111. # main light
  112. self.main_light_videv = videv_switch_brightness_color_temp(
  113. mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_VIDEV,
  114. self.main_light_shelly, devices.shelly.KEY_OUTPUT_0,
  115. self.main_light_tradfri, devices.tradfri_light.KEY_BRIGHTNESS,
  116. self.main_light_tradfri, devices.tradfri_light.KEY_COLOR_TEMP
  117. )
  118. # # heating function
  119. # self.heating_function_videv = videv_heating(
  120. # mqtt_client, config.TOPIC_FFW_LIVINGROOM_HEATING_VALVE_VIDEV,
  121. # self.heating_function
  122. # )
  123. class first_floor_west_sleep(room):
  124. def __init__(self, mqtt_client):
  125. #
  126. # Device initialisation
  127. #
  128. # http://shelly1-3494546A51F2
  129. # main light
  130. self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_SHELLY)
  131. self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_ZIGBEE)
  132. # heating function
  133. self.heating_valve = devices.brennenstuhl_heatingvalve(mqtt_client, config.TOPIC_FFW_SLEEP_HEATING_VALVE_ZIGBEE)
  134. super().__init__(mqtt_client)
  135. #
  136. # Functionality initialisation
  137. #
  138. # heating function
  139. self.heating_function = heating_function(
  140. self.heating_valve,
  141. config.DEFAULT_TEMPERATURE[self.heating_valve.topic],
  142. **get_radiator_data(self.heating_valve.topic)
  143. )
  144. self.heating_function.add_callback(None, None, set_radiator_data, True)
  145. #
  146. # Virtual Device Interface
  147. #
  148. # main light
  149. self.main_light_videv = videv_switch_brightness(
  150. mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_VIDEV,
  151. self.main_light_shelly, devices.shelly.KEY_OUTPUT_0,
  152. self.main_light_tradfri, devices.tradfri_light.KEY_BRIGHTNESS
  153. )
  154. # heating function
  155. self.heating_function_videv = videv_heating(
  156. mqtt_client, config.TOPIC_FFW_SLEEP_HEATING_VALVE_VIDEV,
  157. self.heating_function
  158. )