Smarthome Functionen
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

__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. # TODO: implement bed light dirk fading by input device
  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 (incl. fixing all_functions.devicelist
  15. class all_functions(object):
  16. def __init__(self, mqtt_client):
  17. self.rooms = {}
  18. self.__devices__ = None
  19. #
  20. # ground floor west
  21. #
  22. self.gfw_floor = ground_floor_west_floor(mqtt_client)
  23. self.gfw_marion = ground_floor_west_marion(mqtt_client)
  24. self.gfw_dirk = ground_floor_west_dirk(mqtt_client)
  25. #
  26. # first floor west
  27. #
  28. self.ffw_julian = first_floor_west_julian(mqtt_client)
  29. self.ffw_living = first_floor_west_living(mqtt_client)
  30. #
  31. # first floor east
  32. #
  33. self.ffe_floor = first_floor_east_floor(mqtt_client)
  34. self.ffe_kitchen = first_floor_east_kitchen(mqtt_client)
  35. self.ffe_dining = first_floor_east_dining(mqtt_client)
  36. self.ffe_sleep_madi = first_floor_east_sleep_madi(mqtt_client)
  37. self.ffe_living = first_floor_east_living(mqtt_client)
  38. #
  39. # Input devices sleep_madi
  40. #
  41. self.ffe_button_tradfri_sleep = devices.tradfri_button(mqtt_client, topic="zigbee_og_e/input_device/og_east")
  42. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "toggle",
  43. self.ffe_sleep_madi.toggle_main_light)
  44. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "brightness_up_click",
  45. self.ffe_sleep_madi.toggle_bed_light_di)
  46. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "brightness_down_click",
  47. self.ffe_sleep_madi.toggle_bed_light_di)
  48. self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "arrow_right_click",
  49. self.ffe_floor.toggle_main_light)
  50. def devicelist(self):
  51. raise Exception
  52. # TODO: generate list by using getattr
  53. if self.__devices__ is None:
  54. self.__devices__ = []
  55. for room in self.rooms:
  56. for name, obj in inspect.getmembers(room):
  57. if type(obj) in devices.DEVICE_TYPE_LIST():
  58. self.__devices__.append(obj)
  59. return self.__devices__