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
|
||||
def color(self, color: LightColor):
|
||||
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.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
|
||||
|
|
Loading…
Reference in a new issue