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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 bed light dirk fading by input device
  10. # TODO: implement heating function sleep_madi
  11. # TODO: implement circulation pump
  12. # TODO: implement switch off functionality (except of switch off button transportation)
  13. # TODO: implement garland (incl. day events like sunset, sunrise, ...)
  14. # TODO: implement existing nodered functionality "dirk" (ground floor west)
  15. # TODO: implement warning message
  16. class all_functions(object):
  17. def __init__(self, mqtt_client):
  18. self.mqtt_client = mqtt_client
  19. #
  20. self.__devices__ = None
  21. #
  22. # add rooms
  23. #
  24. # # ground floor west
  25. self.gfw_floor = ground_floor_west_floor(self.mqtt_client)
  26. self.gfw_marion = ground_floor_west_marion(self.mqtt_client)
  27. self.gfw_dirk = ground_floor_west_dirk(self.mqtt_client)
  28. # first floor west
  29. self.ffw_julian = first_floor_west_julian(self.mqtt_client)
  30. self.ffw_living = first_floor_west_living(self.mqtt_client)
  31. # first floor east
  32. self.ffe_floor = first_floor_east_floor(self.mqtt_client)
  33. self.ffe_kitchen = first_floor_east_kitchen(self.mqtt_client)
  34. self.ffe_dining = first_floor_east_dining(self.mqtt_client)
  35. self.ffe_sleep_madi = first_floor_east_sleep_madi(self.mqtt_client)
  36. self.ffe_living = first_floor_east_living(self.mqtt_client)
  37. #
  38. # additional functionality
  39. #
  40. self.init_input_device_sleep_madi_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_bed_light)
  56. def devicelist(self):
  57. if self.__devices__ is None:
  58. self.__devices__ = []
  59. for name, obj in inspect.getmembers(self):
  60. if obj.__class__.__module__ == "devices":
  61. self.__devices__.append(obj)
  62. elif obj.__class__.__module__.split('.')[0] == 'function':
  63. for devicename, device in inspect.getmembers(obj):
  64. if device.__class__.__module__ == "devices":
  65. self.__devices__.append(device)
  66. return self.__devices__