diff --git a/homeassistant/components/overkiz/executor.py b/homeassistant/components/overkiz/executor.py index cd39afd9696..2e9b0080815 100644 --- a/homeassistant/components/overkiz/executor.py +++ b/homeassistant/components/overkiz/executor.py @@ -4,12 +4,22 @@ from __future__ import annotations from typing import Any from urllib.parse import urlparse -from pyoverkiz.enums.command import OverkizCommand +from pyoverkiz.enums import OverkizCommand, Protocol from pyoverkiz.models import Command, Device from pyoverkiz.types import StateType as OverkizStateType from .coordinator import OverkizDataUpdateCoordinator +# Commands that don't support setting +# the delay to another value +COMMANDS_WITHOUT_DELAY = [ + OverkizCommand.IDENTIFY, + OverkizCommand.OFF, + OverkizCommand.ON, + OverkizCommand.ON_WITH_TIMER, + OverkizCommand.TEST, +] + class OverkizExecutor: """Representation of an Overkiz device with execution handler.""" @@ -58,6 +68,14 @@ class OverkizExecutor: async def async_execute_command(self, command_name: str, *args: Any) -> None: """Execute device command in async context.""" + # Set the execution duration to 0 seconds for RTS devices on supported commands + # Default execution duration is 30 seconds and will block consecutive commands + if ( + self.device.protocol == Protocol.RTS + and command_name not in COMMANDS_WITHOUT_DELAY + ): + args = args + (0,) + exec_id = await self.coordinator.client.execute_command( self.device.device_url, Command(command_name, list(args)),