123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
-
- import config
- import devices
- from function.db import get_radiator_data, set_radiator_data
- from function.modules import heating_function
- from function.rooms import room, room_collection
- from function.videv import videv_switch_brightness, videv_switch_brightness_color_temp, videv_heating
- import logging
-
-
- 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 first_floor_west(room_collection):
- def __init__(self, mqtt_client):
- super().__init__(mqtt_client)
- self.bath = first_floor_west_bath(mqtt_client)
- self.julian = first_floor_west_julian(mqtt_client)
- self.livingroom = first_floor_west_living(mqtt_client)
- self.sleep = first_floor_west_sleep(mqtt_client)
-
-
- class first_floor_west_julian(room):
- def __init__(self, mqtt_client):
- #
- # Device initialisation
- #
- # http://shelly1l-3C6105E43452
- # main light
- self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_SHELLY)
- self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_ZIGBEE)
- # heating function
- self.heating_valve = devices.brennenstuhl_heatingvalve(mqtt_client, config.TOPIC_FFW_JULIAN_HEATING_VALVE_ZIGBEE)
- super().__init__(mqtt_client)
- #
- # Functionality initialisation
- #
- # 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)
-
- #
- # Virtual Device Interface
- #
- # main light
- self.main_light_videv = videv_switch_brightness_color_temp(
- mqtt_client, config.TOPIC_FFW_JULIAN_MAIN_LIGHT_VIDEV,
- self.main_light_shelly, devices.shelly.KEY_OUTPUT_0,
- self.main_light_tradfri, devices.tradfri_light.KEY_BRIGHTNESS,
- self.main_light_tradfri, devices.tradfri_light.KEY_COLOR_TEMP
- )
- # # heating function
- # self.heating_function_videv = videv_heating(
- # mqtt_client, config.TOPIC_FFW_JULIAN_HEATING_VALVE_VIDEV,
- # self.heating_function
- # )
-
-
- class first_floor_west_bath(room):
- def __init__(self, mqtt_client):
- #
- # Device initialisation
- #
- # heating function
- self.heating_valve = devices.brennenstuhl_heatingvalve(mqtt_client, config.TOPIC_FFW_BATH_HEATING_VALVE_ZIGBEE)
- super().__init__(mqtt_client)
-
- #
- # Functionality initialisation
- #
- # 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)
-
- #
- # Virtual Device Interface
- #
- # heating function
- self.heating_function_videv = videv_heating(
- mqtt_client, config.TOPIC_FFW_BATH_HEATING_VALVE_VIDEV,
- self.heating_function
- )
-
-
- class first_floor_west_living(room):
- def __init__(self, mqtt_client):
- #
- # Device initialisation
- #
- # http://shelly1l-84CCA8ACE6A1
- # main light
- self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_SHELLY)
- self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_ZIGBEE)
- # # heating function
- # self.heating_valve = devices.brennenstuhl_heatingvalve(mqtt_client, config.TOPIC_FFW_LIVINGROOM_HEATING_VALVE_ZIGBEE)
- super().__init__(mqtt_client)
-
- #
- # Functionality initialisation
- #
- # # 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)
-
- #
- # Virtual Device Interface
- #
- # main light
- self.main_light_videv = videv_switch_brightness_color_temp(
- mqtt_client, config.TOPIC_FFW_LIVINGROOM_MAIN_LIGHT_VIDEV,
- self.main_light_shelly, devices.shelly.KEY_OUTPUT_0,
- self.main_light_tradfri, devices.tradfri_light.KEY_BRIGHTNESS,
- self.main_light_tradfri, devices.tradfri_light.KEY_COLOR_TEMP
- )
- # # heating function
- # self.heating_function_videv = videv_heating(
- # mqtt_client, config.TOPIC_FFW_LIVINGROOM_HEATING_VALVE_VIDEV,
- # self.heating_function
- # )
-
-
- class first_floor_west_sleep(room):
- def __init__(self, mqtt_client):
- #
- # Device initialisation
- #
- # http://shelly1-3494546A51F2
- # main light
- self.main_light_shelly = devices.shelly(mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_SHELLY)
- self.main_light_tradfri = devices.tradfri_light(mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_ZIGBEE)
- # heating function
- self.heating_valve = devices.brennenstuhl_heatingvalve(mqtt_client, config.TOPIC_FFW_SLEEP_HEATING_VALVE_ZIGBEE)
- super().__init__(mqtt_client)
-
- #
- # Functionality initialisation
- #
- # 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)
-
- #
- # Virtual Device Interface
- #
- # main light
- self.main_light_videv = videv_switch_brightness(
- mqtt_client, config.TOPIC_FFW_SLEEP_MAIN_LIGHT_VIDEV,
- self.main_light_shelly, devices.shelly.KEY_OUTPUT_0,
- self.main_light_tradfri, devices.tradfri_light.KEY_BRIGHTNESS
- )
- # heating function
- self.heating_function_videv = videv_heating(
- mqtt_client, config.TOPIC_FFW_SLEEP_HEATING_VALVE_VIDEV,
- self.heating_function
- )
|