Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default delay of 0 to RTS commands #780

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion custom_components/tahoma/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,23 @@
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 .const import LOGGER
from .coordinator import OverkizDataUpdateCoordinator

# Commands that don't support setting
# the delay to another value
COMMANDS_WITHOUT_DELAY = [
OverkizCommand.IDENTIFY,
OverkizCommand.TEST,
OverkizCommand.ON,
OverkizCommand.OFF,
OverkizCommand.ON_WITH_TIMER,
]


class OverkizExecutor:
"""Representation of an Overkiz device with execution handler."""
Expand Down Expand Up @@ -63,6 +73,14 @@ def select_attribute(self, *attributes: str) -> OverkizStateType:

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,)

try:
exec_id = await self.coordinator.client.execute_command(
self.device.device_url,
Expand Down
4 changes: 2 additions & 2 deletions custom_components/tahoma/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/tahoma",
"requirements": [
"pyoverkiz==1.3.6"
"pyoverkiz==1.3.8"
],
"codeowners": [
"@imicknl",
Expand All @@ -23,4 +23,4 @@
"macaddress": "F8811A*"
}
]
}
}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pyoverkiz==1.3.6
pyoverkiz==1.3.8