#!/usr/bin/env python # -*- coding: utf-8 -*- # import devices from function.rooms import room_shelly from function.modules import heating_function_brennenstuhl import logging import task try: from config import APP_NAME as ROOT_LOGGER_NAME except ImportError: ROOT_LOGGER_NAME = 'root' logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__) class common_circulation_pump(room_shelly): def __init__(self, mqtt_client): # http://shelly1-E89F6D85A466 super().__init__(mqtt_client, "shellies/ffe/kitchen/circulation_pump", "gui/none/common/circulation_pump/switch") # self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.circ_pump_actions, True) # self.gui_timer_view = devices.nodered_gui_heatvalve(mqtt_client, "gui/ffe_circ_pump_timer") self.gui_timer_view.set_feedback('-') # self.ct = task.periodic(6, self.cyclic_task) self.pump_timer = None # self.ct.run() def circ_pump_actions(self, device, key, data): if data is True: self.pump_timer = 10 self.gui_timer_view.set_feedback(self.pump_timer) else: self.pump_timer = None self.gui_timer_view.set_feedback('-') def cyclic_task(self, rt): if self.pump_timer is not None: if self.pump_timer <= 0: self.pump_timer = None self.gui_timer_view.set_feedback('-') else: self.gui_timer_view.set_feedback(self.pump_timer) self.pump_timer -= self.ct.cycle_time / 60 class common_heating(object): def __init__(self, mqtt_client): self.ffe_heating_sleep_madi = heating_function_brennenstuhl( mqtt_client, "zigbee/ffe/sleep/radiator_valve", 20, "gui/ffe_bo_sleep_madi", "gui/ffe_ts_sleep_madi", "gui/ffe_bl_sleep_madi") def all_off(self): pass # dummy method for compatibility reasons