devicelist method implemented

This commit is contained in:
Dirk Alders 2022-12-20 14:28:44 +01:00
parent 3f5ecdeb64
commit 7a639e0d8f
2 changed files with 7 additions and 10 deletions

View File

@ -5,6 +5,7 @@ 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
@ -12,7 +13,7 @@ from function.first_floor_east import first_floor_east_floor, first_floor_east_k
# 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 (incl. fixing all_functions.devicelist
# TODO: implement warning message
class all_functions(object):
@ -52,12 +53,11 @@ class all_functions(object):
self.ffe_floor.toggle_main_light)
def devicelist(self):
raise Exception
# TODO: generate list by using getattr
if self.__devices__ is None:
self.__devices__ = []
for room in self.rooms:
for name, obj in inspect.getmembers(room):
if type(obj) in devices.DEVICE_TYPE_LIST():
self.__devices__.append(obj)
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__

View File

@ -1,10 +1,7 @@
import config
import devices
import function
import inspect
import logging
import mqtt
import os
import report
import time