diff --git a/pyoverkiz/client.py b/pyoverkiz/client.py index dacee501..28860b27 100644 --- a/pyoverkiz/client.py +++ b/pyoverkiz/client.py @@ -70,6 +70,7 @@ UnknownUserException, ) from pyoverkiz.models import ( + Action, Command, Device, Event, @@ -679,6 +680,23 @@ async def execute_commands( response: dict = await self.__post("exec/apply", payload) return cast(str, response["execId"]) + @retry_on_auth_error + async def execute_actions( + self, + actions: list[Action], + label: str | None = "python-overkiz-api", + ) -> str: + """Send several commands to different devices in one call""" + payload = { + "label": label, + "actions": [ + {"deviceURL": action.device_url, "commands": action.commands} + for action in actions + ], + } + response: dict = await self.__post("exec/apply", payload) + return cast(str, response["execId"]) + @retry_on_auth_error async def get_scenarios(self) -> list[Scenario]: """List the scenarios"""