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.

common.py 2.0KB

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