old gui interface removed and clean up
This commit is contained in:
parent
f70ba22ce2
commit
1c417fb73f
@ -5,9 +5,10 @@
|
||||
import config
|
||||
import devices
|
||||
from function.modules import brightness_choose_n_action, timer_on_activation, heating_function
|
||||
import logging
|
||||
from function.rooms import room
|
||||
from function.videv import videv_switching, videv_switch_brightness, videv_switching_timer, videv_switch_brightness_color_temp, videv_heating, videv_multistate
|
||||
import logging
|
||||
|
||||
try:
|
||||
from config import APP_NAME as ROOT_LOGGER_NAME
|
||||
except ImportError:
|
||||
@ -24,12 +25,6 @@ class first_floor_east_floor(room):
|
||||
self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFE_FLOOR_MAIN_LIGHT_SHELLY)
|
||||
super().__init__(mqtt_client)
|
||||
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_FLOOR_MAIN_LIGHT_GUI)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
|
||||
#
|
||||
# Virtual Device Interface
|
||||
#
|
||||
@ -57,17 +52,6 @@ class first_floor_east_kitchen(room):
|
||||
self.circulation_pump = timer_on_activation(self.circulation_pump_shelly, devices.shelly.KEY_OUTPUT_0, 10*60)
|
||||
self.circulation_pump_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, True, self.main_light_shelly.flash_0_mcb, True)
|
||||
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_KITCHEN_MAIN_LIGHT_GUI)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
||||
|
||||
self.gui_circulation_pump = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_KITCHEN_CIRCULATION_PUMP_GUI)
|
||||
self.gui_circulation_pump.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.circulation_pump_shelly.set_output_0_mcb)
|
||||
self.circulation_pump_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_circulation_pump.set_state_mcb)
|
||||
self.circulation_pump.add_callback(timer_on_activation.KEY_TIMER, None, self.gui_circulation_pump.set_timer_mcb, True)
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
|
||||
#
|
||||
# Virtual Device Interface
|
||||
#
|
||||
@ -81,11 +65,6 @@ class first_floor_east_kitchen(room):
|
||||
self.circulation_pump, timer_on_activation.KEY_TIMER
|
||||
)
|
||||
|
||||
def all_off(self, device=None, key=None, data=None):
|
||||
self.circulation_pump_shelly.set_output_0(False)
|
||||
self.circulation_pump_shelly.set_output_1(False)
|
||||
return super().all_off(device, key, data)
|
||||
|
||||
|
||||
class first_floor_east_dining(room):
|
||||
def __init__(self, mqtt_client):
|
||||
@ -99,16 +78,6 @@ class first_floor_east_dining(room):
|
||||
self.garland_powerplug = devices.silvercrest_powerplug(mqtt_client, config.TOPIC_FFE_DININGROOM_GARLAND_POWERPLUG)
|
||||
super().__init__(mqtt_client)
|
||||
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_DININGROOM_MAIN_LIGHT_GUI)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
||||
|
||||
self.gui_floorlamp = devices.nodered_gui_switch(mqtt_client, config.TOPIC_FFE_DININGROOM_FLOOR_LAMP_GUI)
|
||||
self.gui_floorlamp.add_callback(devices.nodered_gui_switch.KEY_STATE, None, self.floorlamp_powerplug.set_output_0_mcb)
|
||||
self.floorlamp_powerplug.add_callback(devices.silvercrest_powerplug.KEY_OUTPUT_0, None, self.gui_floorlamp.set_state_mcb)
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
|
||||
#
|
||||
# Functionality initialisation
|
||||
#
|
||||
@ -131,12 +100,6 @@ class first_floor_east_dining(room):
|
||||
self.garland_powerplug, devices.silvercrest_powerplug.KEY_OUTPUT_0
|
||||
)
|
||||
|
||||
def all_off(self, device=None, key=None, data=None):
|
||||
super().all_off(device, key, data)
|
||||
self.floorlamp_powerplug.set_output_0(False)
|
||||
if config.CHRISTMAS:
|
||||
self.garland_powerplug.set_output_0(False)
|
||||
|
||||
|
||||
class first_floor_east_sleep(room):
|
||||
def __init__(self, mqtt_client):
|
||||
@ -173,68 +136,6 @@ class first_floor_east_sleep(room):
|
||||
# heating function
|
||||
self.heating_function = heating_function(self.heating_valve, config.DEFAULT_TEMPERATURE_FFE_SLEEP)
|
||||
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
# main light
|
||||
self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_SLEEP_MAIN_LIGHT_GUI)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
||||
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
|
||||
self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
|
||||
self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_main_light.set_color_temp_mcb)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.main_light_tradfri.set_color_temp_mcb)
|
||||
# bed light
|
||||
self.gui_bed_light_di = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_SLEEP_BED_LIGHT_DI_GUI)
|
||||
self.gui_bed_light_di.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.bed_light_di_tradfri.set_output_0_mcb)
|
||||
self.bed_light_di_tradfri.add_callback(devices.tradfri_light.KEY_OUTPUT_0, None, self.gui_bed_light_di.set_state_mcb)
|
||||
self.bed_light_di_tradfri.add_callback(devices.tradfri_light.KEY_OUTPUT_0, None, self.gui_bed_light_di.set_enable_mcb)
|
||||
self.gui_bed_light_di.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.bed_light_di_tradfri.set_brightness_mcb)
|
||||
self.bed_light_di_tradfri.add_callback(devices.tradfri_light.KEY_OUTPUT_0, None, self.gui_bed_light_di.set_enable_mcb)
|
||||
self.bed_light_di_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_bed_light_di.set_brightness_mcb)
|
||||
|
||||
self.gui_bed_light_ma = devices.nodered_gui_switch(mqtt_client, config.TOPIC_FFE_SLEEP_BED_LIGHT_MA_GUI)
|
||||
self.gui_bed_light_ma.add_callback(devices.nodered_gui_switch.KEY_STATE, None, self.bed_light_ma_powerplug.set_output_0_mcb)
|
||||
self.bed_light_ma_powerplug.add_callback(devices.silvercrest_powerplug.KEY_OUTPUT_0, None, self.gui_bed_light_ma.set_state_mcb)
|
||||
|
||||
# heating
|
||||
self.gui_heating = devices.nodered_gui_radiator(mqtt_client, config.TOPIC_FFE_SLEEP_HEATING_VALVE_GUI)
|
||||
self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_CURRENT, None, self.gui_heating.set_temperature_mcb, True)
|
||||
|
||||
def set_heating_setpoint(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_USER_TEMPERATURE_SETPOINT, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TEMP, None, set_heating_setpoint)
|
||||
self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_SETPOINT, None, self.gui_heating.set_setpoint_temperature_mcb, True)
|
||||
|
||||
def boost(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_START_BOOST, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_BOOST, None, boost)
|
||||
|
||||
def setpoint_to_default(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_SET_DEFAULT_TEMPERATURE, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TO_DEFAULT, None, setpoint_to_default)
|
||||
|
||||
def away_mode(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_AWAY_MODE, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_AWAY, None, away_mode)
|
||||
self.heating_function.add_callback(heating_function.KEY_AWAY_MODE, None, self.gui_heating.set_away_mcb)
|
||||
|
||||
def summer_mode(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_SUMMER_MODE, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SUMMER, None, summer_mode)
|
||||
self.heating_function.add_callback(heating_function.KEY_SUMMER_MODE, None, self.gui_heating.set_summer_mcb)
|
||||
|
||||
self.heating_function.add_callback(heating_function.KEY_BOOST_TIMER, None, self.gui_heating.set_timer_mcb)
|
||||
|
||||
# active device led
|
||||
self.gui_led_active_device = devices.nodered_gui_leds(mqtt_client, config.TOPIC_FFE_SLEEP_DEVICE_CHOOSER_LED)
|
||||
|
||||
def update_active_device_led(device, key, data):
|
||||
for i in range(0, len(self.brightness_functions.brightness_device_list)):
|
||||
self.gui_led_active_device.set_led(devices.nodered_gui_leds.KEY_LED_LIST[i], data == i)
|
||||
self.brightness_functions.add_callback(brightness_choose_n_action.KEY_ACTIVE_DEVICE, None, update_active_device_led, True)
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
|
||||
#
|
||||
# Virtual Device Interface
|
||||
#
|
||||
@ -262,11 +163,6 @@ class first_floor_east_sleep(room):
|
||||
brightness_choose_n_action.KEY_ACTIVE_DEVICE, self.brightness_functions, 2
|
||||
)
|
||||
|
||||
def all_off(self, device=None, key=None, data=None):
|
||||
super().all_off(device, key, data)
|
||||
self.bed_light_di_tradfri.set_output_0(False)
|
||||
self.bed_light_ma_powerplug.set_output_0(False)
|
||||
|
||||
|
||||
class first_floor_east_living(room):
|
||||
def __init__(self, mqtt_client):
|
||||
@ -290,33 +186,6 @@ class first_floor_east_living(room):
|
||||
# floor lamp synchronisation with main_light
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.floorlamp_tradfri.set_output_0_mcb, True)
|
||||
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
# main light
|
||||
self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_LIVINGROOM_MAIN_LIGHT_GUI)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
|
||||
self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
|
||||
self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_main_light.set_color_temp_mcb)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.main_light_tradfri.set_color_temp_mcb)
|
||||
|
||||
self.gui_floorlamp = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFE_LIVINGROOM_FLOOR_LAMP_GUI)
|
||||
self.gui_floorlamp.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.floorlamp_tradfri.set_output_0_mcb)
|
||||
self.gui_floorlamp.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.floorlamp_tradfri.set_brightness_mcb)
|
||||
self.gui_floorlamp.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.floorlamp_tradfri.set_color_temp_mcb)
|
||||
self.floorlamp_tradfri[0].add_callback(devices.tradfri_light.KEY_OUTPUT_0, None, self.gui_floorlamp.set_state_mcb)
|
||||
self.floorlamp_tradfri[0].add_callback(devices.tradfri_light.KEY_OUTPUT_0, None, self.gui_floorlamp.set_enable_mcb)
|
||||
self.floorlamp_tradfri[0].add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_floorlamp.set_brightness_mcb)
|
||||
self.floorlamp_tradfri[0].add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_floorlamp.set_color_temp_mcb)
|
||||
|
||||
if config.CHRISTMAS:
|
||||
self.gui_xmas_tree = devices.nodered_gui_switch(mqtt_client, config.TOPIC_FFE_LIVINGROOM_XMAS_TREE_GUI)
|
||||
self.powerplug_xmas_tree.add_callback(devices.silvercrest_powerplug.KEY_OUTPUT_0, None, self.powerplug_xmas_star.set_output_0_mcb)
|
||||
self.powerplug_xmas_tree.add_callback(devices.silvercrest_powerplug.KEY_OUTPUT_0, None, self.gui_xmas_tree.set_state_mcb)
|
||||
self.gui_xmas_tree.add_callback(devices.nodered_gui_switch.KEY_STATE, None, self.powerplug_xmas_tree.set_output_0_mcb)
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
|
||||
#
|
||||
# Virtual Device Interface
|
||||
#
|
||||
@ -337,10 +206,3 @@ class first_floor_east_living(room):
|
||||
mqtt_client, config.TOPIC_FFE_LIVINGROOM_XMAS_TREE_VIDEV,
|
||||
self.powerplug_xmas_tree, devices.silvercrest_powerplug.KEY_OUTPUT_0
|
||||
)
|
||||
|
||||
def all_off(self, device=None, key=None, data=None):
|
||||
super().all_off(device, key, data)
|
||||
self.floorlamp_tradfri.set_output_0(False)
|
||||
if config.CHRISTMAS:
|
||||
self.powerplug_xmas_tree.set_output_0(False)
|
||||
self.powerplug_xmas_star.set_output_0(False)
|
||||
|
@ -4,10 +4,10 @@
|
||||
|
||||
import config
|
||||
import devices
|
||||
import logging
|
||||
from function.modules import heating_function
|
||||
from function.rooms import room
|
||||
from function.videv import videv_switch_brightness, videv_switch_brightness_color_temp, videv_heating
|
||||
import logging
|
||||
|
||||
|
||||
try:
|
||||
@ -27,18 +27,6 @@ class first_floor_west_julian(room):
|
||||
self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_ZIGBEE)
|
||||
super().__init__(mqtt_client)
|
||||
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_GUI)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
||||
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
|
||||
self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
|
||||
self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_main_light.set_color_temp_mcb)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.main_light_tradfri.set_color_temp_mcb)
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
|
||||
#
|
||||
# Virtual Device Interface
|
||||
#
|
||||
@ -63,36 +51,6 @@ class first_floor_west_bath(room):
|
||||
# heating function
|
||||
self.heating_function = heating_function(self.heating_valve, config.DEFAULT_TEMPERATURE_FFW_BATH)
|
||||
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
self.gui_heating = devices.nodered_gui_radiator(mqtt_client, config.TOPIC_FFW_BATH_HEATING_VALVE_GUI)
|
||||
self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_CURRENT, None, self.gui_heating.set_temperature_mcb, True)
|
||||
|
||||
def set_heating_setpoint(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_USER_TEMPERATURE_SETPOINT, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TEMP, None, set_heating_setpoint)
|
||||
self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_SETPOINT, None, self.gui_heating.set_setpoint_temperature_mcb, True)
|
||||
|
||||
def boost(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_START_BOOST, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_BOOST, None, boost)
|
||||
|
||||
def setpoint_to_default(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_SET_DEFAULT_TEMPERATURE, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TO_DEFAULT, None, setpoint_to_default)
|
||||
|
||||
def away_mode(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_AWAY_MODE, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_AWAY, None, away_mode)
|
||||
self.heating_function.add_callback(heating_function.KEY_AWAY_MODE, None, self.gui_heating.set_away_mcb)
|
||||
|
||||
def summer_mode(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_SUMMER_MODE, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SUMMER, None, summer_mode)
|
||||
self.heating_function.add_callback(heating_function.KEY_SUMMER_MODE, None, self.gui_heating.set_summer_mcb)
|
||||
|
||||
self.heating_function.add_callback(heating_function.KEY_BOOST_TIMER, None, self.gui_heating.set_timer_mcb)
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
|
||||
#
|
||||
# Virtual Device Interface
|
||||
#
|
||||
@ -101,9 +59,6 @@ class first_floor_west_bath(room):
|
||||
self.heating_function
|
||||
)
|
||||
|
||||
def all_off(self):
|
||||
pass
|
||||
|
||||
|
||||
class first_floor_west_living(room):
|
||||
def __init__(self, mqtt_client):
|
||||
@ -115,18 +70,6 @@ class first_floor_west_living(room):
|
||||
self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_ZIGBEE)
|
||||
super().__init__(mqtt_client)
|
||||
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_GUI)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
||||
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
|
||||
self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
|
||||
self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_main_light.set_color_temp_mcb)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.main_light_tradfri.set_color_temp_mcb)
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
|
||||
#
|
||||
# Virtual Device Interface
|
||||
#
|
||||
@ -148,16 +91,6 @@ class first_floor_west_sleep(room):
|
||||
self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_ZIGBEE)
|
||||
super().__init__(mqtt_client)
|
||||
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_GUI)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
||||
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
|
||||
self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
|
||||
#
|
||||
# Virtual Device Interface
|
||||
#
|
||||
|
@ -4,10 +4,10 @@
|
||||
|
||||
import config
|
||||
import devices
|
||||
from function.modules import brightness_choose_n_action, heating_function
|
||||
import logging
|
||||
from function.modules import brightness_choose_n_action, heating_function, switched_light
|
||||
from function.rooms import room
|
||||
from function.videv import videv_switching, videv_switch_brightness_color_temp, videv_heating, videv_multistate, videv_audio_player
|
||||
import logging
|
||||
import task
|
||||
|
||||
try:
|
||||
@ -34,19 +34,7 @@ class ground_floor_west_floor(room):
|
||||
# Functionality initialisation
|
||||
#
|
||||
# Request silvercrest data of lead light after power on
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, True, self.main_light_tradfri[0].request_data, True)
|
||||
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_GFW_FLOOR_MAIN_LIGHT_GUI)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
||||
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
|
||||
self.main_light_tradfri[0].add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
|
||||
self.main_light_tradfri[0].add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_main_light.set_color_temp_mcb)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.main_light_tradfri.set_color_temp_mcb)
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
switched_light(self.main_light_shelly, devices.shelly.KEY_OUTPUT_0, self.main_light_tradfri)
|
||||
|
||||
#
|
||||
# Virtual Device Interface
|
||||
@ -75,40 +63,6 @@ class ground_floor_west_marion(room):
|
||||
# heating function
|
||||
self.heating_function = heating_function(self.heating_valve, config.DEFAULT_TEMPERATURE_GFW_MARION)
|
||||
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_GFW_MARION_MAIN_LIGHT_GUI)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
||||
|
||||
self.gui_heating = devices.nodered_gui_radiator(mqtt_client, config.TOPIC_GFW_MARION_HEATING_VALVE_GUI)
|
||||
self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_CURRENT, None, self.gui_heating.set_temperature_mcb, True)
|
||||
|
||||
def set_heating_setpoint(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_USER_TEMPERATURE_SETPOINT, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TEMP, None, set_heating_setpoint)
|
||||
self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_SETPOINT, None, self.gui_heating.set_setpoint_temperature_mcb, True)
|
||||
|
||||
def boost(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_START_BOOST, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_BOOST, None, boost)
|
||||
|
||||
def setpoint_to_default(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_SET_DEFAULT_TEMPERATURE, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TO_DEFAULT, None, setpoint_to_default)
|
||||
|
||||
def away_mode(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_AWAY_MODE, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_AWAY, None, away_mode)
|
||||
self.heating_function.add_callback(heating_function.KEY_AWAY_MODE, None, self.gui_heating.set_away_mcb)
|
||||
|
||||
def summer_mode(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_SUMMER_MODE, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SUMMER, None, summer_mode)
|
||||
self.heating_function.add_callback(heating_function.KEY_SUMMER_MODE, None, self.gui_heating.set_summer_mcb)
|
||||
|
||||
self.heating_function.add_callback(heating_function.KEY_BOOST_TIMER, None, self.gui_heating.set_timer_mcb)
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
|
||||
#
|
||||
# Virtual Device Interface
|
||||
#
|
||||
@ -128,10 +82,6 @@ class ground_floor_west_dirk(room):
|
||||
STATE_ACTIVE_DEVICE_AMPLIFIER = 2
|
||||
STATE_ACTIVE_DEVICE_MAX_VALUE = STATE_ACTIVE_DEVICE_AMPLIFIER
|
||||
#
|
||||
LED_ACTIVE_DEVICE_MAIN_LIGHT = devices.nodered_gui_leds.KEY_LED_0
|
||||
LED_ACTIVE_DEVICE_DESK_LIGHT = devices.nodered_gui_leds.KEY_LED_1
|
||||
LED_ACTIVE_DEVICE_AMPLIFIER = devices.nodered_gui_leds.KEY_LED_2
|
||||
#
|
||||
KEY_POWERPLUG_AMPLIFIER = devices.my_powerplug.KEY_OUTPUT_0
|
||||
KEY_POWERPLUG_CD_PLAYER = devices.my_powerplug.KEY_OUTPUT_2
|
||||
KEY_POWERPLUG_DESK_LIGHT = devices.my_powerplug.KEY_OUTPUT_1
|
||||
@ -194,71 +144,6 @@ class ground_floor_west_dirk(room):
|
||||
# heating function
|
||||
self.heating_function = heating_function(self.heating_valve, config.DEFAULT_TEMPERATURE_GFW_DIRK)
|
||||
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_GFW_DIRK_MAIN_LIGHT_GUI)
|
||||
self.gui_desk_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_GFW_DIRK_DESK_LIGHT_GUI)
|
||||
self.gui_amplifier = devices.nodered_gui_switch(mqtt_client, config.TOPIC_GFW_DIRK_AMPLIFIER_GUI)
|
||||
self.gui_cd_player = devices.nodered_gui_switch(mqtt_client, config.TOPIC_GFW_DIRK_CD_PLAYER_GUI)
|
||||
self.gui_pc_dock = devices.nodered_gui_switch(mqtt_client, config.TOPIC_GFW_DIRK_PC_DOCK_GUI)
|
||||
# Callback initialisation
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_enable_mcb)
|
||||
self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_main_light.set_brightness_mcb)
|
||||
self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_main_light.set_color_temp_mcb)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.main_light_tradfri.set_brightness_mcb)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.main_light_tradfri.set_color_temp_mcb)
|
||||
self.gui_desk_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.powerplug_common.set_output_1_mcb)
|
||||
self.powerplug_common.add_callback(self.KEY_POWERPLUG_DESK_LIGHT, None, self.gui_desk_light.set_state_mcb)
|
||||
self.gui_desk_light.add_callback(devices.nodered_gui_light.KEY_BRIGHTNESS, None, self.desk_light_tradfri.set_brightness_mcb)
|
||||
self.gui_desk_light.add_callback(devices.nodered_gui_light.KEY_COLOR_TEMP, None, self.desk_light_tradfri.set_color_temp_mcb)
|
||||
self.powerplug_common.add_callback(self.KEY_POWERPLUG_DESK_LIGHT, None, self.gui_desk_light.set_enable_mcb)
|
||||
self.desk_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS, None, self.gui_desk_light.set_brightness_mcb)
|
||||
self.desk_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP, None, self.gui_desk_light.set_color_temp_mcb)
|
||||
self.gui_amplifier.add_callback(devices.nodered_gui_switch.KEY_STATE, None, self.powerplug_common.set_output_0_mcb)
|
||||
self.powerplug_common.add_callback(self.KEY_POWERPLUG_AMPLIFIER, None, self.gui_amplifier.set_state_mcb)
|
||||
self.gui_cd_player.add_callback(devices.nodered_gui_switch.KEY_STATE, None, self.powerplug_common.set_output_2_mcb)
|
||||
self.powerplug_common.add_callback(self.KEY_POWERPLUG_CD_PLAYER, None, self.gui_cd_player.set_state_mcb)
|
||||
self.gui_pc_dock.add_callback(devices.nodered_gui_switch.KEY_STATE, None, self.powerplug_common.set_output_3_mcb)
|
||||
self.powerplug_common.add_callback(self.KEY_POWERPLUG_PC_DOCK, None, self.gui_pc_dock.set_state_mcb)
|
||||
|
||||
self.gui_heating = devices.nodered_gui_radiator(mqtt_client, config.TOPIC_GFW_DIRK_HEATING_VALVE_GUI)
|
||||
self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_CURRENT, None, self.gui_heating.set_temperature_mcb, True)
|
||||
|
||||
def set_heating_setpoint(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_USER_TEMPERATURE_SETPOINT, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TEMP, None, set_heating_setpoint)
|
||||
self.heating_function.add_callback(heating_function.KEY_TEMPERATURE_SETPOINT, None, self.gui_heating.set_setpoint_temperature_mcb, True)
|
||||
|
||||
def boost(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_START_BOOST, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_BOOST, None, boost)
|
||||
|
||||
def setpoint_to_default(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_SET_DEFAULT_TEMPERATURE, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SETPOINT_TO_DEFAULT, None, setpoint_to_default)
|
||||
|
||||
def away_mode(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_AWAY_MODE, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_AWAY, None, away_mode)
|
||||
self.heating_function.add_callback(heating_function.KEY_AWAY_MODE, None, self.gui_heating.set_away_mcb)
|
||||
|
||||
def summer_mode(device, key, data):
|
||||
self.heating_function.set(heating_function.KEY_SUMMER_MODE, data)
|
||||
self.gui_heating.add_callback(devices.nodered_gui_radiator.KEY_SUMMER, None, summer_mode)
|
||||
self.heating_function.add_callback(heating_function.KEY_SUMMER_MODE, None, self.gui_heating.set_summer_mcb)
|
||||
|
||||
self.heating_function.add_callback(heating_function.KEY_BOOST_TIMER, None, self.gui_heating.set_timer_mcb)
|
||||
|
||||
self.gui_led_active_device = devices.nodered_gui_leds(mqtt_client, config.TOPIC_GFW_DIRK_DEVICE_CHOOSER_LED)
|
||||
|
||||
def update_active_device_led(device, key, data):
|
||||
for i in range(0, len(self.brightness_functions.brightness_device_list)):
|
||||
self.gui_led_active_device.set_led(devices.nodered_gui_leds.KEY_LED_LIST[i], data == i)
|
||||
self.brightness_functions.add_callback(brightness_choose_n_action.KEY_ACTIVE_DEVICE, None, update_active_device_led, True)
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
|
||||
#
|
||||
# Virtual Device Interface
|
||||
#
|
||||
@ -303,10 +188,6 @@ class ground_floor_west_dirk(room):
|
||||
#
|
||||
self.delayed_task_remote = task.delayed(1.0, self.send_audio_source)
|
||||
|
||||
def all_off(self, device=None, key=None, data=None):
|
||||
super().all_off(device, key, data)
|
||||
self.powerplug_common.set_output_all(False)
|
||||
|
||||
def audio_source_selector(self, device, key, data):
|
||||
if device == self.powerplug_common and key == self.KEY_POWERPLUG_CD_PLAYER:
|
||||
# switch on of cd player
|
||||
|
@ -25,6 +25,11 @@ except ImportError:
|
||||
logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
||||
|
||||
|
||||
class switched_light(object):
|
||||
def __init__(self, sw_device, sw_key, li_device):
|
||||
sw_device.add_callback(devices.shelly.KEY_OUTPUT_0, True, li_device.request_data, True)
|
||||
|
||||
|
||||
class brightness_choose_n_action(common_base):
|
||||
KEY_ACTIVE_DEVICE = 'active_device'
|
||||
#
|
||||
@ -54,8 +59,6 @@ class brightness_choose_n_action(common_base):
|
||||
callback_device: A device for installing callback which are executed, when the device is switched on or off. It needs the following method:
|
||||
* .add_callback(key, data or None, callback, on_changes_only)
|
||||
"""
|
||||
if len(self.brightness_device_list) >= len(devices.nodered_gui_leds.KEY_LED_LIST):
|
||||
raise ValueError("Number of devices is limited by number of leds in devices.nodered_gui_leds.")
|
||||
self.brightness_device_list.append(brightness_device)
|
||||
self.callback_device_list.append((callback_device, callback_key))
|
||||
self.device_states.append(False)
|
||||
|
@ -36,21 +36,6 @@ class stairway(room):
|
||||
timer_value=config.USER_ON_TIME_STAIRWAYS
|
||||
)
|
||||
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
self.gui_main_light = devices.nodered_gui_light(mqtt_client, config.TOPIC_STW_STAIRWAY_MAIN_LIGHT_GUI)
|
||||
self.gui_main_light.add_callback(devices.nodered_gui_light.KEY_STATE, None, self.main_light_shelly.set_output_0_mcb)
|
||||
self.main_light_shelly.add_callback(devices.shelly.KEY_OUTPUT_0, None, self.gui_main_light.set_state_mcb)
|
||||
self.motion_sensor_light.add_callback(motion_sensor_light.KEY_TIMER, None, self.gui_main_light.set_timer_mcb)
|
||||
|
||||
def set_led(device, key, data):
|
||||
if key == motion_sensor_light.KEY_MOTION_SENSOR_0:
|
||||
self.gui_main_light.set_led(devices.nodered_gui_light.KEY_LED_0, data)
|
||||
if key == motion_sensor_light.KEY_MOTION_SENSOR_1:
|
||||
self.gui_main_light.set_led(devices.nodered_gui_light.KEY_LED_1, data)
|
||||
self.motion_sensor_light.add_callback(motion_sensor_light.KEY_MOTION_SENSOR_0, None, set_led)
|
||||
self.motion_sensor_light.add_callback(motion_sensor_light.KEY_MOTION_SENSOR_1, None, set_led)
|
||||
##### TEMPORARY ###################################################################################################################
|
||||
|
||||
#
|
||||
# Virtual Device Interface
|
||||
#
|
||||
|
@ -48,7 +48,9 @@ class base(mqtt_base):
|
||||
# send default data to videv interface
|
||||
|
||||
def __rx_ext_device_data__(self, ext_device, ext_key, data):
|
||||
self.__tx__(self.__display_dict__[(id(ext_device), ext_key)], data)
|
||||
my_key = self.__display_dict__[(id(ext_device), ext_key)]
|
||||
self[my_key] = data
|
||||
self.__tx__(my_key, data)
|
||||
|
||||
def __tx__(self, key, data):
|
||||
if key in self.__control_dict__:
|
||||
|
Loading…
x
Reference in New Issue
Block a user