Smarthome Functionen
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. import devices
  5. from function.rooms import room_shelly
  6. from function.modules import heating_function_brennenstuhl
  7. import logging
  8. import task
  9. try:
  10. from config import APP_NAME as ROOT_LOGGER_NAME
  11. except ImportError:
  12. ROOT_LOGGER_NAME = 'root'
  13. logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
  14. class common_circulation_pump(room_shelly):
  15. def __init__(self, mqtt_client):
  16. # http://shelly1-E89F6D85A466
  17. super().__init__(mqtt_client, "shellies/ffe/kitchen/circulation_pump", "gui/none/common/circulation_pump/switch")
  18. #
  19. self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.circ_pump_actions, True)
  20. #
  21. self.gui_timer_view = devices.nodered_gui_heatvalve(mqtt_client, "gui/ffe_circ_pump_timer")
  22. self.gui_timer_view.set_feedback('-')
  23. #
  24. self.ct = task.periodic(6, self.cyclic_task)
  25. self.pump_timer = None
  26. #
  27. self.ct.run()
  28. def circ_pump_actions(self, device, key, data):
  29. if data is True:
  30. self.pump_timer = 10
  31. self.gui_timer_view.set_feedback(self.pump_timer)
  32. else:
  33. self.pump_timer = None
  34. self.gui_timer_view.set_feedback('-')
  35. def cyclic_task(self, rt):
  36. if self.pump_timer is not None:
  37. if self.pump_timer <= 0:
  38. self.pump_timer = None
  39. self.gui_timer_view.set_feedback('-')
  40. else:
  41. self.gui_timer_view.set_feedback(self.pump_timer)
  42. self.pump_timer -= self.ct.cycle_time / 60
  43. class common_heating(object):
  44. def __init__(self, mqtt_client):
  45. self.ffe_heating_sleep_madi = heating_function_brennenstuhl(
  46. mqtt_client, "zigbee/ffe/sleep/radiator_valve", 20, "gui/ffe_bo_sleep_madi", "gui/ffe_ts_sleep_madi", "gui/ffe_bl_sleep_madi")
  47. def all_off(self):
  48. pass # dummy method for compatibility reasons