From c22c17a55d90c1e6c751b2d315ddd590991f70ee Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 1 May 2022 15:31:45 +0200 Subject: [PATCH] More flexible implementation for LightPlugin abstract methods --- platypush/plugins/light/__init__.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/platypush/plugins/light/__init__.py b/platypush/plugins/light/__init__.py index ea8a050b1..b683c884a 100644 --- a/platypush/plugins/light/__init__.py +++ b/platypush/plugins/light/__init__.py @@ -13,25 +13,37 @@ class LightPlugin(Plugin, ABC): @action @abstractmethod - def on(self): + def on(self, lights=None, *args, **kwargs): """Turn the light on""" raise NotImplementedError() @action @abstractmethod - def off(self): + def off(self, lights=None, *args, **kwargs): """Turn the light off""" raise NotImplementedError() @action @abstractmethod - def toggle(self): + def toggle(self, lights=None, *args, **kwargs): """Toggle the light status (on/off)""" raise NotImplementedError() @action @abstractmethod - def status(self): + def set_lights(self, lights=None, *args, **kwargs): + """ + Set a set of properties on a set of lights. + + :param light: List of lights to set. Each item can represent a light + name or ID. + :param kwargs: key-value list of the parameters to set. + """ + raise NotImplementedError() + + @action + @abstractmethod + def status(self, *args, **kwargs): """ Get the current status of the lights. """