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.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. # TODO: implement heating function sleep_madi
  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. def init_input_device_sleep_madi_functionality(self):
  41. #
  42. self.ffe_button_tradfri_sleep = devices.tradfri_button(
  43. self.mqtt_client, topic="zigbee_og_e/input_device/og_east")
  44. #
  45. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "toggle",
  46. self.ffe_sleep_madi.toggle_main_light)
  47. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "brightness_up_click",
  48. self.ffe_sleep_madi.toggle_bed_light_di)
  49. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "brightness_down_click",
  50. self.ffe_sleep_madi.toggle_bed_light_di)
  51. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "arrow_right_click",
  52. self.ffe_floor.toggle_main_light)
  53. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, None,
  54. self.ffe_sleep_madi.fade_light)
  55. def devicelist(self):
  56. if self.__devices__ is None:
  57. self.__devices__ = []
  58. for name, obj in inspect.getmembers(self):
  59. if obj.__class__.__module__ == "devices":
  60. self.__devices__.append(obj)
  61. elif obj.__class__.__module__.split('.')[0] == 'function':
  62. for devicename, device in inspect.getmembers(obj):
  63. if device.__class__.__module__ == "devices":
  64. self.__devices__.append(device)
  65. return self.__devices__