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.

ground_floor_west.py 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. import devices
  5. import logging
  6. from function.rooms import room_shelly, room_shelly_tradfri_light, room_shelly_silvercrest_light
  7. try:
  8. from config import APP_NAME as ROOT_LOGGER_NAME
  9. except ImportError:
  10. ROOT_LOGGER_NAME = 'root'
  11. logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
  12. class ground_floor_west_floor(room_shelly_silvercrest_light):
  13. # https://shelly1l-84CCA8AD1148
  14. def __init__(self, mqtt_client):
  15. super().__init__(mqtt_client, "shellies/floor_eg_w", "gui/gfw_sw_floor",
  16. "zigbee_eg_w/light/floor_eg_w/a", "gui/gfw_br_floor", "gui/gfw_ct_floor")
  17. #
  18. # Callback initialisation
  19. #
  20. self.main_light_tradfri_2 = devices.tradfri_light(mqtt_client, "zigbee_eg_w/light/floor_eg_w/b")
  21. self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS,
  22. None, self.sync_brightness_main_light)
  23. self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP,
  24. None, self.sync_color_temp_main_light)
  25. def send_init_message_main_light(self):
  26. return super().send_init_message_main_light()
  27. self.main_light_tradfri_2.mqtt_client.send(self.main_light_tradfri_2.topic + "/get", '{"state": ""}')
  28. def sync_brightness_main_light(self, device, key, data):
  29. self.main_light_tradfri_2.set_brightness(data)
  30. def sync_color_temp_main_light(self, device, key, data):
  31. self.main_light_tradfri_2.set_color_temp(data)
  32. class ground_floor_west_marion(room_shelly):
  33. # https://shelly1l-E8DB84A1E067
  34. def __init__(self, mqtt_client):
  35. super().__init__(mqtt_client, "shellies/marion", "gui/gfw_sw_marion")
  36. class ground_floor_west_dirk(room_shelly_tradfri_light):
  37. # https://shelly1l-3C6105E44F27
  38. def __init__(self, mqtt_client):
  39. super().__init__(mqtt_client, "shellies/dirk", "gui/gfw_sw_dirk",
  40. "zigbee_eg_w/light/dirk", "gui/gfw_br_dirk", "gui/gfw_ct_dirk")