diff --git a/devices/__init__.py b/devices/__init__.py index bcd3698..46a2717 100644 --- a/devices/__init__.py +++ b/devices/__init__.py @@ -79,9 +79,15 @@ class group(object): def __getattribute__(self, name): def group_execution(*args, **kwargs): + rv_list = [] for member in self[:]: m = getattr(member, name) - m(*args, **kwargs) + rv_list.append(m(*args, **kwargs)) + rv = rv_list[0] + for other in rv_list[1:]: + if other != rv: + return None # Hopefully None was not expected ;-) + return rv # If all return values are identical try: rv = super().__getattribute__(name) except AttributeError: diff --git a/smart_brain_test.py b/smart_brain_test.py index ba62d88..7f9e5f8 100644 --- a/smart_brain_test.py +++ b/smart_brain_test.py @@ -6,7 +6,6 @@ from simulation.rooms import house import sys from tests.all import test_smarthome -# TODO: Reimplement failed test(s) # TODO: Reimplement existing test # TODO: Extend tests in simulation # - Test: Check of warning messages for battery and overtemperature @@ -35,8 +34,13 @@ if __name__ == "__main__": h = house(mc, pd) for name in h.getmembers(): d = h.getobjbyname(name) - for c in d.capabilities(): - COMMANDS.append(name + '.' + c) + if d.capabilities() is None: + print("\n\n" + 2*"**********\n" + "\n" + name + "\n\n" + 2*"**********\n" + "\n\n") + print(type(d)) + sys.exit(2) + else: + for c in d.capabilities(): + COMMANDS.append(name + '.' + c) # ts = test_smarthome(h, mc) for name in ts.getmembers():