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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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.rooms = {}
  19. self.__devices__ = None
  20. #
  21. # ground floor west
  22. #
  23. self.gfw_floor = ground_floor_west_floor(mqtt_client)
  24. self.gfw_marion = ground_floor_west_marion(mqtt_client)
  25. self.gfw_dirk = ground_floor_west_dirk(mqtt_client)
  26. #
  27. # first floor west
  28. #
  29. self.ffw_julian = first_floor_west_julian(mqtt_client)
  30. self.ffw_living = first_floor_west_living(mqtt_client)
  31. #
  32. # first floor east
  33. #
  34. self.ffe_floor = first_floor_east_floor(mqtt_client)
  35. self.ffe_kitchen = first_floor_east_kitchen(mqtt_client)
  36. self.ffe_dining = first_floor_east_dining(mqtt_client)
  37. self.ffe_sleep_madi = first_floor_east_sleep_madi(mqtt_client)
  38. self.ffe_living = first_floor_east_living(mqtt_client)
  39. #
  40. # Input devices sleep_madi
  41. #
  42. self.ffe_button_tradfri_sleep = devices.tradfri_button(mqtt_client, topic="zigbee_og_e/input_device/og_east")
  43. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "toggle",
  44. self.ffe_sleep_madi.toggle_main_light)
  45. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "brightness_up_click",
  46. self.ffe_sleep_madi.toggle_bed_light_di)
  47. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "brightness_down_click",
  48. self.ffe_sleep_madi.toggle_bed_light_di)
  49. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "arrow_right_click",
  50. self.ffe_floor.toggle_main_light)
  51. def devicelist(self):
  52. if self.__devices__ is None:
  53. self.__devices__ = []
  54. for name, obj in inspect.getmembers(self):
  55. if obj.__class__.__module__.split('.')[0] == 'function':
  56. for devicename, device in inspect.getmembers(obj):
  57. if device.__class__.__module__ == "devices":
  58. self.__devices__.append(device)
  59. return self.__devices__