Support continue_on_error for command execution in Overkiz (#103591)
This commit is contained in:
parent
d935d06265
commit
a11091890f
1 changed files with 12 additions and 5 deletions
|
@ -5,9 +5,12 @@ from typing import Any, cast
|
|||
from urllib.parse import urlparse
|
||||
|
||||
from pyoverkiz.enums import OverkizCommand, Protocol
|
||||
from pyoverkiz.exceptions import OverkizException
|
||||
from pyoverkiz.models import Command, Device, StateDefinition
|
||||
from pyoverkiz.types import StateType as OverkizStateType
|
||||
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
||||
from .coordinator import OverkizDataUpdateCoordinator
|
||||
|
||||
# Commands that don't support setting
|
||||
|
@ -88,11 +91,15 @@ class OverkizExecutor:
|
|||
):
|
||||
parameters.append(0)
|
||||
|
||||
exec_id = await self.coordinator.client.execute_command(
|
||||
self.device.device_url,
|
||||
Command(command_name, parameters),
|
||||
"Home Assistant",
|
||||
)
|
||||
try:
|
||||
exec_id = await self.coordinator.client.execute_command(
|
||||
self.device.device_url,
|
||||
Command(command_name, parameters),
|
||||
"Home Assistant",
|
||||
)
|
||||
# Catch Overkiz exceptions to support `continue_on_error` functionality
|
||||
except OverkizException as exception:
|
||||
raise HomeAssistantError(exception) from exception
|
||||
|
||||
# ExecutionRegisteredEvent doesn't contain the device_url, thus we need to register it here
|
||||
self.coordinator.executions[exec_id] = {
|
||||
|
|
Loading…
Add table
Reference in a new issue