1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
-
- import devices
- from function.rooms import room_shelly
- from function.modules import heating_function_brennenstuhl
- from function.helpers import changed_value_indicator
- 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/circulation_pump", "gui/common_sw_circulation_pump")
- #
- self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.circ_pump_actions)
- #
- self.gui_timer_view = devices.nodered_gui(mqtt_client, "gui/ffe_circ_pump_timer")
- self.gui_timer_view.set_feedback('-')
- #
- self.cvi = changed_value_indicator()
- self.ct = task.periodic(6, self.cyclic_task)
- self.pump_timer = None
- #
- self.ct.run()
-
- def circ_pump_actions(self, device, key, data):
- if self.cvi.changed_here(device.topic, key, data) and data is True:
- self.pump_timer = 10
- self.gui_timer_view.set_feedback(self.pump_timer)
- elif data is False:
- 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_og_e/radiator/sleep_madi", 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
|