Smarthome Functionen
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

first_floor_west.py 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_SHELLY)
  30. self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_ZIGBEE)
  31. super().__init__(mqtt_client)
  32. #
  33. # Virtual Device Interface
  34. #
  35. self.main_light_videv = videv_switch_brightness_color_temp(
  36. mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_VIDEV,
  37. self.main_light_shelly, devices.shelly.KEY_OUTPUT_0,
  38. self.main_light_tradfri, devices.tradfri_light.KEY_BRIGHTNESS,
  39. self.main_light_tradfri, devices.tradfri_light.KEY_COLOR_TEMP
  40. )
  41. class first_floor_west_bath(room):
  42. def __init__(self, mqtt_client):
  43. #
  44. # Device initialisation
  45. #
  46. self.heating_valve = devices.brennenstuhl_heatingvalve(mqtt_client, config.TOPIC_FFW_BATH_HEATING_VALVE_ZIGBEE)
  47. super().__init__(mqtt_client)
  48. #
  49. # Functionality initialisation
  50. #
  51. # heating function
  52. self.heating_function = heating_function(
  53. self.heating_valve,
  54. config.DEFAULT_TEMPERATURE[self.heating_valve.topic],
  55. **get_radiator_data(self.heating_valve.topic)
  56. )
  57. self.heating_function.add_callback(None, None, set_radiator_data, True)
  58. #
  59. # Virtual Device Interface
  60. #
  61. self.heating_function_videv = videv_heating(
  62. mqtt_client, config.TOPIC_FFW_BATH_HEATING_VALVE_VIDEV,
  63. self.heating_function
  64. )
  65. class first_floor_west_living(room):
  66. def __init__(self, mqtt_client):
  67. #
  68. # Device initialisation
  69. #
  70. # http://shelly1l-84CCA8ACE6A1
  71. self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_SHELLY)
  72. self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_ZIGBEE)
  73. super().__init__(mqtt_client)
  74. #
  75. # Virtual Device Interface
  76. #
  77. self.main_light_videv = videv_switch_brightness_color_temp(
  78. mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_VIDEV,
  79. self.main_light_shelly, devices.shelly.KEY_OUTPUT_0,
  80. self.main_light_tradfri, devices.tradfri_light.KEY_BRIGHTNESS,
  81. self.main_light_tradfri, devices.tradfri_light.KEY_COLOR_TEMP
  82. )
  83. class first_floor_west_sleep(room):
  84. def __init__(self, mqtt_client):
  85. #
  86. # Device initialisation
  87. #
  88. # http://shelly1-3494546A51F2
  89. self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_SHELLY)
  90. self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_ZIGBEE)
  91. super().__init__(mqtt_client)
  92. #
  93. # Virtual Device Interface
  94. #
  95. self.main_light_videv = videv_switch_brightness(
  96. mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_VIDEV,
  97. self.main_light_shelly, devices.shelly.KEY_OUTPUT_0,
  98. self.main_light_tradfri, devices.tradfri_light.KEY_BRIGHTNESS
  99. )