smart_brain/function/ground_floor_west.py

52 satır
2.0 KiB
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import devices
import logging
from function.rooms import room_shelly, room_shelly_tradfri_light, room_shelly_silvercrest_light
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 ground_floor_west_floor(room_shelly_silvercrest_light):
# https://shelly1l-84CCA8AD1148
def __init__(self, mqtt_client):
super().__init__(mqtt_client, "shellies/floor_eg_w", "gui/gfw_sw_floor",
"zigbee_eg_w/light/floor_eg_w/a", "gui/gfw_br_floor", "gui/gfw_ct_floor")
#
# Callback initialisation
#
self.main_light_tradfri_2 = devices.tradfri_light(mqtt_client, "zigbee_eg_w/light/floor_eg_w/b")
self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_BRIGHTNESS,
None, self.sync_brightness_main_light)
self.main_light_tradfri.add_callback(devices.tradfri_light.KEY_COLOR_TEMP,
None, self.sync_color_temp_main_light)
def send_init_message_main_light(self):
return super().send_init_message_main_light()
self.main_light_tradfri_2.mqtt_client.send(self.main_light_tradfri_2.topic + "/get", '{"state": ""}')
def sync_brightness_main_light(self, device, key, data):
self.main_light_tradfri_2.set_brightness(data)
def sync_color_temp_main_light(self, device, key, data):
self.main_light_tradfri_2.set_color_temp(data)
class ground_floor_west_marion(room_shelly):
# https://shelly1l-E8DB84A1E067
def __init__(self, mqtt_client):
super().__init__(mqtt_client, "shellies/marion", "gui/gfw_sw_marion")
class ground_floor_west_dirk(room_shelly_tradfri_light):
# https://shelly1l-3C6105E44F27
def __init__(self, mqtt_client):
super().__init__(mqtt_client, "shellies/dirk", "gui/gfw_sw_dirk",
"zigbee_eg_w/light/dirk", "gui/gfw_br_dirk", "gui/gfw_ct_dirk")