Browse Source

devicelist method implemented

tags/v1.0.0
Dirk Alders 2 years ago
parent
commit
7a639e0d8f
2 changed files with 7 additions and 10 deletions
  1. 7
    7
      function/__init__.py
  2. 0
    3
      smart_brain.py

+ 7
- 7
function/__init__.py View File

5
 from function.ground_floor_west import ground_floor_west_floor, ground_floor_west_marion, ground_floor_west_dirk
5
 from function.ground_floor_west import ground_floor_west_floor, ground_floor_west_marion, ground_floor_west_dirk
6
 from function.first_floor_west import first_floor_west_julian, first_floor_west_living
6
 from function.first_floor_west import first_floor_west_julian, first_floor_west_living
7
 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
7
 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
8
+import inspect
8
 
9
 
9
 # TODO: implement bed light dirk fading by input device
10
 # TODO: implement bed light dirk fading by input device
10
 # TODO: implement heating function sleep_madi
11
 # TODO: implement heating function sleep_madi
12
 # TODO: implement switch off functionality (except of switch off button transportation)
13
 # TODO: implement switch off functionality (except of switch off button transportation)
13
 # TODO: implement garland (incl. day events like sunset, sunrise, ...)
14
 # TODO: implement garland (incl. day events like sunset, sunrise, ...)
14
 # TODO: implement existing nodered functionality "dirk" (ground floor west)
15
 # TODO: implement existing nodered functionality "dirk" (ground floor west)
15
-# TODO: implement warning message (incl. fixing all_functions.devicelist
16
+# TODO: implement warning message
16
 
17
 
17
 
18
 
18
 class all_functions(object):
19
 class all_functions(object):
52
                                                    self.ffe_floor.toggle_main_light)
53
                                                    self.ffe_floor.toggle_main_light)
53
 
54
 
54
     def devicelist(self):
55
     def devicelist(self):
55
-        raise Exception
56
-        # TODO: generate list by using getattr
57
         if self.__devices__ is None:
56
         if self.__devices__ is None:
58
             self.__devices__ = []
57
             self.__devices__ = []
59
-            for room in self.rooms:
60
-                for name, obj in inspect.getmembers(room):
61
-                    if type(obj) in devices.DEVICE_TYPE_LIST():
62
-                        self.__devices__.append(obj)
58
+            for name, obj in inspect.getmembers(self):
59
+                if obj.__class__.__module__.split('.')[0] == 'function':
60
+                    for devicename, device in inspect.getmembers(obj):
61
+                        if device.__class__.__module__ == "devices":
62
+                            self.__devices__.append(device)
63
         return self.__devices__
63
         return self.__devices__

+ 0
- 3
smart_brain.py View File

1
 import config
1
 import config
2
-import devices
3
 import function
2
 import function
4
-import inspect
5
 import logging
3
 import logging
6
 import mqtt
4
 import mqtt
7
-import os
8
 import report
5
 import report
9
 import time
6
 import time
10
 
7
 

Loading…
Cancel
Save