2022-12-20 14:05:32 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
|
2022-12-27 14:39:53 +01:00
|
|
|
import config
|
2023-10-29 15:10:06 +01:00
|
|
|
import devdi.props as props
|
2023-03-26 11:00:18 +02:00
|
|
|
from function.db import get_radiator_data, set_radiator_data
|
2023-01-25 07:40:33 +01:00
|
|
|
from function.modules import heating_function
|
2023-01-31 19:17:10 +01:00
|
|
|
from function.rooms import room, room_collection
|
2023-01-25 07:40:33 +01:00
|
|
|
from function.videv import videv_switch_brightness, videv_switch_brightness_color_temp, videv_heating
|
2023-01-30 12:20:02 +01:00
|
|
|
import logging
|
2022-12-20 14:05:32 +01:00
|
|
|
|
2023-01-11 15:39:09 +01:00
|
|
|
|
2022-12-20 14:05:32 +01:00
|
|
|
try:
|
|
|
|
from config import APP_NAME as ROOT_LOGGER_NAME
|
|
|
|
except ImportError:
|
|
|
|
ROOT_LOGGER_NAME = 'root'
|
|
|
|
logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
|
|
|
|
2023-10-29 15:10:06 +01:00
|
|
|
loc = props.LOC_FFW
|
|
|
|
|
2022-12-20 14:05:32 +01:00
|
|
|
|
2023-01-31 19:17:10 +01:00
|
|
|
class first_floor_west(room_collection):
|
2023-10-29 15:10:06 +01:00
|
|
|
def __init__(self, mqtt_client, pd, vd):
|
|
|
|
super().__init__(mqtt_client, pd, vd)
|
|
|
|
self.bath = first_floor_west_bath(mqtt_client, pd, vd)
|
|
|
|
self.julian = first_floor_west_julian(mqtt_client, pd, vd)
|
|
|
|
self.livingroom = first_floor_west_living(mqtt_client, pd, vd)
|
|
|
|
self.sleep = first_floor_west_sleep(mqtt_client, pd, vd)
|
2023-01-31 19:17:10 +01:00
|
|
|
|
|
|
|
|
2023-01-25 07:40:33 +01:00
|
|
|
class first_floor_west_julian(room):
|
2023-10-29 15:10:06 +01:00
|
|
|
def __init__(self, mqtt_client, pd, vd):
|
|
|
|
roo = props.ROO_JUL
|
2023-01-25 07:40:33 +01:00
|
|
|
#
|
|
|
|
# Device initialisation
|
|
|
|
#
|
|
|
|
# http://shelly1l-3C6105E43452
|
2023-10-15 08:47:15 +02:00
|
|
|
# main light
|
2023-10-29 15:10:06 +01:00
|
|
|
self.main_light_shelly = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
|
|
|
|
self.main_light_tradfri = pd.get(props.STG_ZFW, loc, roo, props.FUN_MAL)
|
2023-10-20 17:14:49 +02:00
|
|
|
# heating function
|
2023-10-29 15:10:06 +01:00
|
|
|
self.heating_valve = pd.get(props.STG_ZFW, loc, roo, props.FUN_HEA)
|
|
|
|
super().__init__(mqtt_client, pd, vd)
|
2023-10-15 08:47:15 +02:00
|
|
|
#
|
|
|
|
# Functionality initialisation
|
|
|
|
#
|
2023-10-20 17:14:49 +02:00
|
|
|
# heating function
|
|
|
|
self.heating_function = heating_function(
|
|
|
|
self.heating_valve,
|
2023-10-29 15:10:06 +01:00
|
|
|
config.DEFAULT_TEMPERATURE,
|
2023-10-20 17:14:49 +02:00
|
|
|
**get_radiator_data(self.heating_valve.topic)
|
|
|
|
)
|
|
|
|
self.heating_function.add_callback(None, None, set_radiator_data, True)
|
2023-01-25 07:40:33 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Virtual Device Interface
|
2023-01-20 08:03:06 +01:00
|
|
|
#
|
2023-10-15 08:47:15 +02:00
|
|
|
# main light
|
2023-01-20 08:03:06 +01:00
|
|
|
self.main_light_videv = videv_switch_brightness_color_temp(
|
|
|
|
mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_VIDEV,
|
2023-10-29 15:10:06 +01:00
|
|
|
self.main_light_shelly, self.main_light_shelly.KEY_OUTPUT_0,
|
|
|
|
self.main_light_tradfri, self.main_light_tradfri.KEY_BRIGHTNESS,
|
|
|
|
self.main_light_tradfri, self.main_light_tradfri.KEY_COLOR_TEMP
|
2023-01-20 08:03:06 +01:00
|
|
|
)
|
2023-10-20 21:33:32 +02:00
|
|
|
# heating function
|
|
|
|
self.heating_function_videv = videv_heating(
|
|
|
|
mqtt_client, config.TOPIC_FFW_JULIAN_HEATING_VALVE_VIDEV,
|
|
|
|
self.heating_function
|
|
|
|
)
|
2022-12-20 14:05:32 +01:00
|
|
|
|
|
|
|
|
2023-01-25 07:40:33 +01:00
|
|
|
class first_floor_west_bath(room):
|
2023-10-29 15:10:06 +01:00
|
|
|
def __init__(self, mqtt_client, pd, vd):
|
|
|
|
roo = props.ROO_BAT
|
2023-01-25 07:40:33 +01:00
|
|
|
#
|
|
|
|
# Device initialisation
|
|
|
|
#
|
2023-10-15 08:47:15 +02:00
|
|
|
# heating function
|
2023-10-29 15:10:06 +01:00
|
|
|
self.heating_valve = pd.get(props.STG_ZFW, loc, roo, props.FUN_HEA)
|
|
|
|
super().__init__(mqtt_client, pd, vd)
|
2023-10-15 08:47:15 +02:00
|
|
|
|
2023-01-25 07:40:33 +01:00
|
|
|
#
|
|
|
|
# Functionality initialisation
|
|
|
|
#
|
|
|
|
# heating function
|
2023-03-26 11:00:18 +02:00
|
|
|
self.heating_function = heating_function(
|
|
|
|
self.heating_valve,
|
2023-10-29 15:10:06 +01:00
|
|
|
config.DEFAULT_TEMPERATURE,
|
2023-03-26 11:00:18 +02:00
|
|
|
**get_radiator_data(self.heating_valve.topic)
|
|
|
|
)
|
|
|
|
self.heating_function.add_callback(None, None, set_radiator_data, True)
|
2023-01-25 07:40:33 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Virtual Device Interface
|
|
|
|
#
|
2023-10-15 08:47:15 +02:00
|
|
|
# heating function
|
2023-01-25 07:40:33 +01:00
|
|
|
self.heating_function_videv = videv_heating(
|
|
|
|
mqtt_client, config.TOPIC_FFW_BATH_HEATING_VALVE_VIDEV,
|
|
|
|
self.heating_function
|
|
|
|
)
|
2023-01-20 08:03:06 +01:00
|
|
|
|
2023-01-14 13:27:36 +01:00
|
|
|
|
2023-01-25 07:40:33 +01:00
|
|
|
class first_floor_west_living(room):
|
2023-10-29 15:10:06 +01:00
|
|
|
def __init__(self, mqtt_client, pd, vd):
|
|
|
|
roo = props.ROO_LIV
|
2023-01-25 07:40:33 +01:00
|
|
|
#
|
|
|
|
# Device initialisation
|
|
|
|
#
|
|
|
|
# http://shelly1l-84CCA8ACE6A1
|
2023-10-15 08:47:15 +02:00
|
|
|
# main light
|
2023-10-29 15:10:06 +01:00
|
|
|
self.main_light_shelly = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
|
|
|
|
self.main_light_tradfri = pd.get(props.STG_ZFW, loc, roo, props.FUN_MAL)
|
2023-10-15 16:35:08 +02:00
|
|
|
# # heating function
|
2023-10-29 15:10:06 +01:00
|
|
|
# self.heating_valve = pd.get(props.STG_ZFW, loc, roo, props.FUN_HEA)
|
|
|
|
super().__init__(mqtt_client, pd, vd)
|
2023-01-25 07:40:33 +01:00
|
|
|
|
2023-10-15 08:47:15 +02:00
|
|
|
#
|
|
|
|
# Functionality initialisation
|
|
|
|
#
|
2023-10-15 16:35:08 +02:00
|
|
|
# # heating function
|
|
|
|
# self.heating_function = heating_function(
|
|
|
|
# self.heating_valve,
|
|
|
|
# config.DEFAULT_TEMPERATURE[self.heating_valve.topic],
|
|
|
|
# **get_radiator_data(self.heating_valve.topic)
|
|
|
|
# )
|
|
|
|
# self.heating_function.add_callback(None, None, set_radiator_data, True)
|
2023-10-15 08:47:15 +02:00
|
|
|
|
2023-01-25 07:40:33 +01:00
|
|
|
#
|
|
|
|
# Virtual Device Interface
|
2023-01-20 08:03:06 +01:00
|
|
|
#
|
2023-10-15 08:47:15 +02:00
|
|
|
# main light
|
2023-01-20 08:03:06 +01:00
|
|
|
self.main_light_videv = videv_switch_brightness_color_temp(
|
|
|
|
mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_VIDEV,
|
2023-10-29 15:10:06 +01:00
|
|
|
self.main_light_shelly, self.main_light_shelly.KEY_OUTPUT_0,
|
|
|
|
self.main_light_tradfri, self.main_light_tradfri.KEY_BRIGHTNESS,
|
|
|
|
self.main_light_tradfri, self.main_light_tradfri.KEY_COLOR_TEMP
|
2023-01-20 08:03:06 +01:00
|
|
|
)
|
2023-10-15 16:35:08 +02:00
|
|
|
# # heating function
|
|
|
|
# self.heating_function_videv = videv_heating(
|
|
|
|
# mqtt_client, config.TOPIC_FFW_LIVINGROOM_HEATING_VALVE_VIDEV,
|
|
|
|
# self.heating_function
|
|
|
|
# )
|
2023-01-14 13:27:36 +01:00
|
|
|
|
|
|
|
|
2023-01-25 07:40:33 +01:00
|
|
|
class first_floor_west_sleep(room):
|
2023-10-29 15:10:06 +01:00
|
|
|
def __init__(self, mqtt_client, pd, vd):
|
|
|
|
roo = props.ROO_SLP
|
2023-01-25 07:40:33 +01:00
|
|
|
#
|
|
|
|
# Device initialisation
|
|
|
|
#
|
|
|
|
# http://shelly1-3494546A51F2
|
2023-10-15 08:47:15 +02:00
|
|
|
# main light
|
2023-10-29 15:10:06 +01:00
|
|
|
self.main_light_shelly = pd.get(props.STG_SHE, loc, roo, props.FUN_MAL)
|
|
|
|
self.main_light_tradfri = pd.get(props.STG_ZFW, loc, roo, props.FUN_MAL)
|
2023-10-15 08:47:15 +02:00
|
|
|
# heating function
|
2023-10-29 15:10:06 +01:00
|
|
|
self.heating_valve = pd.get(props.STG_ZFW, loc, roo, props.FUN_HEA)
|
|
|
|
super().__init__(mqtt_client, pd, vd)
|
2023-01-25 07:40:33 +01:00
|
|
|
|
2023-10-15 08:47:15 +02:00
|
|
|
#
|
|
|
|
# Functionality initialisation
|
|
|
|
#
|
|
|
|
# heating function
|
|
|
|
self.heating_function = heating_function(
|
|
|
|
self.heating_valve,
|
2023-10-29 15:10:06 +01:00
|
|
|
config.DEFAULT_TEMPERATURE,
|
2023-10-15 08:47:15 +02:00
|
|
|
**get_radiator_data(self.heating_valve.topic)
|
|
|
|
)
|
|
|
|
self.heating_function.add_callback(None, None, set_radiator_data, True)
|
|
|
|
|
2023-01-25 07:40:33 +01:00
|
|
|
#
|
|
|
|
# Virtual Device Interface
|
2023-01-20 08:03:06 +01:00
|
|
|
#
|
2023-10-15 08:47:15 +02:00
|
|
|
# main light
|
2023-01-20 08:03:06 +01:00
|
|
|
self.main_light_videv = videv_switch_brightness(
|
|
|
|
mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_VIDEV,
|
2023-10-29 15:10:06 +01:00
|
|
|
self.main_light_shelly, self.main_light_shelly.KEY_OUTPUT_0,
|
|
|
|
self.main_light_tradfri, self.main_light_tradfri.KEY_BRIGHTNESS
|
2023-01-20 08:03:06 +01:00
|
|
|
)
|
2023-10-15 08:47:15 +02:00
|
|
|
# heating function
|
|
|
|
self.heating_function_videv = videv_heating(
|
|
|
|
mqtt_client, config.TOPIC_FFW_SLEEP_HEATING_VALVE_VIDEV,
|
|
|
|
self.heating_function
|
|
|
|
)
|