Compare commits
No commits in common. "34e7cab81875bb56436aa69b663daac458034593" and "7a639e0d8f0b9dcb0b54de745bcabcb04e7d2bc3" have entirely different histories.
34e7cab818
...
7a639e0d8f
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
"""
|
"""
|
||||||
devices (DEVICES)
|
devices (DEVICES)
|
||||||
=================
|
===========
|
||||||
|
|
||||||
**Author:**
|
**Author:**
|
||||||
|
|
||||||
@ -369,11 +369,10 @@ class tradfri_light(base):
|
|||||||
KEY_OUTPUT_0 = "state"
|
KEY_OUTPUT_0 = "state"
|
||||||
KEY_BRIGHTNESS = "brightness"
|
KEY_BRIGHTNESS = "brightness"
|
||||||
KEY_COLOR_TEMP = "color_temp"
|
KEY_COLOR_TEMP = "color_temp"
|
||||||
KEY_BRIGHTNESS_FADE = "brightness_move"
|
|
||||||
#
|
#
|
||||||
TX_TOPIC = 'set'
|
TX_TOPIC = 'set'
|
||||||
TX_TYPE = base.TX_DICT
|
TX_TYPE = base.TX_DICT
|
||||||
TX_FILTER_DATA_KEYS = [KEY_OUTPUT_0, KEY_BRIGHTNESS, KEY_COLOR_TEMP, KEY_BRIGHTNESS_FADE]
|
TX_FILTER_DATA_KEYS = [KEY_OUTPUT_0, KEY_BRIGHTNESS, KEY_COLOR_TEMP]
|
||||||
#
|
#
|
||||||
RX_KEYS = [KEY_LINKQUALITY, KEY_OUTPUT_0, KEY_BRIGHTNESS, KEY_COLOR_TEMP]
|
RX_KEYS = [KEY_LINKQUALITY, KEY_OUTPUT_0, KEY_BRIGHTNESS, KEY_COLOR_TEMP]
|
||||||
RX_IGNORE_TOPICS = [TX_TOPIC]
|
RX_IGNORE_TOPICS = [TX_TOPIC]
|
||||||
@ -433,15 +432,6 @@ class tradfri_light(base):
|
|||||||
"""brightness: [0, ..., 100]"""
|
"""brightness: [0, ..., 100]"""
|
||||||
self.pack(self.KEY_BRIGHTNESS, brightness)
|
self.pack(self.KEY_BRIGHTNESS, brightness)
|
||||||
|
|
||||||
def brightness_inc(self, speed=40):
|
|
||||||
self.pack(self.KEY_BRIGHTNESS_FADE, speed)
|
|
||||||
|
|
||||||
def brightness_dec(self, speed=-40):
|
|
||||||
self.brightness_inc(speed)
|
|
||||||
|
|
||||||
def brightness_stop(self):
|
|
||||||
self.brightness_inc(0)
|
|
||||||
|
|
||||||
def set_color_temp(self, color_temp):
|
def set_color_temp(self, color_temp):
|
||||||
"""color_temp: [0, ..., 100]"""
|
"""color_temp: [0, ..., 100]"""
|
||||||
self.pack(self.KEY_COLOR_TEMP, color_temp)
|
self.pack(self.KEY_COLOR_TEMP, color_temp)
|
||||||
|
@ -18,35 +18,31 @@ import inspect
|
|||||||
|
|
||||||
class all_functions(object):
|
class all_functions(object):
|
||||||
def __init__(self, mqtt_client):
|
def __init__(self, mqtt_client):
|
||||||
self.mqtt_client = mqtt_client
|
self.rooms = {}
|
||||||
#
|
|
||||||
self.__devices__ = None
|
self.__devices__ = None
|
||||||
#
|
#
|
||||||
# add rooms
|
# ground floor west
|
||||||
|
#
|
||||||
|
self.gfw_floor = ground_floor_west_floor(mqtt_client)
|
||||||
|
self.gfw_marion = ground_floor_west_marion(mqtt_client)
|
||||||
|
self.gfw_dirk = ground_floor_west_dirk(mqtt_client)
|
||||||
#
|
#
|
||||||
# # ground floor west
|
|
||||||
self.gfw_floor = ground_floor_west_floor(self.mqtt_client)
|
|
||||||
self.gfw_marion = ground_floor_west_marion(self.mqtt_client)
|
|
||||||
self.gfw_dirk = ground_floor_west_dirk(self.mqtt_client)
|
|
||||||
# first floor west
|
# first floor west
|
||||||
self.ffw_julian = first_floor_west_julian(self.mqtt_client)
|
#
|
||||||
self.ffw_living = first_floor_west_living(self.mqtt_client)
|
self.ffw_julian = first_floor_west_julian(mqtt_client)
|
||||||
|
self.ffw_living = first_floor_west_living(mqtt_client)
|
||||||
|
#
|
||||||
# first floor east
|
# first floor east
|
||||||
self.ffe_floor = first_floor_east_floor(self.mqtt_client)
|
|
||||||
self.ffe_kitchen = first_floor_east_kitchen(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_living = first_floor_east_living(self.mqtt_client)
|
|
||||||
#
|
#
|
||||||
# additional functionality
|
self.ffe_floor = first_floor_east_floor(mqtt_client)
|
||||||
|
self.ffe_kitchen = first_floor_east_kitchen(mqtt_client)
|
||||||
|
self.ffe_dining = first_floor_east_dining(mqtt_client)
|
||||||
|
self.ffe_sleep_madi = first_floor_east_sleep_madi(mqtt_client)
|
||||||
|
self.ffe_living = first_floor_east_living(mqtt_client)
|
||||||
#
|
#
|
||||||
self.init_input_device_sleep_madi_functionality()
|
# Input devices sleep_madi
|
||||||
|
|
||||||
def init_input_device_sleep_madi_functionality(self):
|
|
||||||
#
|
|
||||||
self.ffe_button_tradfri_sleep = devices.tradfri_button(
|
|
||||||
self.mqtt_client, topic="zigbee_og_e/input_device/og_east")
|
|
||||||
#
|
#
|
||||||
|
self.ffe_button_tradfri_sleep = devices.tradfri_button(mqtt_client, topic="zigbee_og_e/input_device/og_east")
|
||||||
self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "toggle",
|
self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "toggle",
|
||||||
self.ffe_sleep_madi.toggle_main_light)
|
self.ffe_sleep_madi.toggle_main_light)
|
||||||
self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "brightness_up_click",
|
self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "brightness_up_click",
|
||||||
@ -55,16 +51,12 @@ class all_functions(object):
|
|||||||
self.ffe_sleep_madi.toggle_bed_light_di)
|
self.ffe_sleep_madi.toggle_bed_light_di)
|
||||||
self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "arrow_right_click",
|
self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "arrow_right_click",
|
||||||
self.ffe_floor.toggle_main_light)
|
self.ffe_floor.toggle_main_light)
|
||||||
self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, None,
|
|
||||||
self.ffe_sleep_madi.fade_bed_light)
|
|
||||||
|
|
||||||
def devicelist(self):
|
def devicelist(self):
|
||||||
if self.__devices__ is None:
|
if self.__devices__ is None:
|
||||||
self.__devices__ = []
|
self.__devices__ = []
|
||||||
for name, obj in inspect.getmembers(self):
|
for name, obj in inspect.getmembers(self):
|
||||||
if obj.__class__.__module__ == "devices":
|
if obj.__class__.__module__.split('.')[0] == 'function':
|
||||||
self.__devices__.append(obj)
|
|
||||||
elif obj.__class__.__module__.split('.')[0] == 'function':
|
|
||||||
for devicename, device in inspect.getmembers(obj):
|
for devicename, device in inspect.getmembers(obj):
|
||||||
if device.__class__.__module__ == "devices":
|
if device.__class__.__module__ == "devices":
|
||||||
self.__devices__.append(device)
|
self.__devices__.append(device)
|
||||||
|
@ -92,14 +92,6 @@ class first_floor_east_sleep_madi(room_shelly_tradfri_light):
|
|||||||
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 fade_bed_light(self, device, topic, data):
|
|
||||||
if (data == 'brightness_up_hold'):
|
|
||||||
self.bed_light_di_tradfri.brightness_inc()
|
|
||||||
elif (data == 'brightness_down_hold'):
|
|
||||||
self.bed_light_di_tradfri.brightness_dec()
|
|
||||||
elif (data.startswith('brightness') and data.endswith('release')):
|
|
||||||
self.bed_light_di_tradfri.brightness_stop()
|
|
||||||
|
|
||||||
def gui_switch_command_bed_light_di(self, device, key, data):
|
def gui_switch_command_bed_light_di(self, device, key, data):
|
||||||
logger.info("Switching \"%s\" bed light dirk: %s", type(self).__name__, str(data))
|
logger.info("Switching \"%s\" bed light dirk: %s", type(self).__name__, str(data))
|
||||||
self.bed_light_di_tradfri.set_output_0(data)
|
self.bed_light_di_tradfri.set_output_0(data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user