circulation pump function implemented
This commit is contained in:
parent
1c245a4118
commit
710d589e49
@ -5,10 +5,10 @@ import devices
|
|||||||
from function.ground_floor_west import ground_floor_west_floor, ground_floor_west_marion, ground_floor_west_dirk
|
from function.ground_floor_west import ground_floor_west_floor, ground_floor_west_marion, ground_floor_west_dirk
|
||||||
from function.first_floor_west import first_floor_west_julian, first_floor_west_living
|
from function.first_floor_west import first_floor_west_julian, first_floor_west_living
|
||||||
from function.first_floor_east import first_floor_east_floor, first_floor_east_kitchen, first_floor_east_dining, first_floor_east_sleep_madi, first_floor_east_living
|
from function.first_floor_east import first_floor_east_floor, first_floor_east_kitchen, first_floor_east_dining, first_floor_east_sleep_madi, first_floor_east_living
|
||||||
|
from function.common import common_heating, common_circulation_pump
|
||||||
import inspect
|
import inspect
|
||||||
from function import modules
|
from function import modules
|
||||||
|
|
||||||
# TODO: implement circulation pump
|
|
||||||
# TODO: implement switch off functionality (except of switch off button transportation)
|
# TODO: implement switch off functionality (except of switch off button transportation)
|
||||||
# TODO: implement garland (incl. day events like sunset, sunrise, ...)
|
# TODO: implement garland (incl. day events like sunset, sunrise, ...)
|
||||||
# TODO: implement existing nodered functionality "dirk" (ground floor west)
|
# TODO: implement existing nodered functionality "dirk" (ground floor west)
|
||||||
@ -20,10 +20,7 @@ class all_functions(object):
|
|||||||
self.mqtt_client = mqtt_client
|
self.mqtt_client = mqtt_client
|
||||||
#
|
#
|
||||||
self.__devices__ = None
|
self.__devices__ = None
|
||||||
#
|
# ground floor west
|
||||||
# add rooms
|
|
||||||
#
|
|
||||||
# # ground floor west
|
|
||||||
self.gfw_floor = ground_floor_west_floor(self.mqtt_client)
|
self.gfw_floor = ground_floor_west_floor(self.mqtt_client)
|
||||||
self.gfw_marion = ground_floor_west_marion(self.mqtt_client)
|
self.gfw_marion = ground_floor_west_marion(self.mqtt_client)
|
||||||
self.gfw_dirk = ground_floor_west_dirk(self.mqtt_client)
|
self.gfw_dirk = ground_floor_west_dirk(self.mqtt_client)
|
||||||
@ -36,11 +33,16 @@ class all_functions(object):
|
|||||||
self.ffe_dining = first_floor_east_dining(self.mqtt_client)
|
self.ffe_dining = first_floor_east_dining(self.mqtt_client)
|
||||||
self.ffe_sleep_madi = first_floor_east_sleep_madi(self.mqtt_client)
|
self.ffe_sleep_madi = first_floor_east_sleep_madi(self.mqtt_client)
|
||||||
self.ffe_living = first_floor_east_living(self.mqtt_client)
|
self.ffe_living = first_floor_east_living(self.mqtt_client)
|
||||||
|
# heating and warm water
|
||||||
|
self.common_heat_sleep_madi = common_heating(self.mqtt_client)
|
||||||
|
self.common_circulation_pump = common_circulation_pump(self.mqtt_client)
|
||||||
#
|
#
|
||||||
# additional functionality
|
# Interactions
|
||||||
#
|
#
|
||||||
|
# input device
|
||||||
self.init_input_device_sleep_madi_functionality()
|
self.init_input_device_sleep_madi_functionality()
|
||||||
self.init_heating_functionality()
|
# Circulation pump
|
||||||
|
self.init_circulation_pump()
|
||||||
|
|
||||||
def init_input_device_sleep_madi_functionality(self):
|
def init_input_device_sleep_madi_functionality(self):
|
||||||
#
|
#
|
||||||
@ -58,9 +60,9 @@ class all_functions(object):
|
|||||||
self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, None,
|
self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, None,
|
||||||
self.ffe_sleep_madi.fade_light)
|
self.ffe_sleep_madi.fade_light)
|
||||||
|
|
||||||
def init_heating_functionality(self):
|
def init_circulation_pump(self):
|
||||||
self.ffe_heating_sleep_madi = modules.heating_function_brennenstuhl(
|
self.common_circulation_pump.main_light_shelly.add_callback(
|
||||||
self.mqtt_client, "zigbee_og_e/radiator/sleep_madi", 20, "gui/ffe_bo_sleep_madi", "gui/ffe_ts_sleep_madi", "gui/ffe_bl_sleep_madi")
|
devices.shelly.KEY_OUTPUT_0, None, self.ffe_kitchen.flash_main_light)
|
||||||
|
|
||||||
def devicelist(self):
|
def devicelist(self):
|
||||||
if self.__devices__ is None:
|
if self.__devices__ is None:
|
||||||
|
56
function/common.py
Normal file
56
function/common.py
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#!/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/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.last_pump_value = None
|
||||||
|
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.last_pump_value != 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('-')
|
||||||
|
self.last_pump_value = data
|
||||||
|
|
||||||
|
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")
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import devices
|
import devices
|
||||||
import logging
|
import logging
|
||||||
|
import task
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from config import APP_NAME as ROOT_LOGGER_NAME
|
from config import APP_NAME as ROOT_LOGGER_NAME
|
||||||
@ -31,6 +32,9 @@ class room_shelly(room):
|
|||||||
#
|
#
|
||||||
self.gui_switch_main_light.add_callback(devices.nodered_gui.KEY_STATE, None, self.gui_switch_command)
|
self.gui_switch_main_light.add_callback(devices.nodered_gui.KEY_STATE, None, self.gui_switch_command)
|
||||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_switch_feedback)
|
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_switch_feedback)
|
||||||
|
#
|
||||||
|
self.last_flash_data = None
|
||||||
|
self.delayed_task = task.delayed(.25, self.toggle_main_light, None, None, None)
|
||||||
|
|
||||||
def all_off(self, device=None, key=None, data=None):
|
def all_off(self, device=None, key=None, data=None):
|
||||||
logger.info("Switching all off \"%s\"", type(self).__name__)
|
logger.info("Switching all off \"%s\"", type(self).__name__)
|
||||||
@ -45,6 +49,14 @@ class room_shelly(room):
|
|||||||
logger.info("Toggeling \"%s\" main light", type(self).__name__)
|
logger.info("Toggeling \"%s\" main light", type(self).__name__)
|
||||||
self.main_light_shelly.set_output_0("toggle")
|
self.main_light_shelly.set_output_0("toggle")
|
||||||
|
|
||||||
|
def flash_main_light(self, device, key, data):
|
||||||
|
logging.info("%s::%s", key, str(data))
|
||||||
|
if self.last_flash_data != data and data is True:
|
||||||
|
logger.info("Flashing \"%s\" main light", type(self).__name__)
|
||||||
|
self.toggle_main_light(device, key, data)
|
||||||
|
self.delayed_task.run()
|
||||||
|
self.last_flash_data = data
|
||||||
|
|
||||||
|
|
||||||
class room_shelly_tradfri_light(room_shelly):
|
class room_shelly_tradfri_light(room_shelly):
|
||||||
def __init__(self, mqtt_client, topic_shelly, topic_gui_switch, topic_tradfri_light, topic_gui_brightness, topic_gui_color_temp):
|
def __init__(self, mqtt_client, topic_shelly, topic_gui_switch, topic_tradfri_light, topic_gui_brightness, topic_gui_color_temp):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user