Better separation of concepts for transition between devices and groups
This commit is contained in:
parent
f95f8c7d19
commit
457f4484f8
2 changed files with 8 additions and 3 deletions
|
@ -37,3 +37,8 @@ class LightDevice(SwitchDevice):
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def color(self, color: LightColor):
|
def color(self, color: LightColor):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
|
class AllDevice(LightDevice):
|
||||||
|
"""Abstract device class that offers all device operations."""
|
||||||
|
pass
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
from models.helper import filter_devices
|
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
|
from models.light import LightColor, LightScene
|
||||||
|
|
||||||
|
|
||||||
class DeviceGroup(LightDevice):
|
class DeviceGroup(AllDevice):
|
||||||
"""A group of devices that allows group operations."""
|
"""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]):
|
def __init__(self, devices: list[GenericDevice]):
|
||||||
self._devices = devices
|
self._devices = devices
|
||||||
|
|
Loading…
Reference in a new issue