Smarthome Functionen
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

__init__.py 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. import devices
  5. from function.ground_floor_west import ground_floor_west_floor, ground_floor_west_marion, ground_floor_west_dirk
  6. from function.first_floor_west import first_floor_west_julian, first_floor_west_living
  7. from function.first_floor_east import first_floor_east_floor, first_floor_east_kitchen, first_floor_east_dining, first_floor_east_sleep_madi, first_floor_east_living
  8. import inspect
  9. from function import modules
  10. # TODO: implement circulation pump
  11. # TODO: implement switch off functionality (except of switch off button transportation)
  12. # TODO: implement garland (incl. day events like sunset, sunrise, ...)
  13. # TODO: implement existing nodered functionality "dirk" (ground floor west)
  14. # TODO: implement warning message
  15. class all_functions(object):
  16. def __init__(self, mqtt_client):
  17. self.mqtt_client = mqtt_client
  18. #
  19. self.__devices__ = None
  20. #
  21. # add rooms
  22. #
  23. # # ground floor west
  24. self.gfw_floor = ground_floor_west_floor(self.mqtt_client)
  25. self.gfw_marion = ground_floor_west_marion(self.mqtt_client)
  26. self.gfw_dirk = ground_floor_west_dirk(self.mqtt_client)
  27. # first floor west
  28. self.ffw_julian = first_floor_west_julian(self.mqtt_client)
  29. self.ffw_living = first_floor_west_living(self.mqtt_client)
  30. # first floor east
  31. self.ffe_floor = first_floor_east_floor(self.mqtt_client)
  32. self.ffe_kitchen = first_floor_east_kitchen(self.mqtt_client)
  33. self.ffe_dining = first_floor_east_dining(self.mqtt_client)
  34. self.ffe_sleep_madi = first_floor_east_sleep_madi(self.mqtt_client)
  35. self.ffe_living = first_floor_east_living(self.mqtt_client)
  36. #
  37. # additional functionality
  38. #
  39. self.init_input_device_sleep_madi_functionality()
  40. self.init_heating_functionality()
  41. def init_input_device_sleep_madi_functionality(self):
  42. #
  43. self.ffe_button_tradfri_sleep = devices.tradfri_button(
  44. self.mqtt_client, topic="zigbee_og_e/input_device/og_east")
  45. #
  46. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "toggle",
  47. self.ffe_sleep_madi.toggle_main_light)
  48. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "brightness_up_click",
  49. self.ffe_sleep_madi.toggle_bed_light_di)
  50. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "brightness_down_click",
  51. self.ffe_sleep_madi.toggle_bed_light_di)
  52. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "arrow_right_click",
  53. self.ffe_floor.toggle_main_light)
  54. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, None,
  55. self.ffe_sleep_madi.fade_light)
  56. def init_heating_functionality(self):
  57. self.ffe_heating_sleep_madi = modules.heating_function_brennenstuhl(
  58. self.mqtt_client, "zigbee_og_e/radiator/sleep_madi", 20, "gui/ffe_bo_sleep_madi", "gui/ffe_ts_sleep_madi", "gui/ffe_bl_sleep_madi")
  59. def devicelist(self):
  60. if self.__devices__ is None:
  61. self.__devices__ = []
  62. for name, obj in inspect.getmembers(self):
  63. if obj.__class__.__module__ == "devices":
  64. self.__devices__.append(obj)
  65. elif obj.__class__.__module__.split('.')[0] == 'function':
  66. for devicename, device in inspect.getmembers(obj):
  67. if device.__class__.__module__ == "devices":
  68. self.__devices__.append(device)
  69. return self.__devices__