smart_brain/function/__init__.py

64 satır
3.1 KiB
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import devices
from function.ground_floor_west import ground_floor_west_floor, ground_floor_west_marion, ground_floor_west_dirk
from function.first_floor_west import first_floor_west_julian, first_floor_west_living
from function.first_floor_east import first_floor_east_floor, first_floor_east_kitchen, first_floor_east_dining, first_floor_east_sleep_madi, first_floor_east_living
import inspect
# TODO: implement bed light dirk fading by input device
# TODO: implement heating function sleep_madi
# TODO: implement circulation pump
# TODO: implement switch off functionality (except of switch off button transportation)
# TODO: implement garland (incl. day events like sunset, sunrise, ...)
# TODO: implement existing nodered functionality "dirk" (ground floor west)
# TODO: implement warning message
class all_functions(object):
def __init__(self, mqtt_client):
self.rooms = {}
self.__devices__ = None
#
# 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)
#
# first floor west
#
self.ffw_julian = first_floor_west_julian(mqtt_client)
self.ffw_living = first_floor_west_living(mqtt_client)
#
# first floor east
#
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)
#
# Input devices sleep_madi
#
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_sleep_madi.toggle_main_light)
self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "brightness_up_click",
self.ffe_sleep_madi.toggle_bed_light_di)
self.ffe_button_tradfri_sleep.add_callback(devices.tradfri_button.KEY_ACTION, "brightness_down_click",
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_floor.toggle_main_light)
def devicelist(self):
if self.__devices__ is None:
self.__devices__ = []
for name, obj in inspect.getmembers(self):
if obj.__class__.__module__.split('.')[0] == 'function':
for devicename, device in inspect.getmembers(obj):
if device.__class__.__module__ == "devices":
self.__devices__.append(device)
return self.__devices__