From 457f4484f8b6d5c36f2a2ad2581989dd95b7f27f Mon Sep 17 00:00:00 2001 From: Maximilian Giller Date: Wed, 2 Nov 2022 12:54:41 +0100 Subject: [PATCH] Better separation of concepts for transition between devices and groups --- src/models/devices.py | 5 +++++ src/models/groups.py | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/models/devices.py b/src/models/devices.py index 041af03..d8333f4 100644 --- a/src/models/devices.py +++ b/src/models/devices.py @@ -37,3 +37,8 @@ class LightDevice(SwitchDevice): @abc.abstractmethod def color(self, color: LightColor): raise NotImplementedError + + +class AllDevice(LightDevice): + """Abstract device class that offers all device operations.""" + pass diff --git a/src/models/groups.py b/src/models/groups.py index e0f0e2d..104f8a4 100644 --- a/src/models/groups.py +++ b/src/models/groups.py @@ -1,10 +1,10 @@ from models.helper import filter_devices -from models.devices import GenericDevice, LightDevice, SwitchDevice +from models.devices import GenericDevice, LightDevice, SwitchDevice, AllDevice from models.light import LightColor, LightScene -class DeviceGroup(LightDevice): - """A group of devices that allows group operations.""" +class DeviceGroup(AllDevice): + """A group of devices that allows group operations. Inherits from a complex device to offer group operations for all devices.""" def __init__(self, devices: list[GenericDevice]): self._devices = devices